summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan de Visser <jan@de-visser.net>2021-07-19 19:50:16 -0400
committerAndreas Kling <kling@serenityos.org>2021-08-21 22:03:30 +0200
commit9e43508d305ce085e1670164847f660e4d378f27 (patch)
tree76d248f276f170a47820b97b9d57e5179317a308
parentd074a601dfdb3cdbb50b83c142db85d079da475f (diff)
downloadserenity-9e43508d305ce085e1670164847f660e4d378f27.zip
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
-rw-r--r--Userland/Utilities/sql.cpp7
1 files 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();
}