teo_sql_connector/stmts/drop/
table.rs1use crate::schema::dialect::SQLDialect;
2use crate::schema::value::encode::ToSQLString;
3
4pub(crate) struct SQLDropTableStatement {
5 pub(crate) table: String,
6 pub(crate) if_exists: bool,
7}
8
9impl SQLDropTableStatement {
10 pub fn if_exists(&mut self) -> &mut Self {
11 self.if_exists = true;
12 self
13 }
14}
15
16impl ToSQLString for SQLDropTableStatement {
17 fn to_string(&self, _dialect: SQLDialect) -> String {
18 let table = &self.table;
19 let if_exists = if self.if_exists { " IF EXISTS" } else { "" };
20 format!("DROP TABLE{if_exists} '{table}';")
21 }
22}