Skip to content

Commit 2d4d652

Browse files
author
James Cor
committed
remove todos
1 parent 5de9a32 commit 2d4d652

File tree

6 files changed

+0
-27
lines changed

6 files changed

+0
-27
lines changed

sql/expression/procedurereference.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ import (
2323
"github.com/dolthub/go-mysql-server/sql/types"
2424
)
2525

26-
// TODO: instead of procedure reference, copy stack from doltgres
27-
2826
// ProcedureReference contains the state for a single CALL statement of a stored procedure.
2927
type ProcedureReference struct {
3028
InnermostScope *procedureScope

sql/planbuilder/proc.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ func (b *Builder) buildCall(inScope *scope, c *ast.Call) (outScope *scope) {
345345
b.handleErr(err)
346346
}
347347

348-
// TODO: build references here?
349-
// TODO: here fill in x from session
350348
params := make([]sql.Expression, len(c.Params))
351349
for i, param := range c.Params {
352350
if len(proc.Params) == len(c.Params) {

sql/procedures.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ type Interpreter interface {
2727
SetStatementRunner(ctx *Context, runner StatementRunner) Expression
2828
}
2929

30-
// TODO: InterpreterNode interface
31-
// TODO: alternatively have plan.Call just have an interpreter expression
32-
3330
// StatementRunner is essentially an interface that the engine will implement. We cannot directly reference the engine
3431
// here as it will cause an import cycle, so this may be updated to suit any function changes that the engine
3532
// experiences.

sql/procedures/interpreter_logic.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ func replaceVariablesInExpr(ctx *sql.Context, stack *InterpreterStack, expr ast.
121121
e.Expr = newExpr.(ast.Expr)
122122
case *ast.Set:
123123
for _, setExpr := range e.Exprs {
124-
// TODO: properly handle user scope variables
125124
newExpr, err := replaceVariablesInExpr(ctx, stack, setExpr.Expr, asOf)
126125
if err != nil {
127126
return nil, err
@@ -137,7 +136,6 @@ func replaceVariablesInExpr(ctx *sql.Context, stack *InterpreterStack, expr ast.
137136
}
138137
case *ast.Call:
139138
for i := range e.Params {
140-
// TODO: do not replace certain params
141139
newExpr, err := replaceVariablesInExpr(ctx, stack, e.Params[i], asOf)
142140
if err != nil {
143141
return nil, err
@@ -163,7 +161,6 @@ func replaceVariablesInExpr(ctx *sql.Context, stack *InterpreterStack, expr ast.
163161
e.Rowcount = newRowCount.(ast.Expr)
164162
}
165163
case *ast.Into:
166-
// TODO: somehow support select into variables
167164
for i := range e.Variables {
168165
newExpr, err := replaceVariablesInExpr(ctx, stack, e.Variables[i], asOf)
169166
if err != nil {
@@ -433,7 +430,6 @@ func execOp(ctx *sql.Context, runner sql.StatementRunner, stack *InterpreterStac
433430
case OpCode_Declare:
434431
declareStmt := operation.PrimaryData.(*ast.Declare)
435432

436-
// TODO: duplicate conditions?
437433
if cond := declareStmt.Condition; cond != nil {
438434
condName := strings.ToLower(cond.Name)
439435
stateVal := cond.SqlStateValue
@@ -457,13 +453,11 @@ func execOp(ctx *sql.Context, runner sql.StatementRunner, stack *InterpreterStac
457453
stack.NewCondition(condName, stateVal, num)
458454
}
459455

460-
// TODO: duplicate cursors?
461456
if cursor := declareStmt.Cursor; cursor != nil {
462457
cursorName := strings.ToLower(cursor.Name)
463458
stack.NewCursor(cursorName, cursor.SelectStmt)
464459
}
465460

466-
// TODO: duplicate handlers?
467461
if handler := declareStmt.Handler; handler != nil {
468462
if len(handler.ConditionValues) != 1 {
469463
return 0, nil, nil, nil, sql.ErrUnsupportedSyntax.New(ast.String(declareStmt))
@@ -487,7 +481,6 @@ func execOp(ctx *sql.Context, runner sql.StatementRunner, stack *InterpreterStac
487481
stack.NewHandler(hCond.ValueType, handler.Action, handler.Statement, counter)
488482
}
489483

490-
// TODO: duplicate variables?
491484
if vars := declareStmt.Variables; vars != nil {
492485
for _, decl := range vars.Names {
493486
varType, err := types.ColumnTypeToType(&vars.VarType)
@@ -504,7 +497,6 @@ func execOp(ctx *sql.Context, runner sql.StatementRunner, stack *InterpreterStac
504497
}
505498

506499
case OpCode_Signal:
507-
// TODO: copy logic from planbuilder/proc.go: buildSignal()
508500
signalStmt := operation.PrimaryData.(*ast.Signal)
509501
var msgTxt string
510502
var sqlState string
@@ -712,7 +704,6 @@ func execOp(ctx *sql.Context, runner sql.StatementRunner, stack *InterpreterStac
712704
if err != nil {
713705
return 0, nil, nil, nil, err
714706
}
715-
// TODO: exactly one result that is a bool for now
716707
row, err := rowIter.Next(ctx)
717708
if err != nil {
718709
return 0, nil, nil, nil, err
@@ -767,7 +758,6 @@ func execOp(ctx *sql.Context, runner sql.StatementRunner, stack *InterpreterStac
767758
if err != nil {
768759
return 0, nil, nil, nil, err
769760
}
770-
// TODO: create a OpCode_Call to store procedures in the stack
771761
sch, rowIter, err := query(ctx, runner, stmt.(ast.Statement))
772762
if err != nil {
773763
return 0, nil, nil, nil, err
@@ -812,12 +802,10 @@ func Call(ctx *sql.Context, iNode InterpreterNode) (sql.RowIter, *InterpreterSta
812802
}
813803
}
814804

815-
// TODO: remove this; track last selectRowIter
816805
var selIter sql.RowIter
817806
var selSch sql.Schema
818807

819808
// Run the statements
820-
// TODO: eventually return multiple sql.RowIters
821809
var rowIters []sql.RowIter
822810
var retSch sql.Schema
823811
runner := iNode.GetRunner()
@@ -831,10 +819,6 @@ func Call(ctx *sql.Context, iNode InterpreterNode) (sql.RowIter, *InterpreterSta
831819
break
832820
}
833821

834-
// TODO: server engine can't run multiple statements in procedures because the ctx keeps getting cancelled
835-
// from the TrackedRowIter.
836-
// Uncancel query?
837-
// Use subcontexts?
838822
subCtx := sql.NewContext(context.Background())
839823
subCtx.Session = ctx.Session
840824

@@ -873,6 +857,5 @@ func Call(ctx *sql.Context, iNode InterpreterNode) (sql.RowIter, *InterpreterSta
873857
iNode.SetSchema(retSch)
874858
}
875859

876-
// TODO: probably need to set result schema for these too
877860
return rowIters[len(rowIters)-1], stack, nil
878861
}

sql/rowexec/rel.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ func (b *BaseBuilder) buildExternalProcedure(ctx *sql.Context, n *plan.ExternalP
730730
}
731731
for i, paramDefinition := range n.ParamDefinitions {
732732
if paramDefinition.Direction == plan.ProcedureParamDirection_Inout || paramDefinition.Direction == plan.ProcedureParamDirection_Out {
733-
// TODO: not sure if we should still be doing this
734733
exprParam := n.Params[i]
735734
funcParamVal := funcParams[i+1].Elem().Interface()
736735
err := exprParam.Set(ctx, funcParamVal, exprParam.Type())

sql/session.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ type Session interface {
178178
// ValidateSession provides integrators a chance to do any custom validation of this session before any query is
179179
// executed in it. For example, Dolt uses this hook to validate that the session's working set is valid.
180180
ValidateSession(ctx *Context) error
181-
182-
//SetInStoredProcedure(val bool)
183181
}
184182

185183
// PersistableSession supports serializing/deserializing global system variables/

0 commit comments

Comments
 (0)