pub struct DropTableExecutor;Expand description
Executor for DROP TABLE statements
Implementations§
Source§impl DropTableExecutor
impl DropTableExecutor
Sourcepub fn execute(
stmt: &DropTableStmt,
database: &mut Database,
) -> Result<String, ExecutorError>
pub fn execute( stmt: &DropTableStmt, database: &mut Database, ) -> Result<String, ExecutorError>
Execute a DROP TABLE statement
§Arguments
stmt- The DROP TABLE statement AST nodedatabase- The database to drop the table from
§Returns
Success message or error
§Examples
use vibesql_ast::{ColumnDef, CreateTableStmt, DropTableStmt};
use vibesql_executor::{CreateTableExecutor, DropTableExecutor};
use vibesql_storage::Database;
use vibesql_types::DataType;
let mut db = Database::new();
let create_stmt = CreateTableStmt {
table_name: "users".to_string(),
columns: vec![ColumnDef {
name: "id".to_string(),
data_type: DataType::Integer,
nullable: false,
constraints: vec![],
default_value: None,
comment: None,
}],
table_constraints: vec![],
table_options: vec![],
};
CreateTableExecutor::execute(&create_stmt, &mut db).unwrap();
let stmt = DropTableStmt { table_name: "users".to_string(), if_exists: false };
let result = DropTableExecutor::execute(&stmt, &mut db);
assert!(result.is_ok());Auto Trait Implementations§
impl Freeze for DropTableExecutor
impl RefUnwindSafe for DropTableExecutor
impl Send for DropTableExecutor
impl Sync for DropTableExecutor
impl Unpin for DropTableExecutor
impl UnwindSafe for DropTableExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more