Simplify BTreeTable::to_sql

Signed-off-by: Piotr Jastrzebski <haaawk@gmail.com>
This commit is contained in:
Piotr Jastrzebski
2024-07-07 13:15:04 +02:00
parent ac5b0502b4
commit 708cae99b8

View File

@@ -94,22 +94,10 @@ impl BTreeTable {
let mut parser = Parser::new(sql.as_bytes());
let cmd = parser.next()?;
match cmd {
Some(cmd) => match cmd {
Cmd::Stmt(stmt) => match stmt {
Stmt::CreateTable { tbl_name, body, .. } => {
create_table(tbl_name, body, root_page)
}
_ => {
anyhow::bail!("Expected CREATE TABLE statement");
}
},
_ => {
anyhow::bail!("Expected CREATE TABLE statement");
}
},
None => {
anyhow::bail!("Expected CREATE TABLE statement");
Some(Cmd::Stmt(Stmt::CreateTable { tbl_name, body, .. })) => {
create_table(tbl_name, body, root_page)
}
_ => anyhow::bail!("Expected CREATE TABLE statement"),
}
}