/* * Copyright (c) 2021, Jan de Visser * Copyright (c) 2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace SQL { class SQLClient : public IPC::ConnectionToServer , public SQLClientEndpoint { IPC_CLIENT_CONNECTION(SQLClient, "/tmp/session/%sid/portal/sql"sv) public: #if !defined(AK_OS_SERENITY) static ErrorOr> launch_server_and_create_client(StringView server_path); #endif virtual ~SQLClient() = default; Function on_execution_error; Function on_execution_success; Function)> on_next_result; Function on_results_exhausted; private: explicit SQLClient(NonnullOwnPtr socket) : IPC::ConnectionToServer(*this, move(socket)) { } virtual void execution_success(u64 statement_id, u64 execution_id, bool has_results, size_t created, size_t updated, size_t deleted) override; virtual void next_result(u64 statement_id, u64 execution_id, Vector const&) override; virtual void results_exhausted(u64 statement_id, u64 execution_id, size_t total_rows) override; virtual void execution_error(u64 statement_id, u64 execution_id, SQLErrorCode const& code, DeprecatedString const& message) override; }; }