Transaction types
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- database
Research direction
Start with lib/transaction.js and compare its transaction handling with SQLite's BEGIN ... TRANSACTION documentation. Check how the connector handles DEFERRED, IMMEDIATE, and EXCLUSIVE and what happens for LoopBack's isolation-level values. The work is done when SQLite-supported transaction options are handled correctly without using unsupported isolation-level names.
Written by the indexing model from the issue text.
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch loopback-connector-sqlite3@3.0.0 for the project I'm working on.
The issue i'm facing is that loopback uses enum of isolation levels (below), which doesn't correspond to the sqlite3-supported list of transaction options.
The Loopback enum:
export declare enum IsolationLevel {
READ_COMMITTED = "READ COMMITTED",
READ_UNCOMMITTED = "READ UNCOMMITTED",
SERIALIZABLE = "SERIALIZABLE",
REPEATABLE_READ = "REPEATABLE READ"
}
Supported SQLITE3 BEGIN ... TRANSACTION is DEFERRED, IMMEDIATE and EXCLUSIVE (see https://www.sqlite.org/lang_transaction.html)
Here is the diff that solved my problem:
diff --git a/node_modules/loopback-connector-sqlite3/lib/transaction.js b/node_modules/loopback-connector-sqlite3/lib/transaction.js
index 580cc28..c348094 100644
--- a/node_modules/loopback-connector-sqlite3/lib/transaction.js
+++ b/node_modules/loopback-connector-sqlite3/lib/transaction.js
@@ -22,6 +24,9 @@ function mixinTransaction(SQLite3) {
cb = isolationLevel;
isolationLevel = 'DEFERRED';
}
+ if (!['DEFERRED', 'IMMEDIATE', 'EXCLUSIVE'].includes(isolationLevel)) {
+ isolationLevel = 'DEFERRED';
+ }
debug('Begin a transaction with isolation level: %s', isolationLevel);
this._getConnection(function(err, connection) {
This issue body was partially generated by patch-package.
- Dominant language
- JavaScript
- Stars
- 13
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from loopbackio/loopback-connector-sqlite3
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
feature
loopbackio/loopback-connector-sqlite3#51 · 1 assignee ·
-
backlog bug
loopbackio/loopback-connector-sqlite3#46 · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
loopbackio/loopback-connector-sqlite3#43 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 15/100
loopbackio/loopback-connector-sqlite3#40 · 7 comments · 1 reaction ·
All issues in loopbackio/loopback-connector-sqlite3
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·