executor: remove Next function for prepared.go (#6003)
This commit is contained in:
@ -93,18 +93,8 @@ func NewPrepareExec(ctx sessionctx.Context, is infoschema.InfoSchema, sqlTxt str
|
||||
}
|
||||
}
|
||||
|
||||
// Next implements the Executor Next interface.
|
||||
func (e *PrepareExec) Next(ctx context.Context) (Row, error) {
|
||||
return nil, errors.Trace(e.DoPrepare())
|
||||
}
|
||||
|
||||
// NextChunk implements the Executor NextChunk interface.
|
||||
func (e *PrepareExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error {
|
||||
return errors.Trace(e.DoPrepare())
|
||||
}
|
||||
|
||||
// DoPrepare prepares the statement, it can be called multiple times without side effect.
|
||||
func (e *PrepareExec) DoPrepare() error {
|
||||
vars := e.ctx.GetSessionVars()
|
||||
if e.ID != 0 {
|
||||
// Must be the case when we retry a prepare.
|
||||
@ -194,12 +184,6 @@ type ExecuteExec struct {
|
||||
plan plan.Plan
|
||||
}
|
||||
|
||||
// Next implements the Executor Next interface.
|
||||
// It will never be called.
|
||||
func (e *ExecuteExec) Next(ctx context.Context) (Row, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// NextChunk implements the Executor NextChunk interface.
|
||||
func (e *ExecuteExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error {
|
||||
return nil
|
||||
@ -236,17 +220,8 @@ type DeallocateExec struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
// Next implements the Executor Next interface.
|
||||
func (e *DeallocateExec) Next(ctx context.Context) (Row, error) {
|
||||
return nil, errors.Trace(e.run(ctx))
|
||||
}
|
||||
|
||||
// NextChunk implements the Executor NextChunk interface.
|
||||
func (e *DeallocateExec) NextChunk(ctx context.Context, chk *chunk.Chunk) error {
|
||||
return errors.Trace(e.run(ctx))
|
||||
}
|
||||
|
||||
func (e *DeallocateExec) run(ctx context.Context) error {
|
||||
vars := e.ctx.GetSessionVars()
|
||||
id, ok := vars.PreparedStmtNameToID[e.Name]
|
||||
if !ok {
|
||||
|
||||
@ -859,7 +859,7 @@ func (s *session) PrepareStmt(sql string) (stmtID uint32, paramCount int, fields
|
||||
// So we have to call PrepareTxnCtx here.
|
||||
s.PrepareTxnCtx(ctx)
|
||||
prepareExec := executor.NewPrepareExec(s, executor.GetInfoSchema(s), sql)
|
||||
err = prepareExec.DoPrepare()
|
||||
err = prepareExec.NextChunk(ctx, nil)
|
||||
if err != nil {
|
||||
err = errors.Trace(err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user