pub struct CreateTableExecutor;Expand description
Executor for CREATE TABLE statements
Implementations§
Source§impl CreateTableExecutor
impl CreateTableExecutor
Sourcepub fn execute(
stmt: &CreateTableStmt,
database: &mut Database,
) -> Result<String, ExecutorError>
pub fn execute( stmt: &CreateTableStmt, database: &mut Database, ) -> Result<String, ExecutorError>
Execute a CREATE TABLE statement
§Arguments
stmt- The CREATE TABLE statement AST nodedatabase- The database to create the table in
§Returns
Success message or error
§Examples
use vibesql_ast::{ColumnDef, CreateTableStmt};
use vibesql_executor::CreateTableExecutor;
use vibesql_storage::Database;
use vibesql_types::DataType;
let mut db = Database::new();
let 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,
},
ColumnDef {
name: "name".to_string(),
data_type: DataType::Varchar { max_length: Some(255) },
nullable: true,
constraints: vec![],
default_value: None,
comment: None,
},
],
table_constraints: vec![],
table_options: vec![],
};
let result = CreateTableExecutor::execute(&stmt, &mut db);
assert!(result.is_ok());Auto Trait Implementations§
impl Freeze for CreateTableExecutor
impl RefUnwindSafe for CreateTableExecutor
impl Send for CreateTableExecutor
impl Sync for CreateTableExecutor
impl Unpin for CreateTableExecutor
impl UnwindSafe for CreateTableExecutor
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