Don’t delete txn until we have cancelled/committed

This commit is contained in:
Tobie Morgan Hitchcock 2017-02-20 01:17:05 +00:00
parent a700ef9bc4
commit fbb0bd79bd

View file

@ -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
}
}