mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 01:37:39 +03: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: https://github.com/SerenityOS/serenity/commit/9e43508d305 Pull-request: https://github.com/SerenityOS/serenity/pull/8906 Reviewed-by: https://github.com/trflynn89 ✅
@ -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) {
|
||||||
|
if (updated != 0 || created != 0 || deleted != 0) {
|
||||||
outln("{} row(s) updated, {} created, {} deleted", updated, created, deleted);
|
outln("{} row(s) updated, {} created, {} deleted", updated, created, deleted);
|
||||||
|
}
|
||||||
if (!has_results) {
|
if (!has_results) {
|
||||||
read_sql();
|
read_sql();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user