From b9e738502260b8f448289c9888203971c7749c76 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Wed, 30 Oct 2024 01:29:58 +0100 Subject: WIP SQL gedoe --- frontend/DB.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'frontend/DB.h') diff --git a/frontend/DB.h b/frontend/DB.h index b464f9f..5c88940 100644 --- a/frontend/DB.h +++ b/frontend/DB.h @@ -4,15 +4,33 @@ #include #include +class DB; + +class DBStatement { + std::unique_ptr> stmt; +public: + DBStatement(DB &, const std::string & query); + +public: + DBStatement & unbind(); + DBStatement & bind(const std::string & text); + DBStatement & bind(const int & number); +public: + void execute(); + +private: + int param_index = 1; + DB & db; +}; + class DB { - typedef std::unique_ptr> unique_sqlite3; - typedef std::unique_ptr> unique_sqlite3_stmt; + friend class DBStatement; public: DB(const std::string & path); - unique_sqlite3_stmt prepare(const std::string & query); + DBStatement prepare(const std::string & query); private: - unique_sqlite3 db = NULL; + std::unique_ptr> db = NULL; }; -- cgit v1.2.3