mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +00:00
Utilities: Some minor changes in sql REPL tool
- Added a connection banner - Added '.quit' synonym for '.exit' - Do not display updated/created/deleted banner if there were no changes
This commit is contained in:
parent
d074a601df
commit
9e43508d30
Notes:
sideshowbarker
2024-07-18 05:26:09 +09:00
Author: https://github.com/JanDeVisser
Commit: 9e43508d30
Pull-request: https://github.com/SerenityOS/serenity/pull/8906
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 5 additions and 2 deletions
|
@ -89,7 +89,7 @@ String read_next_piece()
|
||||||
|
|
||||||
void handle_command(StringView command)
|
void handle_command(StringView command)
|
||||||
{
|
{
|
||||||
if (command == ".exit")
|
if (command == ".exit" || command == ".quit")
|
||||||
s_keep_running = false;
|
s_keep_running = false;
|
||||||
else
|
else
|
||||||
outln("\033[33;1mUnrecognized command:\033[0m {}", command);
|
outln("\033[33;1mUnrecognized command:\033[0m {}", command);
|
||||||
|
@ -174,12 +174,15 @@ int main()
|
||||||
};
|
};
|
||||||
|
|
||||||
sql_client->on_connected = [&](int connection_id) {
|
sql_client->on_connected = [&](int connection_id) {
|
||||||
|
outln("** Connected to {} **", getlogin());
|
||||||
the_connection_id = connection_id;
|
the_connection_id = connection_id;
|
||||||
read_sql();
|
read_sql();
|
||||||
};
|
};
|
||||||
|
|
||||||
sql_client->on_execution_success = [&](int, bool has_results, int updated, int created, int deleted) {
|
sql_client->on_execution_success = [&](int, bool has_results, int updated, int created, int deleted) {
|
||||||
outln("{} row(s) updated, {} created, {} deleted", updated, created, deleted);
|
if (updated != 0 || created != 0 || deleted != 0) {
|
||||||
|
outln("{} row(s) updated, {} created, {} deleted", updated, created, deleted);
|
||||||
|
}
|
||||||
if (!has_results) {
|
if (!has_results) {
|
||||||
read_sql();
|
read_sql();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue