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

SQLServer: Do not store statement execution results at the class level

If a statement is executed multiple times in quick succession, we may
overwrite the results of a previous execution. Instead of storing the
result, pass it around as it is sent to the client.
This commit is contained in:
Timothy Flynn 2022-12-03 11:22:39 -05:00 committed by Andreas Kling
parent f9d23e1d2f
commit 27ce88864f
2 changed files with 19 additions and 25 deletions

View file

@ -33,18 +33,16 @@ public:
private:
SQLStatement(DatabaseConnection&, NonnullRefPtr<SQL::AST::Statement> statement);
bool should_send_result_rows() const;
void next(u64 execution_id);
bool should_send_result_rows(SQL::ResultSet const& result) const;
void next(u64 execution_id, SQL::ResultSet result, size_t result_size);
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 {};
};
}