Merge pull request #92 from haaawk/to_sql

Simplify BTreeTable::to_sql
This commit is contained in:
Pekka Enberg
2024-07-07 14:20:02 +03:00
committed by GitHub

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"),
}
}