core/translate: BEGIN EXCLUSIVE support

After reading the fine print, SQLite documentation explains that `BEGIN
IMMEDIATE` and `BEGIN EXCLUSIVE` are the same thing in WAL mode:

https://www.sqlite.org/lang_transaction.html

As that's the only mode we support, let's just add code generation for
`BEGIN EXCLUSIVE`.

Fixes #1002
This commit is contained in:
Pekka Enberg 2025-02-14 11:50:35 +02:00
parent 567a2e9a9f
commit 76bdbb54ef
3 changed files with 6 additions and 5 deletions

View file

@ -46,7 +46,7 @@ The current status of Limbo is:
| ALTER TABLE | No | |
| ANALYZE | No | |
| ATTACH DATABASE | No | |
| BEGIN TRANSACTION | Partial | `BEGIN IMMEDIATE` is only supported mode, transaction names are not supported. |
| BEGIN TRANSACTION | Partial | `BEGIN DEFERRED` is not supported, transaction names are not supported. |
| COMMIT TRANSACTION | Partial | Transaction names are not supported. |
| CREATE INDEX | No | |
| CREATE TABLE | Partial | |

View file

@ -20,10 +20,7 @@ pub fn translate_tx_begin(
TransactionType::Deferred => {
bail_parse_error!("BEGIN DEFERRED not supported yet");
}
TransactionType::Exclusive => {
bail_parse_error!("BEGIN EXCLUSIVE not supported yet");
}
TransactionType::Immediate => {
TransactionType::Immediate | TransactionType::Exclusive => {
program.emit_insn(Insn::Transaction { write: true });
// TODO: Emit transaction instruction on temporary tables when we support them.
program.emit_insn(Insn::AutoCommit {

View file

@ -6,3 +6,7 @@ source $testdir/tester.tcl
do_execsql_test basic-tx-1 {
BEGIN IMMEDIATE; END
} {}
do_execsql_test basic-tx-2 {
BEGIN EXCLUSIVE; END
} {}