/* * Copyright (c) 2021, Jan de Visser * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace SQL { class SQLClient : public IPC::ServerConnection , public SQLClientEndpoint { C_OBJECT(SQLClient); virtual ~SQLClient(); Function on_connected; Function on_disconnected; Function on_connection_error; Function on_execution_error; Function on_execution_success; Function const&)> on_next_result; Function on_results_exhausted; private: SQLClient() : IPC::ServerConnection(*this, "/tmp/portal/sql") { } virtual void connected(int connection_id) override; virtual void connection_error(int connection_id, int code, String const& message) override; virtual void execution_success(int statement_id, bool has_results, int created, int updated, int deleted) override; virtual void next_result(int statement_id, Vector const&) override; virtual void results_exhausted(int statement_id, int total_rows) override; virtual void execution_error(int statement_id, int code, String const& message) override; virtual void disconnected(int connection_id) override; }; }