mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 10:08:20 +00:00
Support DROP INDEX
This commit adds suport for DROP INDEX. Bytecode produced by this commit differs from SQLITE's bytecode, main reason we don't do autovacuum or repacking of pages like SQLITE does.
This commit is contained in:
parent
7137f4ab3b
commit
6c8eef2fac
6 changed files with 225 additions and 10 deletions
|
@ -189,6 +189,24 @@ pub fn op_divide(
|
|||
Ok(InsnFunctionStepResult::Step)
|
||||
}
|
||||
|
||||
pub fn op_drop_index(
|
||||
program: &Program,
|
||||
state: &mut ProgramState,
|
||||
insn: &Insn,
|
||||
pager: &Rc<Pager>,
|
||||
mv_store: Option<&Rc<MvStore>>,
|
||||
) -> Result<InsnFunctionStepResult> {
|
||||
let Insn::DropIndex { index, db } = insn else {
|
||||
unreachable!("unexpected Insn {:?}", insn)
|
||||
};
|
||||
if let Some(conn) = program.connection.upgrade() {
|
||||
let mut schema = conn.schema.write();
|
||||
schema.remove_index(&index);
|
||||
}
|
||||
state.pc += 1;
|
||||
Ok(InsnFunctionStepResult::Step)
|
||||
}
|
||||
|
||||
pub fn op_remainder(
|
||||
program: &Program,
|
||||
state: &mut ProgramState,
|
||||
|
@ -4157,13 +4175,7 @@ pub fn op_drop_table(
|
|||
pager: &Rc<Pager>,
|
||||
mv_store: Option<&Rc<MvStore>>,
|
||||
) -> Result<InsnFunctionStepResult> {
|
||||
let Insn::DropTable {
|
||||
db,
|
||||
_p2,
|
||||
_p3,
|
||||
table_name,
|
||||
} = insn
|
||||
else {
|
||||
let Insn::DropTable { db, table_name, .. } = insn else {
|
||||
unreachable!("unexpected Insn {:?}", insn)
|
||||
};
|
||||
if *db > 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue