Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Nov 28, 2023
1 parent c35505a commit b111ed9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,31 @@ dbClient.transaction(_.run(Purchase.select.size)) ==> 0



### Transaction.simple.isolation

You can use `.updateRaw` to perform `SET TRANSACTION ISOLATION LEVEL` commands,
allowing you to configure the isolation and performance characteristics of
concurrent transactions in your database

```scala
dbClient.transaction { implicit db =>
db.updateRaw("SET TRANSACTION ISOLATION LEVEL SERIALIZABLE")

db.run(Purchase.select.size) ==> 7

db.run(Purchase.delete(_ => true)) ==> 7

db.run(Purchase.select.size) ==> 0
}

dbClient.transaction(_.run(Purchase.select.size)) ==> 0
```






### Transaction.simple.rollback

Example of explicitly rolling back a transaction using the `db.rollback()` method.
Expand Down
2 changes: 1 addition & 1 deletion scalasql/test/src/api/TransactionTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ trait TransactionTests extends ScalaSqlSuite {
)
test("isolation") - {
// Sqlite doesn't support configuring transaction isolation levels
if (!this.isInstanceOf[SqliteSuite]){
if (!this.isInstanceOf[SqliteSuite]) {
checker.recorded(
"""
You can use `.updateRaw` to perform `SET TRANSACTION ISOLATION LEVEL` commands,
Expand Down

0 comments on commit b111ed9

Please sign in to comment.