diff options
Diffstat (limited to 'doc/reference/resultset.adoc')
-rw-r--r-- | doc/reference/resultset.adoc | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/doc/reference/resultset.adoc b/doc/reference/resultset.adoc deleted file mode 100644 index fb793a5..0000000 --- a/doc/reference/resultset.adoc +++ /dev/null @@ -1,72 +0,0 @@ -== `sqlite/resultset.hpp` - -A resultset represents the results of a query. - -[source,cpp] ----- -// Representation of a result from a query. - -struct resultset -{ - // Returns the current row. The row is a pure view type. - row current() const &; - // Checks if the last row has been reached. - bool done() const; - - // Read the next row. Returns false if there's nothing more to read. - // Calling this will change the data of any `row` previously obtained from `current. - bool read_next(system::error_code & ec, error_info & ei); - bool read_next(); - - // The number of colums 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; - - // The input iterator can be used to read every row in a for-loop - struct iterator - { - using value_type = value; - using difference_type = int; - using reference = value&; - using iterator_category = std::forward_iterator_tag; - - iterator() {} - - bool operator!=(iterator rhs) const; - row &operator*(); - row *operator->(); - - iterator operator++(); - iterator operator++(int); - }; - - // Return an input iterator to the currently unread row - iterator begin(); - // Sentinel iterator. - iterator end(); -}; ----- - - - - -.Example -[source,cpp] ----- -extern sqlite::connection conn; - -sqlite::resultset rs = conn.query("select * from users;"); - -do -{ - handle_row(r.current()); -} -while (rs.read_next()); // read it line by line ----- - - |