Skip to main content

execute_drop_table

Function execute_drop_table 

Source
pub fn execute_drop_table(
    names: &[ObjectName],
    if_exists: bool,
    db: &mut Database,
) -> Result<usize>
Expand description

Executes DROP TABLE [IF EXISTS] <name>;. Mirrors SQLite’s single-target shape: sqlparser parses DROP TABLE a, b as one statement with names: vec![a, b], but we reject the multi-target form to keep error semantics simple (no partial-failure rollback).

On success the table — and every index attached to it — disappears from the in-memory Database. The next auto-save rebuilds sqlrite_master from scratch and simply doesn’t write a row for the dropped table or its indexes; pages previously occupied by them become orphans on disk (no free-list yet — file size doesn’t shrink until a future VACUUM).