From efcea3a80da7c4479d5fe168435ecc9fd06bdc72 Mon Sep 17 00:00:00 2001
From: John Turner <jturner.usa@gmail.com>
Date: Sun, 14 Sep 2025 00:16:10 -0400
Subject: Squashed 'subprojects/boost-sqlite/' content from commit 3378e35

git-subtree-dir: subprojects/boost-sqlite
git-subtree-split: 3378e353705271e569cf4ba15c467b840a39798c
---
 doc/reference/static_resultset.adoc | 98 +++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)
 create mode 100644 doc/reference/static_resultset.adoc

(limited to 'doc/reference/static_resultset.adoc')

diff --git a/doc/reference/static_resultset.adoc b/doc/reference/static_resultset.adoc
new file mode 100644
index 0000000..0e15e25
--- /dev/null
+++ b/doc/reference/static_resultset.adoc
@@ -0,0 +1,98 @@
+== `sqlite/static_resultset.hpp`
+
+A `static_resultset` represents the results of a query matched to a C++ type
+
+[source,cpp]
+----
+// Representation of a result from a query.
+
+struct resultset
+{
+
+template<typename T, bool Strict >
+struct static_resultset
+{
+  // Returns the current row.
+  T current() const &;
+
+  // Returns the current row.
+  T current(system::error_code & ec, error_info & ei) const &;
+  // Checks if the last row has been reached.
+  bool done() const {return result_.done();}
+
+  // Read the next row. Returns false if there's nothing more to read.
+  bool read_next(system::error_code & ec, error_info & ei);
+  bool read_next();
+
+
+  // The number of columes in the resultset
+  std::size_t column_count() const;
+  // Returns the name of the column idx.
+  string_view column_name(std::size_t idx) const;
+
+  // Returns the name of the source table for column idx.
+  string_view table_name(std::size_t idx) const;
+  // Returns the origin name of the column for column idx.
+  string_view column_origin_name(std::size_t idx) const;
+
+  static_resultset() = default;
+  static_resultset(resultset && result)
+
+  static_resultset(static_resultset<T, false> && rhs);
+
+  /// The input iterator can be used to read every row in a for-loop
+  struct iterator
+  {
+    using value_type = T;
+    using difference_type   = int;
+    using reference         = T&;
+    using iterator_category = std::forward_iterator_tag;
+
+    iterator();
+    explicit iterator(resultset::iterator itr);
+    bool operator!=(iterator rhs) const;
+
+    value_type &operator*();
+    value_type *operator->();
+
+    iterator& operator++();
+    iterator operator++(int);
+  };
+
+  /// Return an input iterator to the currently unread row
+  iterator begin();
+  /// Sentinel iterator.
+  iterator   end();
+
+  // Convert the static_result to a strict version
+  static_resultset<T, true> strict() &&
+  {
+    return {std::move(result_)};
+  }
+};
+----
+
+
+T:: The static type of the query. This must be a tuple or pfr compatible (for C++20) or described.
+Strict:: Disables implicit conversions.
+
+
+.Example
+[source,cpp]
+----
+extern sqlite::connection conn;
+struct user { std::string first_name; std::string last_name; };
+BOOST_DESCRIBE_STRUCT(user, (), (first_name, last_name));
+
+sqlite::resultset rs = conn.query("select first_name, last_name from users;");
+
+do
+{
+user usr = r.current();
+handle_row(u);
+}
+while (rs.read_next()) // read it line by line
+
+----
+
+
-- 
cgit v1.2.3

