1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

SQLServer: Parse SQL a single time to actually "prepare" the statement

One of the benefits of prepared statements is that the SQL string is
parsed just once and re-used. This updates SQLStatement to do just that
and store the parsed result.
This commit is contained in:
Timothy Flynn 2022-12-02 08:04:05 -05:00 committed by Andreas Kling
parent 83bb25611e
commit b13527b8b2
5 changed files with 40 additions and 39 deletions

View file

@ -8,6 +8,7 @@
#include <LibCore/Object.h>
#include <LibSQL/Database.h>
#include <LibSQL/Result.h>
#include <SQLServer/Forward.h>
namespace SQLServer {
@ -23,7 +24,7 @@ public:
int client_id() const { return m_client_id; }
RefPtr<SQL::Database> database() { return m_database; }
void disconnect();
int prepare_statement(DeprecatedString const& sql);
SQL::ResultOr<int> prepare_statement(StringView sql);
private:
DatabaseConnection(DeprecatedString database_name, int client_id);