Prevent writes to db file in the VDBE if we are in readonly mode

This commit is contained in:
PThorpe92
2025-06-30 13:41:10 -04:00
parent d526915b24
commit 2e967b778b

View File

@@ -4692,6 +4692,9 @@ pub fn op_open_write(
else {
unreachable!("unexpected Insn {:?}", insn)
};
if program.connection.readonly.get() {
return Err(LimboError::ReadOnly);
}
let root_page = match root_page {
RegisterOrLiteral::Literal(lit) => *lit as u64,
RegisterOrLiteral::Register(reg) => match &state.registers[*reg].get_owned_value() {
@@ -4794,6 +4797,9 @@ pub fn op_create_btree(
let Insn::CreateBtree { db, root, flags } = insn else {
unreachable!("unexpected Insn {:?}", insn)
};
if program.connection.readonly.get() {
return Err(LimboError::ReadOnly);
}
if *db > 0 {
// TODO: implement temp databases
todo!("temp databases not implemented yet");