mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 23:45:08 +00:00

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.
35 lines
955 B
C++
35 lines
955 B
C++
/*
|
|
* 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;
|
|
};
|
|
|
|
}
|