1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:37:34 +00:00

LibSQL+SQLServer+SQLStudio+sql: Give ID types a distinct name

Makes it clearer what is being stored, especially in future clients that
will store a bunch of statement IDs.
This commit is contained in:
Timothy Flynn 2022-12-07 13:01:55 -05:00 committed by Andreas Kling
parent 44ff3a374f
commit c372012842
9 changed files with 37 additions and 30 deletions

View file

@ -10,6 +10,7 @@
#include <LibCore/Object.h>
#include <LibSQL/Database.h>
#include <LibSQL/Result.h>
#include <LibSQL/Type.h>
#include <SQLServer/Forward.h>
namespace SQLServer {
@ -21,19 +22,19 @@ public:
static ErrorOr<NonnullRefPtr<DatabaseConnection>> create(StringView database_path, DeprecatedString database_name, int client_id);
~DatabaseConnection() override = default;
static RefPtr<DatabaseConnection> connection_for(u64 connection_id);
u64 connection_id() const { return m_connection_id; }
static RefPtr<DatabaseConnection> connection_for(SQL::ConnectionID connection_id);
SQL::ConnectionID connection_id() const { return m_connection_id; }
int client_id() const { return m_client_id; }
NonnullRefPtr<SQL::Database> database() { return m_database; }
void disconnect();
SQL::ResultOr<u64> prepare_statement(StringView sql);
SQL::ResultOr<SQL::StatementID> prepare_statement(StringView sql);
private:
DatabaseConnection(NonnullRefPtr<SQL::Database> database, DeprecatedString database_name, int client_id);
NonnullRefPtr<SQL::Database> m_database;
DeprecatedString m_database_name;
u64 m_connection_id { 0 };
SQL::ConnectionID m_connection_id { 0 };
int m_client_id { 0 };
};