Don’t delete txn until we have cancelled/committed
This commit is contained in:
parent
a700ef9bc4
commit
fbb0bd79bd
1 changed files with 4 additions and 2 deletions
6
db/db.go
6
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue