mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:47:45 +00:00
LibSQL+SQLServer+SQLStudio+sql: Give ID types a distinct name
Makes it clearer what is being stored, especially in future clients that will store a bunch of statement IDs.
This commit is contained in:
parent
44ff3a374f
commit
c372012842
9 changed files with 37 additions and 30 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibSQL/AST/AST.h>
|
||||
#include <LibSQL/Result.h>
|
||||
#include <LibSQL/ResultSet.h>
|
||||
#include <LibSQL/Type.h>
|
||||
#include <SQLServer/DatabaseConnection.h>
|
||||
#include <SQLServer/Forward.h>
|
||||
|
||||
|
@ -25,22 +26,22 @@ public:
|
|||
static SQL::ResultOr<NonnullRefPtr<SQLStatement>> create(DatabaseConnection&, StringView sql);
|
||||
~SQLStatement() override = default;
|
||||
|
||||
static RefPtr<SQLStatement> statement_for(u64 statement_id);
|
||||
u64 statement_id() const { return m_statement_id; }
|
||||
static RefPtr<SQLStatement> statement_for(SQL::StatementID statement_id);
|
||||
SQL::StatementID statement_id() const { return m_statement_id; }
|
||||
DatabaseConnection* connection() { return dynamic_cast<DatabaseConnection*>(parent()); }
|
||||
Optional<u64> execute(Vector<SQL::Value> placeholder_values);
|
||||
Optional<SQL::ExecutionID> execute(Vector<SQL::Value> placeholder_values);
|
||||
|
||||
private:
|
||||
SQLStatement(DatabaseConnection&, NonnullRefPtr<SQL::AST::Statement> statement);
|
||||
|
||||
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);
|
||||
void next(SQL::ExecutionID execution_id, SQL::ResultSet result, size_t result_size);
|
||||
void report_error(SQL::Result, SQL::ExecutionID execution_id);
|
||||
|
||||
u64 m_statement_id { 0 };
|
||||
SQL::StatementID m_statement_id { 0 };
|
||||
|
||||
HashTable<u64> m_ongoing_executions;
|
||||
u64 m_next_execution_id { 0 };
|
||||
HashTable<SQL::ExecutionID> m_ongoing_executions;
|
||||
SQL::ExecutionID m_next_execution_id { 0 };
|
||||
|
||||
NonnullRefPtr<SQL::AST::Statement> m_statement;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue