From aec75d749a09ed2c4974cc26a0c1fa695ac49ed5 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 2 Dec 2022 17:14:56 -0500 Subject: 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. --- Userland/Services/SQLServer/SQLStatement.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Userland/Services/SQLServer/SQLStatement.h') 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 statement_for(u64 statement_id); u64 statement_id() const { return m_statement_id; } DatabaseConnection* connection() { return dynamic_cast(parent()); } - void execute(Vector placeholder_values); + Optional execute(Vector placeholder_values); private: SQLStatement(DatabaseConnection&, NonnullRefPtr 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 m_ongoing_executions; + u64 m_next_execution_id { 0 }; + NonnullRefPtr m_statement; Optional m_result {}; }; -- cgit v1.2.3