Skip to content

Commit

Permalink
Fix transaction() not actually using a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Octogonapus committed Feb 7, 2024
1 parent 012c095 commit 6956b1a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ deps/build.log

# Manifest file
Manifest.toml

.vscode/
4 changes: 1 addition & 3 deletions src/load.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,12 @@ function load(itr, conn::Connection, name::AbstractString="mysql_"*Random.randst
end

function transaction(f::Function, conn)
API.autocommit(conn.mysql, false)
execute(conn, "START TRANSACTION")
try
f()
API.commit(conn.mysql)
catch
API.rollback(conn.mysql)
rethrow()
finally
API.autocommit(conn.mysql, true)
end
end

0 comments on commit 6956b1a

Please sign in to comment.