From 9e43508d305ce085e1670164847f660e4d378f27 Mon Sep 17 00:00:00 2001 From: Jan de Visser Date: Mon, 19 Jul 2021 19:50:16 -0400 Subject: [PATCH] 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 --- Userland/Utilities/sql.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Userland/Utilities/sql.cpp b/Userland/Utilities/sql.cpp index e75f53e89d..b58c7bc045 100644 --- a/Userland/Utilities/sql.cpp +++ b/Userland/Utilities/sql.cpp @@ -89,7 +89,7 @@ String read_next_piece() void handle_command(StringView command) { - if (command == ".exit") + if (command == ".exit" || command == ".quit") s_keep_running = false; else outln("\033[33;1mUnrecognized command:\033[0m {}", command); @@ -174,12 +174,15 @@ int main() }; sql_client->on_connected = [&](int connection_id) { + outln("** Connected to {} **", getlogin()); the_connection_id = connection_id; read_sql(); }; 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) { read_sql(); }