impl ToSqlString for DETACH stmt

This commit is contained in:
pedrocarlo
2025-05-28 13:36:02 -03:00
parent 0dc5ca668c
commit 8ff0a3c780

View File

@@ -121,6 +121,7 @@ impl ToSqlString for ast::Stmt {
create_virtual_table.to_sql_string(context)
}
Self::Delete(delete) => delete.to_sql_string(context),
Self::Detach(name) => format!("DETACH {};", name.to_sql_string(context)),
Self::Select(select) => format!("{};", select.to_sql_string(context)),
_ => todo!(),
}
@@ -308,4 +309,10 @@ mod tests {
test_create_view_arithmetic,
"CREATE VIEW view_arithmetic AS SELECT name, salary * 1.1 AS adjusted_salary FROM employees;"
);
to_sql_string_test!(
test_detach,
"DETACH 'x.db';"
);
}