summaryrefslogtreecommitdiff
path: root/doc/reference/static_resultset.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/reference/static_resultset.adoc')
-rw-r--r--doc/reference/static_resultset.adoc98
1 files changed, 0 insertions, 98 deletions
diff --git a/doc/reference/static_resultset.adoc b/doc/reference/static_resultset.adoc
deleted file mode 100644
index 0e15e25..0000000
--- a/doc/reference/static_resultset.adoc
+++ /dev/null
@@ -1,98 +0,0 @@
-== `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
-
-----
-
-