drogonframework / drogonframework/drogon

Add ability to use BEGIN IMMEDIATE and BEGIN EXCLUSIVE database transactions (SQLite backend)

Open
#2,487 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
14.3k
Forks
1.4k
Avg merge
1d 13h
Merged PRs (30d)
14

Description

SQLite's method of setting the transaction mode, is to add IMMEDIATE/EXCLUSIVE to the BEGIN command. Drogon currently hard-codes BEGIN.

The down side of this is potential transaction failures of the read and then write (or read and maybe write) pattern.

I suggest adding a newTransaction() variant that takes the following enum:

```
enum class TransactionType {
Default, // current behavior
Immediate, // SQLite: BEGIN IMMEDIATE
Exclusive // SQLite: BEGIN EXCLUSIVE
};
```

This would allow BEGIN IMMEDIATE and BEGIN EXCLUSIVE. Other databases could safely ignore this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.