1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:44:58 +00:00

sql+SQLStudio: Recover from errors preparing SQL statements

In both applications, display the SQL statement that failed to parse.
For the REPL, ensure the REPL prompts the user for another statement.
For SQLStudio, we don't continue executing the script as it likely does
not make sense to run statements that come after a failed statement.
This commit is contained in:
Timothy Flynn 2022-12-28 10:57:30 -05:00 committed by Andreas Kling
parent c08956028a
commit 82363aa1c4
4 changed files with 19 additions and 6 deletions

View file

@ -275,6 +275,11 @@ private:
});
} else if (auto statement_id = m_sql_client->prepare_statement(m_connection_id, piece); statement_id.has_value()) {
m_sql_client->async_execute_statement(*statement_id, {});
} else {
warnln("\033[33;1mError parsing SQL statement\033[0m: {}", piece);
m_loop.deferred_invoke([this]() {
read_sql();
});
}
// ...But m_keep_running can also be set to false by a command handler.