|
ThinSQLite++
A thin, safe and convenient modern C++ wrapper for the SQLite API.
|
Base class for virtual table object implementations. More...
Classes | |
| class | cursor |
| Base class for cursors. More... | |
| struct | create_t |
Marker type that marks the constructor of Derived to be used to create a new table. More... | |
| struct | connect_t |
Marker type that tells the constructor of Derived to be used to connect to an existing table. More... | |
Public Types | |
| using | constructor_data_type = void |
| Type of data passed via create_module to the constructor(s). | |
| using | index_data_type = void |
| Type of data stored in index_info and passed between best_index and filter. | |
Public Member Functions | |
| template<class D = Derived> | |
| SQLITEPP_ENABLE_IFP (static,(std::is_pointer_v< typename D::constructor_data_type >), void) create_module(database &db | |
| Register a virtual table implementation with a database connection. | |
Static Public Member Functions | |
| static void | create_module (database &db, const string_param &name) |
| Register a virtual table implementation with a database connection. | |
Public Attributes | |
| const string_param & | name |
| const string_param D::constructor_data_type | data |
| const string_param D::constructor_data_type void(* | destructor )(typename D::constructor_data_type) noexcept |
Protected Member Functions | |
| vtab () | |
| This class is default constructible only by derived classes. | |
| vtab (const vtab &)=delete | |
| You cannot copy (or move) this class. | |
| vtab & | operator= (const vtab &)=delete |
| You cannot assign this class. | |
| ~vtab () | |
| This class is destructible only by derived classes. | |
Base class for virtual table object implementations.
This class greatly simplifies development of virtual tables by encapsulating management of sqlite3_module, providing type safety, error handling and RAII and reasonable defaults.
It is intended to be used as CRTP base class for your own virtual table implementations.
#include <thinsqlitepp/vtab.hpp>
| struct thinsqlitepp::vtab::create_t |
Marker type that marks the constructor of Derived to be used to create a new table.
| struct thinsqlitepp::vtab::connect_t |
Marker type that tells the constructor of Derived to be used to connect to an existing table.
| using constructor_data_type = void |
Type of data passed via create_module to the constructor(s).
You can override this default by declaring a different typedef in your derived class
The default is void, meaning no data is stored and passed
| using index_data_type = void |
Type of data stored in index_info and passed between best_index and filter.
You can override this default by declaring a different typedef in your derived class.
The default is void, meaning no data is stored and passed
|
inlinestatic |
Register a virtual table implementation with a database connection.
Equivalent to sqlite3_create_module_v2
If constructor_data_type is not void using this method causes nullptr to be passed to derived class constructor.
| db | database to register the implementation with |
| name | module name |
| SQLITEPP_ENABLE_IFP | ( | static | , |
| (std::is_pointer_v< typename D::constructor_data_type >) | , | ||
| void | ) & |
Register a virtual table implementation with a database connection.
Equivalent to sqlite3_create_module_v2
This overload is available if constructor_data_type is not void.
| D | Defers resolution of nested data types declared in derived class. This is an internal implementation detail - never specify it explicitly. |
| db | database to register the implementation with |
| name | module name |
| data | data to be passed to your derived class constructor. Can be nullptr. You can change the type of the data by re-defining constructor_data_type in your derived class. |
| destructor | an optional destructor function for the data pointer. Can be nullptr. |