File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -494,10 +494,12 @@ func (ai *aggInfo) Done(ctx *C.sqlite3_context) {
494
494
// Commit transaction.
495
495
func (tx * SQLiteTx ) Commit () error {
496
496
_ , err := tx .c .exec (context .Background (), "COMMIT" , nil )
497
- if err != nil && ( err .( Error ). Code == C . SQLITE_BUSY || err .( Error ). Code == C . SQLITE_CONSTRAINT ) {
498
- // sqlite3 will leave the transaction open in this scenario.
497
+ if err != nil {
498
+ // sqlite3 may leave the transaction open in this scenario.
499
499
// However, database/sql considers the transaction complete once we
500
500
// return from Commit() - we must clean up to honour its semantics.
501
+ // We don't know if the ROLLBACK is strictly necessary, but according
502
+ // to sqlite's docs, there is no harm in calling ROLLBACK unnecessarily.
501
503
tx .c .exec (context .Background (), "ROLLBACK" , nil )
502
504
}
503
505
return err
You can’t perform that action at this time.
0 commit comments