9 | --------------------------------------------------------------------------------
10 | -- Commit
11 | --------------------------------------------------------------------------------
13 | ||| Commit the current transaction on a connection.
14 | |||
15 | ||| All changes made since the last commit or rollback become permanent.
16 | |||
17 | ||| Returns:
18 | ||| - Right () on success.
19 | ||| - Left OracleError on failure.
20 | |||
21 | export
32 | --------------------------------------------------------------------------------
33 | -- Rollback
34 | --------------------------------------------------------------------------------
36 | ||| Roll back the current transaction on a connection.
37 | |||
38 | ||| All changes made since the last commit or rollback are discarded.
39 | |||
40 | ||| Returns:
41 | ||| - Right () on success.
42 | ||| - Left OracleError on failure.
43 | |||
44 | export
55 | --------------------------------------------------------------------------------
56 | -- Transaction Bracket
57 | --------------------------------------------------------------------------------
59 | ||| Execute an action inside a transaction.
60 | |||
61 | ||| The transaction behavior is:
62 | ||| - If the action returns Right -> commit is performed.
63 | ||| - If the action returns Left -> rollback is performed.
64 | |||
65 | ||| The original error is preserved if rollback succeeds.
66 | |||
67 | ||| Example:
68 | |||
69 | ||| ```idris
70 | ||| withTransaction conn $ do
71 | ||| execute stmt1
72 | ||| execute stmt2
73 | ||| ```
74 | |||
75 | export