diff options
author | Jan de Visser <jan@de-visser.net> | 2021-08-26 18:45:37 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-05 02:22:19 +0200 |
commit | e923cb3739a181e867cbd12152483cf81aea1f63 (patch) | |
tree | b5538802d9326807c11d5e0a3c23d52fe8842fc6 /Userland/Services | |
parent | c5c7a9d1989438029149f0c7c289b5d9c75287e3 (diff) | |
download | serenity-e923cb3739a181e867cbd12152483cf81aea1f63.zip |
SQLServer+SQL+LibSQL: Allow sql client to specify the database name
The database the sql client connected to was 'hardcoded' to the login
name of the calling user.
- Extended the IPC API to be more expressive when connecting, by
returning the name of the database the client connected to in the
'connected' callback.
- Gave the sql client a command line argument (-d/--database) allowing
an alternative database name to be specified
A subsequent commit will have a dot command allowing the user to
connect to different databases from the same sql session.
Diffstat (limited to 'Userland/Services')
-rw-r--r-- | Userland/Services/SQLServer/DatabaseConnection.cpp | 2 | ||||
-rw-r--r-- | Userland/Services/SQLServer/SQLClient.ipc | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Services/SQLServer/DatabaseConnection.cpp b/Userland/Services/SQLServer/DatabaseConnection.cpp index e83fccc925..97c50a32d5 100644 --- a/Userland/Services/SQLServer/DatabaseConnection.cpp +++ b/Userland/Services/SQLServer/DatabaseConnection.cpp @@ -43,7 +43,7 @@ DatabaseConnection::DatabaseConnection(String database_name, int client_id) m_accept_statements = true; auto client_connection = ClientConnection::client_connection_for(m_client_id); if (client_connection) - client_connection->async_connected(m_connection_id); + client_connection->async_connected(m_connection_id, m_database_name); else warnln("Cannot notify client of database connection. Client disconnected"); }); diff --git a/Userland/Services/SQLServer/SQLClient.ipc b/Userland/Services/SQLServer/SQLClient.ipc index 960ed8e907..f6efebe521 100644 --- a/Userland/Services/SQLServer/SQLClient.ipc +++ b/Userland/Services/SQLServer/SQLClient.ipc @@ -1,6 +1,6 @@ endpoint SQLClient { - connected(int connection_id) =| + connected(int connection_id, String connected_to_database) =| connection_error(int connection_id, int code, String message) =| execution_success(int statement_id, bool has_results, int created, int updated, int deleted) =| next_result(int statement_id, Vector<String> row) =| |