Skip to content

Commit 6ce11ad

Browse files
author
James Cor
committed
remove error
1 parent 8103742 commit 6ce11ad

File tree

3 files changed

+14
-26
lines changed

3 files changed

+14
-26
lines changed

engine.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ func (e *Engine) QueryWithBindings(ctx *sql.Context, query string, parsed sqlpar
447447
}
448448

449449
var schema sql.Schema
450-
iter, schema, err = finalizeIters(ctx, analyzed, qFlags, iter)
450+
iter, schema = finalizeIters(ctx, analyzed, qFlags, iter)
451451
if err != nil {
452452
clearAutocommitErr := clearAutocommitTransaction(ctx)
453453
if clearAutocommitErr != nil {
@@ -493,7 +493,7 @@ func (e *Engine) PrepQueryPlanForExecution(ctx *sql.Context, _ string, plan sql.
493493
}
494494

495495
var schema sql.Schema
496-
iter, schema, err = finalizeIters(ctx, plan, qFlags, iter)
496+
iter, schema = finalizeIters(ctx, plan, qFlags, iter)
497497
if err != nil {
498498
clearAutocommitErr := clearAutocommitTransaction(ctx)
499499
if clearAutocommitErr != nil {
@@ -852,14 +852,7 @@ func (e *Engine) executeEvent(ctx *sql.Context, dbName, createEventStatement, us
852852
return err
853853
}
854854

855-
iter, _, err = finalizeIters(ctx, definitionNode, nil, iter)
856-
if err != nil {
857-
clearAutocommitErr := clearAutocommitTransaction(ctx)
858-
if clearAutocommitErr != nil {
859-
return clearAutocommitErr
860-
}
861-
return err
862-
}
855+
iter, _ = finalizeIters(ctx, definitionNode, nil, iter)
863856

864857
// Drain the iterate to execute the event body/definition
865858
// NOTE: No row data is returned for an event; we just need to execute the statements
@@ -894,17 +887,12 @@ func findCreateEventNode(planTree sql.Node) (*plan.CreateEvent, error) {
894887
}
895888

896889
// finalizeIters applies the final transformations on sql.RowIter before execution.
897-
func finalizeIters(ctx *sql.Context, analyzed sql.Node, qFlags *sql.QueryFlags, iter sql.RowIter) (sql.RowIter, sql.Schema, error) {
898-
var err error
890+
func finalizeIters(ctx *sql.Context, analyzed sql.Node, qFlags *sql.QueryFlags, iter sql.RowIter) (sql.RowIter, sql.Schema) {
899891
var sch sql.Schema
900-
// TODO: if this is does something we need to overwrite the schema with types.OkResultSchema
901-
iter, sch, err = rowexec.AddAccumulatorIter(ctx, iter)
902-
if err != nil {
903-
return nil, nil, err
904-
}
892+
iter, sch = rowexec.AddAccumulatorIter(ctx, iter)
905893
iter = rowexec.AddTriggerRollbackIter(ctx, qFlags, iter)
906894
iter = rowexec.AddTransactionCommittingIter(qFlags, iter)
907895
iter = plan.AddTrackedRowIter(ctx, analyzed, iter)
908896
iter = rowexec.AddExpressionCloser(analyzed, iter)
909-
return iter, sch, nil
897+
return iter, sch
910898
}

engine_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func TestTrackProcess(t *testing.T) {
232232

233233
iter, err := rowexec.DefaultBuilder.Build(ctx, result, nil)
234234
require.NoError(err)
235-
iter, _, err = finalizeIters(ctx, result, nil, iter)
235+
iter, _ = finalizeIters(ctx, result, nil, iter)
236236
require.NoError(err)
237237
_, err = sql.RowIterToRows(ctx, iter)
238238
require.NoError(err)

sql/rowexec/dml_iters.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,26 +563,26 @@ func getRowHandler(clientFoundRowsToggled bool, iter sql.RowIter) accumulatorRow
563563
}
564564
}
565565

566-
func AddAccumulatorIter(ctx *sql.Context, iter sql.RowIter) (sql.RowIter, sql.Schema, error) {
566+
func AddAccumulatorIter(ctx *sql.Context, iter sql.RowIter) (sql.RowIter, sql.Schema) {
567567
switch i := iter.(type) {
568568
case *callIter:
569-
childIter, sch, err := AddAccumulatorIter(ctx, i.innerIter)
569+
childIter, sch := AddAccumulatorIter(ctx, i.innerIter)
570570
i.innerIter = childIter
571-
return i, sch, err
571+
return i, sch
572572
case *beginEndIter:
573-
childIter, sch, err := AddAccumulatorIter(ctx, i.rowIter)
573+
childIter, sch := AddAccumulatorIter(ctx, i.rowIter)
574574
i.rowIter = childIter
575-
return i, sch, err
575+
return i, sch
576576
default:
577577
clientFoundRowsToggled := (ctx.Client().Capabilities & mysql.CapabilityClientFoundRows) > 0
578578
rowHandler := getRowHandler(clientFoundRowsToggled, iter)
579579
if rowHandler == nil {
580-
return iter, nil, nil
580+
return iter, nil
581581
}
582582
return &accumulatorIter{
583583
iter: iter,
584584
updateRowHandler: rowHandler,
585-
}, types.OkResultSchema, nil
585+
}, types.OkResultSchema
586586
}
587587
}
588588

0 commit comments

Comments
 (0)