diff --git a/db/db.go b/db/db.go index aa24191b..a1c3846b 100644 --- a/db/db.go +++ b/db/db.go @@ -475,9 +475,11 @@ func (e *executor) operate(ast sql.Statement) (res []interface{}, err error) { if loc && !e.txn.Closed() { if !trw || err != nil { - e.txn, err = nil, e.txn.Cancel() + e.txn.Cancel() + e.txn = nil } else { - e.txn, err = nil, e.txn.Commit() + e.txn.Commit() + e.txn = nil } }