Clear executor transaction

This commit is contained in:
Tobie Morgan Hitchcock 2019-12-03 10:07:19 +00:00
parent 9c101af74a
commit 412b15cc11

View file

@ -85,6 +85,7 @@ func (e *executor) execute(ctx context.Context, ast *sql.Query) {
if e.tx != nil { if e.tx != nil {
e.tx.Cancel() e.tx.Cancel()
clear(e.id) clear(e.id)
e.tx = nil
} }
}() }()
@ -255,16 +256,19 @@ func (e *executor) operate(ctx context.Context, stm sql.Statement) (res []interf
loc, trw = true, false loc, trw = true, false
} }
defer func() {
if e.tx != nil {
e.tx.Cancel()
clear(e.id)
e.tx = nil
}
}()
err = e.begin(ctx, trw) err = e.begin(ctx, trw)
if err != nil { if err != nil {
return return
} }
defer func() {
e.tx.Cancel()
e.tx = nil
}()
} }
// Mark the beginning of this statement so we // Mark the beginning of this statement so we