Skip to content

Commit

Permalink
Merge pull request #676 from emm035/rollback-failed-execcontext
Browse files Browse the repository at this point in the history
Roll back transaction on failed ExecContext
  • Loading branch information
xiam authored Aug 26, 2023
2 parents 11a034d + 492a68c commit 5c1fffd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions adapter/sqlite/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func (*database) StatementExec(sess sqladapter.Session, ctx context.Context, que
}

if res, err = compat.ExecContext(sqlTx, ctx, query, args); err != nil {
_ = sqlTx.Rollback()
return nil, err
}

Expand Down
3 changes: 0 additions & 3 deletions internal/testsuite/sql_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ func (s *SQLTestSuite) TestPreparedStatementsCache() {
switch s.Adapter() {
case "ql":
limit = 1000
case "sqlite":
// TODO: We'll probably be able to workaround this with a mutex on inserts.
s.T().Skip(`Skipped due to a "database is locked" problem with concurrent transactions. See https://github.com/mattn/go-sqlite3/issues/274`)
}

for i := 0; i < limit; i++ {
Expand Down

0 comments on commit 5c1fffd

Please sign in to comment.