Bugfix: Explain command should display syntax errors in CLI

Closes #1392
This commit is contained in:
Anton Harniakou
2025-04-24 13:25:00 +03:00
parent dc3e97887f
commit fdf3dd9796

View File

@@ -410,8 +410,14 @@ impl<'a> Limbo<'a> {
// Uncased or Unicase.
let temp = input.to_lowercase();
if temp.trim_start().starts_with("explain") {
if let Ok(Some(stmt)) = self.conn.query(input) {
let _ = self.writeln(stmt.explain().as_bytes());
match self.conn.query(input) {
Ok(Some(stmt)) => {
let _ = self.writeln(stmt.explain().as_bytes());
}
Err(e) => {
let _ = self.writeln(e.to_string());
}
_ => {}
}
} else {
let conn = self.conn.clone();