aboutsummaryrefslogtreecommitdiff
path: root/frontend/DB.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 14:07:01 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-30 14:07:01 +0100
commit862186ae7cbbd922057fa5f6b49509c36f9ade36 (patch)
tree10193494e1c4bdff793a2daafc2b3359e8794303 /frontend/DB.h
parentb1d5d7936bed17a684daff15b0294ef70754e8b9 (diff)
generate dungeon kinda works
Diffstat (limited to 'frontend/DB.h')
-rw-r--r--frontend/DB.h55
1 files changed, 29 insertions, 26 deletions
diff --git a/frontend/DB.h b/frontend/DB.h
index f6907bc..0164e34 100644
--- a/frontend/DB.h
+++ b/frontend/DB.h
@@ -21,34 +21,37 @@ 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 DBQueryRowRange {
+public:
+ DBQueryRowRange(DBStatement & stmt);
+
+private:
+ class DBQueryRowIterator {
+ public:
+ DBQueryRowIterator(DBQueryRowRange & parent);
+
+ public:
+ DBQueryRow & operator * () const;
+ DBQueryRowIterator & operator ++ ();
+ bool operator != (const DBQueryRowIterator &) const;
+
+ private:
+ bool end = false;
+ DBQueryRowRange & parent;
+ };
+
+public:
+ DBQueryRowIterator begin();
+ DBQueryRowIterator end();
+
+private:
+ DBStatement & parent;
+ DBQueryRow row;
+};
class DBStatement {
friend class DBQueryRow;
+ friend class DBQueryRowRange;
public:
DBStatement(DB &, const std::string & query);
@@ -60,7 +63,7 @@ public:
public:
void execute();
DBQueryRow row();
- // DBQueryRowRange rows();
+ DBQueryRowRange rows();
private:
std::unique_ptr<sqlite3_stmt, std::function<void(sqlite3_stmt*)>> stmt;