aboutsummaryrefslogtreecommitdiff
path: root/frontend/DB.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 02:45:56 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 02:45:56 +0100
commit991c9aac53fa3562b0fdc03d74b398052b207d2c (patch)
treedaf1d16ecac1de62093d9019e2b9b355f12d81f6 /frontend/DB.h
parentb9e738502260b8f448289c9888203971c7749c76 (diff)
load objects kinda working, going to bed
Diffstat (limited to 'frontend/DB.h')
-rw-r--r--frontend/DB.h47
1 files changed, 45 insertions, 2 deletions
diff --git a/frontend/DB.h b/frontend/DB.h
index 5c88940..77b3f7a 100644
--- a/frontend/DB.h
+++ b/frontend/DB.h
@@ -5,9 +5,49 @@
#include <sqlite3.h>
class DB;
+class DBStatement;
+
+class DBQueryRow {
+public:
+ DBQueryRow(DBStatement &);
+
+public:
+ template <typename T>
+ T col(int index);
+
+private:
+ DBStatement & parent;
+};
+
+// class DBQueryRowRange {
+// public:
+// DBQueryRowRange();
+//
+// private:
+// class DBQueryRowIterator {
+// public:
+// DBQueryRowIterator(DBQueryRow & row);
+//
+// public:
+// DBQueryRow & operator * () const;
+// DBQueryRowIterator & operator ++ ();
+// bool operator != (const DBQueryRowIterator &) const;
+//
+// private:
+// DBQueryRow & row;
+// };
+//
+// public:
+// DBQueryRowIterator begin() const;
+// DBQueryRowIterator end() const;
+//
+// private:
+// DBQueryRow row;
+// };
class DBStatement {
- std::unique_ptr<sqlite3_stmt, std::function<void(sqlite3_stmt*)>> stmt;
+ friend class DBQueryRow;
+
public:
DBStatement(DB &, const std::string & query);
@@ -17,10 +57,13 @@ public:
DBStatement & bind(const int & number);
public:
void execute();
+ DBQueryRow row();
+ // DBQueryRowRange rows();
private:
+ std::unique_ptr<sqlite3_stmt, std::function<void(sqlite3_stmt*)>> stmt;
int param_index = 1;
- DB & db;
+ DB & parent;
};
class DB {