ThinSQLite++
A thin, safe and convenient modern C++ wrapper for SQLite API.
|
Base class for cursors. More...
Public Member Functions | |
cursor (cursor &)=delete | |
cursor & | operator= (cursor &)=delete |
sqlite3_vtab_cursor * | c_ptr () const noexcept |
Access the underlying sqlite3_vtab_cursor struct. | |
template<class D = Derived> | |
void | filter (int idx, typename D::index_data_type idx_data, int argc, value **argv) |
Begins a search of a virtual table. | |
template<class D = Derived> | |
void | filter (int idx, int argc, value **argv) |
Begins a search of a virtual table. | |
bool | eof () const noexcept |
Whether the cursor reached the end. | |
void | next () |
Advances the cursor. | |
void | column (context &ctxt, int idx) const |
Retrieves the value of the virtual table column in a row cursor is currently pointing at. | |
sqlite_int64 | rowid () const |
Retrieves the rowid of the row cursor is currently pointing at. | |
Protected Member Functions | |
cursor (Derived *owner) | |
Constructs an instance with a given owner. | |
Derived * | owner () const noexcept |
Returns the owning vtab - derived class. | |
Base class for cursors.
It wraps sqlite3_vtab_cursor and provides default implementation of the required methods. The default implementation returns no rows. Re-define various methods in your derived classes.
|
inline |
Begins a search of a virtual table.
Equivalent to xFilter
This method is called if index_data_type is defined as a pointer.
Re-define this method as a non-templated function in your derived class. Your implementation can throw exceptions to indicate errors.
This method can be called multiple times and should initialize cursor internals to start cursor iteration anew (do not rely on constructor to do that).
The default implementation does nothing.
D | Defers resolution of nested data types declared in derived class. This is an internal implementation detail - your re-defined implementations do not need to be templated. |
idx | value passed to index_info::set_index_number in best_index. Its significance is entirely up to you |
idx_data | pointer passed to index_info::set_index_data. Its significance is entirely up to you |
argc | count of items in argv array |
argv | requested values of certain expressions from index_info::constraint_usage |
|
inline |
Begins a search of a virtual table.
Equivalent to xFilter
This method is called if index_data_type is void.
Re-define this method as a non-templated function in your derived class. Your implementation can throw exceptions to indicate errors.
This method can be called multiple times and should initialize cursor internals to start cursor iteration anew (do not rely on constructor to do that).
The default implementation does nothing.
D | Defers resolution of nested data types declared in derived class. This is an internal implementation detail - your re-defined implementations do not need to be templated. |
idx | value passed to index_info::set_index_number in best_index. Its significance is entirely up to you |
argc | count of items in argv array |
argv | requested values of certain expressions from index_info::constraint_usage |
|
inlinenoexcept |
|
inline |
|
inline |
Retrieves the value of the virtual table column in a row cursor is currently pointing at.
Equivalent to xColumn
Re-define this method in your derived class. Your implementation can throw exceptions to indicate errors.
This default implementation always return null
ctxt | the context to set the column value on |
idx | column index |
|
inline |
Retrieves the rowid of the row cursor is currently pointing at.
Equivalent to xRowid
Re-define this method in your derived class. Your implementation can throw exceptions to indicate errors.
This default implementation always reports an error
|
inlineprotectednoexcept |
Returns the owning vtab - derived class.
Equivalent to accessing the pVtab
field of sqlite3_vtab_cursor