diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-12-02 17:14:56 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-07 13:09:00 +0100 |
commit | aec75d749a09ed2c4974cc26a0c1fa695ac49ed5 (patch) | |
tree | 50f6f6ba5625b4d03f1356e4b4e691352806ddcd /Userland/Services/SQLServer/SQLStatement.h | |
parent | e2f71d280817408e93fc79c652e2de29cdc82660 (diff) | |
download | serenity-aec75d749a09ed2c4974cc26a0c1fa695ac49ed5.zip |
LibSQL+SQLServer+SQLStudio+sql: Allocate per-statement-execution IDs
In order to execute a prepared statement multiple times, and track each
execution's results, clients will need to be provided an execution ID.
This will create a monotonically increasing ID each time a prepared
statement is executed for this purpose.
Diffstat (limited to 'Userland/Services/SQLServer/SQLStatement.h')
-rw-r--r-- | Userland/Services/SQLServer/SQLStatement.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Userland/Services/SQLServer/SQLStatement.h b/Userland/Services/SQLServer/SQLStatement.h index 19e97d0718..7bdf95c910 100644 --- a/Userland/Services/SQLServer/SQLStatement.h +++ b/Userland/Services/SQLServer/SQLStatement.h @@ -28,17 +28,21 @@ public: 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); + Optional<u64> execute(Vector<SQL::Value> placeholder_values); private: SQLStatement(DatabaseConnection&, NonnullRefPtr<SQL::AST::Statement> statement); bool should_send_result_rows() const; - void next(); - void report_error(SQL::Result); + void next(u64 execution_id); + void report_error(SQL::Result, u64 execution_id); u64 m_statement_id { 0 }; size_t m_index { 0 }; + + HashTable<u64> m_ongoing_executions; + u64 m_next_execution_id { 0 }; + NonnullRefPtr<SQL::AST::Statement> m_statement; Optional<SQL::ResultSet> m_result {}; }; |