mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:37:35 +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
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