-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
driver-adapters: remove dispose method for JS transaction interface (#…
…4489) Remove the boilerplate `Transaction.dispose` method from the public driver adapter interface and move the corresponding functionality directly to the destructor of `TransactionProxy`. Refs: #4286 Closes: prisma/team-orm#391 Co-authored-by: Miguel Fernández <[email protected]>
- Loading branch information
Showing
4 changed files
with
71 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ mod prisma_7010; | |
mod prisma_7072; | ||
mod prisma_7434; | ||
mod prisma_8265; | ||
mod prisma_engines_4286; |
24 changes: 24 additions & 0 deletions
24
...ine/connector-test-kit-rs/query-engine-tests/tests/new/regressions/prisma_engines_4286.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use query_engine_tests::*; | ||
|
||
#[test_suite(schema(generic), only(Sqlite("libsql.js")))] | ||
mod sqlite { | ||
#[connector_test] | ||
async fn close_tx_on_error(runner: Runner) -> TestResult<()> { | ||
// Try to open a transaction with unsupported isolation error in SQLite. | ||
let result = runner.start_tx(2000, 5000, Some("ReadUncommitted".to_owned())).await; | ||
assert!(result.is_err()); | ||
|
||
// Without the changes from https://github.com/prisma/prisma-engines/pull/4286 or | ||
// https://github.com/prisma/prisma-engines/pull/4489 this second `start_tx` call will | ||
// either hang infinitely with libSQL driver adapter, or fail with a "cannot start a | ||
// transaction within a transaction" error. | ||
// A more future proof way to check this would be to make both transactions EXCLUSIVE or | ||
// IMMEDIATE if we had control over SQLite transaction type here, as that would not rely on | ||
// both transactions using the same connection if we were to pool multiple SQLite | ||
// connections in the future. | ||
let tx = runner.start_tx(2000, 5000, None).await?; | ||
runner.rollback_tx(tx).await?.unwrap(); | ||
|
||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters