summaryrefslogtreecommitdiff
path: root/Userland/Services/SQLServer/ClientConnection.h
diff options
context:
space:
mode:
authorJan de Visser <jan@de-visser.net>2021-06-28 21:15:17 -0400
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-08 17:55:59 +0430
commita034774e3aceaf6c04efcf5bb2ba1313a91a17be (patch)
tree9d74ba1f73f783f7fdab1801b75800432a3bdadc /Userland/Services/SQLServer/ClientConnection.h
parent1037d6b0eb453a11d58ab7a821a2fe1c5e82f325 (diff)
downloadserenity-a034774e3aceaf6c04efcf5bb2ba1313a91a17be.zip
LibSQL+SQLServer: Build SQLServer system service
This patch introduces the SQLServer system server. This service is supposed to be the only process/application talking to database storage. This makes things like locking and caching more reliable, easier to implement, and more efficient. In LibSQL we added a client component that does the ugly IPC nitty- gritty for you. All that's needed is setting a number of event handler lambdas and you can connect to databases and execute statements on them. Applications that wish to use this SQLClient class obviously need to link LibSQL and LibIPC.
Diffstat (limited to 'Userland/Services/SQLServer/ClientConnection.h')
-rw-r--r--Userland/Services/SQLServer/ClientConnection.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/Userland/Services/SQLServer/ClientConnection.h b/Userland/Services/SQLServer/ClientConnection.h
new file mode 100644
index 0000000000..96af97fe70
--- /dev/null
+++ b/Userland/Services/SQLServer/ClientConnection.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021, Jan de Visser <jan@de-visser.net>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/HashMap.h>
+#include <LibIPC/ClientConnection.h>
+#include <SQLServer/SQLClientEndpoint.h>
+#include <SQLServer/SQLServerEndpoint.h>
+
+namespace SQLServer {
+
+class ClientConnection final
+ : public IPC::ClientConnection<SQLClientEndpoint, SQLServerEndpoint> {
+ C_OBJECT(ClientConnection);
+
+public:
+ explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id);
+ virtual ~ClientConnection() override;
+
+ virtual void die() override;
+
+ static RefPtr<ClientConnection> client_connection_for(int client_id);
+
+private:
+ virtual Messages::SQLServer::ConnectResponse connect(String const&) override;
+ virtual Messages::SQLServer::SqlStatementResponse sql_statement(int, String const&) override;
+ virtual void statement_execute(int) override;
+ virtual void disconnect(int) override;
+};
+
+}