Fix .schema

- Add tests for .schema
- Make command line sql arguments to allow .commands
This commit is contained in:
Bennett Clement 2024-07-22 11:08:14 +08:00
parent 0f85c36416
commit 5b4bdc8aa3
4 changed files with 40 additions and 2 deletions

View file

@ -40,7 +40,11 @@ fn main() -> anyhow::Result<()> {
let db = Database::open_file(io.clone(), path)?;
let conn = db.connect();
if let Some(sql) = opts.sql {
query(io.clone(), &conn, &sql, &opts.output_mode)?;
if sql.trim().starts_with('.') {
handle_dot_command(io.clone(), &conn, &sql)?;
} else {
query(io.clone(), &conn, &sql, &opts.output_mode)?;
}
return Ok(());
}
let mut rl = DefaultEditor::new()?;