32#ifndef GUARD_SQLITE_QUERY_HPP_INCLUDED
33#define GUARD_SQLITE_QUERY_HPP_INCLUDED
40#include <unordered_map>
77 std::unordered_map<std::string, int>
lookup;
88 return res_ !=
nullptr;
93 throw std::runtime_error(
"row_view is not bound to a row");
98 template <
typename T> T
get(std::string_view name)
const {
102 template <
typename T> T
get(
int idx)
const {
106 template <
typename T> T
operator[](std::string_view name)
const {
174 template <
typename... Args,
typename = std::enable_if_t<(
sizeof...(Args) > 0)>>
176 ((void)(*
this % std::forward<Args>(args)), ...);
pointer operator->() const
std::input_iterator_tag iterator_category
std::shared_ptr< column_cache > cache_
std::ptrdiff_t difference_type
reference operator*() const
bool operator!=(iterator const &other) const
iterator(result_type res, std::shared_ptr< column_cache > cache, bool end)
bool operator==(iterator const &other) const
int column(std::string_view name) const
T get(std::string_view name) const
bool valid() const noexcept
T operator[](std::string_view name) const
row_view(result *res, std::shared_ptr< column_cache > cache)
std::shared_ptr< column_cache > cache_
std::shared_ptr< column_cache > cache_
result_range(result_type res)
Parameter binding helpers and the sqlite::command base class for executing statements.
std::shared_ptr< result > result_type
Shared-pointer alias used by legacy APIs that transfer result ownership.
Row-oriented cursor and typed accessors returned by sqlite::query.
command(connection &con, std::string const &sql)
command constructor
connection is used to open, close, attach and detach a database. Further it has to be passed to all c...
std::vector< std::string > names
int index_of(std::string_view name) const
std::unordered_map< std::string, int > lookup
query should be used to execute SQL queries An object of this class is not copyable
result_range each(Args &&...args)
Binds any supplied parameters and returns a range view.
query(connection &con, std::string const &sql)
constructor
result_range each()
Returns a range view for range-based for loops.
VSQLITE_DEPRECATED result_type emit_result()
executes the sql command (deprecated, prefer each())
virtual ~query()
destructor
result_type get_result()
returns the results (needs a previous step_once() call)
T get(int idx)
Extracts the column at idx into an arbitrary C++ type.