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

LibSQL+SQLServer+SQLStudio+sql: Use proper types for SQL IPC and IDs

When storing IDs and sending values over IPC, this changes SQLServer to:

1. Stop using -1 as a nominal "bad" ID. Store the IDs as unsigned, and
   use Optional in the one place that the IPC needs to indicate an ID
   was not allocated.

2. Let LibIPC encode/decode enumerations (SQLErrorCode) on our behalf.

3. Use size_t for array sizes.
This commit is contained in:
Timothy Flynn 2022-12-02 16:25:27 -05:00 committed by Andreas Kling
parent 3a915483b0
commit e2f71d2808
13 changed files with 85 additions and 84 deletions

View file

@ -19,20 +19,20 @@ class DatabaseConnection final : public Core::Object {
public:
~DatabaseConnection() override = default;
static RefPtr<DatabaseConnection> connection_for(int connection_id);
int connection_id() const { return m_connection_id; }
static RefPtr<DatabaseConnection> connection_for(u64 connection_id);
u64 connection_id() const { return m_connection_id; }
int client_id() const { return m_client_id; }
RefPtr<SQL::Database> database() { return m_database; }
void disconnect();
SQL::ResultOr<int> prepare_statement(StringView sql);
SQL::ResultOr<u64> prepare_statement(StringView sql);
private:
DatabaseConnection(DeprecatedString database_name, int client_id);
RefPtr<SQL::Database> m_database { nullptr };
DeprecatedString m_database_name;
int m_connection_id;
int m_client_id;
u64 m_connection_id { 0 };
int m_client_id { 0 };
bool m_accept_statements { false };
};