implement ToSqlString for AlterTable

This commit is contained in:
pedrocarlo
2025-05-27 18:48:45 -03:00
parent e0c2a09d71
commit 7fb3d40ec2
2 changed files with 211 additions and 0 deletions

View File

@@ -2,11 +2,20 @@ use crate::ast;
use super::ToSqlString;
mod alter_table;
mod select;
impl ToSqlString for ast::Stmt {
fn to_sql_string<C: super::ToSqlContext>(&self, context: &C) -> String {
match self {
Self::AlterTable(alter_table) => {
let (name, body) = alter_table.as_ref();
format!(
"ALTER TABLE {} {}",
name.to_sql_string(context),
body.to_sql_string(context)
)
}
Self::Select(select) => select.to_sql_string(context),
_ => todo!(),
}