mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-07 12:35:00 +00:00
Implement deferred transactions
As explained in docs: https://sqlite.org/lang_transaction.html "BEGIN DEFERRED statement merely sets a flag on the database connection that turns off the automatic commit that would normally occur when the last statement finishes." The transaction upgrade (read -> write) is already handled by the VDBE
This commit is contained in:
parent
2314e7f906
commit
250478fedf
2 changed files with 9 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::translate::{ProgramBuilder, ProgramBuilderOpts};
|
||||
use crate::vdbe::insn::Insn;
|
||||
use crate::{bail_parse_error, QueryMode, Result};
|
||||
use crate::{QueryMode, Result};
|
||||
use limbo_sqlite3_parser::ast::{Name, TransactionType};
|
||||
|
||||
pub fn translate_tx_begin(
|
||||
|
@ -18,7 +18,10 @@ pub fn translate_tx_begin(
|
|||
let tx_type = tx_type.unwrap_or(TransactionType::Deferred);
|
||||
match tx_type {
|
||||
TransactionType::Deferred => {
|
||||
bail_parse_error!("BEGIN DEFERRED not supported yet");
|
||||
program.emit_insn(Insn::AutoCommit {
|
||||
auto_commit: false,
|
||||
rollback: false,
|
||||
});
|
||||
}
|
||||
TransactionType::Immediate | TransactionType::Exclusive => {
|
||||
program.emit_insn(Insn::Transaction { write: true });
|
||||
|
|
|
@ -10,3 +10,7 @@ do_execsql_test basic-tx-1 {
|
|||
do_execsql_test basic-tx-2 {
|
||||
BEGIN EXCLUSIVE; END
|
||||
} {}
|
||||
|
||||
do_execsql_test basic-tx-3 {
|
||||
BEGIN DEFERRED; END
|
||||
} {}
|
Loading…
Add table
Add a link
Reference in a new issue