Skip to content

Serializable Isolation level for SQLite Databases #4693

Merged
aleks-f merged 4 commits intomainfrom
sqlite.isolation
Oct 10, 2024
Merged

Serializable Isolation level for SQLite Databases #4693
aleks-f merged 4 commits intomainfrom
sqlite.isolation

Conversation

@aleks-f
Copy link
Copy Markdown
Member

@aleks-f aleks-f commented Sep 15, 2024

No description provided.

bas524 and others added 3 commits June 7, 2024 15:58
I've add transaction isolation support for SQLite
Warning! SQLite transactions are [serializable by design](https://
www.sqlite.org/isolation.html) but my implementation retuns false in
function hasTransactionIsolation and throw an exception in
setTransactionIsolation
@aleks-f aleks-f linked an issue Sep 15, 2024 that may be closed by this pull request
@aleks-f aleks-f added this to the Release 1.14.0 milestone Sep 15, 2024
@aleks-f aleks-f changed the title Sqlite.isolation Serializable Isolation level for SQLite Databases Sep 15, 2024
Comment on lines +137 to +154
switch (ti)
{
case Session::TRANSACTION_READ_COMMITTED:
tmp.add(SQLITE_READ_COMMITTED);
_transactionIsolationLevel = Session::TRANSACTION_READ_COMMITTED;
break;
case Session::TRANSACTION_READ_UNCOMMITTED:
tmp.add(SQLITE_READ_UNCOMMITTED);
_transactionIsolationLevel = Session::TRANSACTION_READ_UNCOMMITTED;
break;
case Session::TRANSACTION_REPEATABLE_READ:
throw Poco::InvalidArgumentException("setTransactionIsolation(TRANSACTION_REPEATABLE_READ) - unsupported");
case Session::TRANSACTION_SERIALIZABLE:
throw Poco::InvalidArgumentException("setTransactionIsolation(TRANSACTION_SERIALIZABLE) - unsupported [SQLite transactions are serializable by design]");
default:
throw Poco::InvalidArgumentException(Poco::format("setTransactionIsolation(%u) - unsupported", ti));
break;
}

Check warning

Code scanning / CodeQL

Use of integer where enum is preferred

Enumeration types should be used instead of integers to select from a limited series of choices.
Comment on lines +167 to +177
switch (ti)
{
case Session::TRANSACTION_READ_COMMITTED:
return true;
case Session::TRANSACTION_READ_UNCOMMITTED:
return true;
case Session::TRANSACTION_REPEATABLE_READ:
return false;
case Session::TRANSACTION_SERIALIZABLE:
return false;
}

Check warning

Code scanning / CodeQL

Use of integer where enum is preferred

Enumeration types should be used instead of integers to select from a limited series of choices.
Copy link
Copy Markdown
Member Author

@aleks-f aleks-f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bas524 tests are failing on mac

@bas524
Copy link
Copy Markdown
Contributor

bas524 commented Sep 25, 2024

@bas524 tests are failing on mac

Hi!
I can't reproduce problem on my mac.
I'll try to find another for test

@bas524
Copy link
Copy Markdown
Contributor

bas524 commented Oct 1, 2024

@bas524 tests are failing on mac

@aleks-f , Hi!
I've fixed the problem into PR #4718
Could you re-run the merging ?

@aleks-f aleks-f merged commit 88c4958 into main Oct 10, 2024
@aleks-f aleks-f deleted the sqlite.isolation branch October 10, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Serializable Isolation level for SQLite Databases

2 participants