Merge 'core/translate: BEGIN EXCLUSIVE support' from Pekka Enberg

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

Closes #1003
This commit is contained in:
Pekka Enberg
2025-02-14 12:20:22 +02:00
3 changed files with 6 additions and 5 deletions

View File

@@ -54,7 +54,7 @@ Limbo aims to be fully compatible with SQLite, with opt-in features not supporte
| 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
} {}