1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19: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

@ -25,8 +25,8 @@ public:
static SQL::ResultOr<NonnullRefPtr<SQLStatement>> create(DatabaseConnection&, StringView sql);
~SQLStatement() override = default;
static RefPtr<SQLStatement> statement_for(int statement_id);
int statement_id() const { return m_statement_id; }
static RefPtr<SQLStatement> statement_for(u64 statement_id);
u64 statement_id() const { return m_statement_id; }
DatabaseConnection* connection() { return dynamic_cast<DatabaseConnection*>(parent()); }
void execute(Vector<SQL::Value> placeholder_values);
@ -37,7 +37,7 @@ private:
void next();
void report_error(SQL::Result);
int m_statement_id;
u64 m_statement_id { 0 };
size_t m_index { 0 };
NonnullRefPtr<SQL::AST::Statement> m_statement;
Optional<SQL::ResultSet> m_result {};