boost_sqlite 1
A sqlite C++ library
|
Classes | |
struct | boost::sqlite::blob |
An object that owns a binary large object. More... | |
struct | boost::sqlite::blob_handle |
an object that holds a binary large object. Can be obtained by using blob_handle. More... | |
struct | boost::sqlite::blob_view |
a view to a binary large object More... | |
struct | boost::sqlite::connection |
main object for a connection to a database. More... | |
struct | boost::sqlite::context< Args > |
A context that can be passed into scalar functions. More... | |
struct | boost::sqlite::vtab::cursor< ColumnType > |
Cursor needs the following member. More... | |
struct | boost::sqlite::vtab::cursor< void > |
Cursor needs the following member. More... | |
struct | boost::sqlite::error |
An error containing both a code & optional message. More... | |
struct | boost::sqlite::error_info |
Additional information about error conditions stored in an sqlite-allocate string. More... | |
struct | boost::sqlite::field |
A holder for a sqlite field, i.e. something returned from a query. More... | |
struct | boost::sqlite::vtab::in |
Utility function that can be used in xFilter for the in operator. More... | |
struct | boost::sqlite::vtab::index_info |
struct | boost::sqlite::memory_tag |
struct | boost::sqlite::vtab::modifiable |
Group of functions for modifications. More... | |
struct | boost::sqlite::param_ref |
A reference to a value to temporary bind for an execute statement. Most values are captures by reference. More... | |
struct | boost::sqlite::vtab::recursive_transaction |
Support for recursive transactions. More... | |
struct | boost::sqlite::vtab::renamable |
Make the vtable renamable. More... | |
struct | boost::sqlite::resultset |
Representation of a result from a database. More... | |
struct | boost::sqlite::row |
Representation of a row in a database. More... | |
struct | boost::sqlite::savepoint |
A simple transaction guard implementing RAAI for savepoints. Savepoints can be used recursively. More... | |
struct | boost::sqlite::statement |
A statement used for a prepared-statement. More... | |
struct | boost::sqlite::static_resultset< T > |
A typed resultset using a tuple or a described struct. More... | |
struct | boost::sqlite::transaction |
A simple transaction guard implementing RAAI for transactions. More... | |
struct | boost::sqlite::vtab::transaction |
Group of functions to support transactions. More... | |
struct | boost::sqlite::value |
A holder for a sqlite values used for internal APIs. More... | |
Macros | |
#define | BOOST_SQLITE_EXTENSION(Name, Conn) |
Declare a sqlite module. | |
Enumerations | |
enum class | boost::sqlite::value_type |
The type of a value. More... | |
enum class | boost::sqlite::zero_blob : sqlite3_uint64 |
Helper type to pass a blob full of zeroes without allocating extra memory. | |
Functions | |
template<typename Func > | |
bool | boost::sqlite::commit_hook (connection &conn, Func &&func) |
Install a commit hook. | |
template<typename T > | |
auto | boost::sqlite::create_module (connection &conn, cstring_ref name, T &&module, system::error_code &ec, error_info &ei) -> typename std::decay< T >::type & |
Register a vtable. | |
template<typename Func > | |
bool | boost::sqlite::preupdate_hook (connection &conn, Func &&func) |
template<typename Func > | |
bool | boost::sqlite::rollback_hook (connection &conn, Func &&func) |
Install a rollback hook. | |
template<typename Func > | |
bool | boost::sqlite::update_hook (connection &conn, Func &&func) |
Install an update hook. | |
void | boost::sqlite::backup (connection &source, connection &target, cstring_ref source_name, cstring_ref target_name, system::error_code &ec, error_info &ei) |
Backup a database. | |
void | boost::sqlite::backup (connection &source, connection &target, cstring_ref source_name="main", cstring_ref target_name="main") |
Backup a database. | |
template<typename Func > | |
void | boost::sqlite::create_collation (connection &conn, cstring_ref name, Func &&func, typename std::enable_if< std::is_convertible< decltype(func(string_view(), string_view())), int >::value, system::error_code >::type &ec) |
template<typename Func > | |
auto | boost::sqlite::create_collation (connection &conn, cstring_ref name, Func &&func) |
template<typename Func > | |
auto | boost::sqlite::create_scalar_function (connection &conn, cstring_ref name, Func &&func, system::error_code &ec) |
create a scalar function | |
template<typename Func > | |
auto | boost::sqlite::create_scalar_function (connection &conn, cstring_ref name, Func &&func) -> typename std::enable_if< std::is_same< decltype(detail::create_scalar_function(static_cast< sqlite3 * >(nullptr), name, std::declval< Func >())), int >::value >::type |
create a scalar function | |
template<typename Func > | |
void | boost::sqlite::create_aggregate_function (connection &conn, cstring_ref name, Func &&func, system::error_code &ec, error_info &ei) |
create a aggregate function | |
template<typename Func > | |
void | boost::sqlite::create_aggregate_function (connection &conn, cstring_ref name, Func &&func) |
create a aggregate function | |
template<typename Func > | |
void | boost::sqlite::create_window_function (connection &conn, cstring_ref name, Func &&func, system::error_code &ec) |
create a aggregate window function | |
template<typename Func > | |
void | boost::sqlite::create_window_function (connection &conn, cstring_ref name, Func &&func) |
create a aggregate window function | |
bool | boost::sqlite::is_json (const value &v) |
Check if the value or field is a json. | |
bool | boost::sqlite::is_json (const field &f) |
Check if the value or field is a json. | |
json::value | boost::sqlite::as_json (const value &v, json::storage_ptr ptr={}) |
Convert the value or field to a json. | |
json::value | boost::sqlite::as_json (const field &f, json::storage_ptr ptr={}) |
Convert the value or field to a json. | |
This page contains the documentation of the sqlite high-level API.
struct boost::sqlite::memory_tag |
A tag to allow operator new
Definition at line 15 of file memory.hpp.
#define BOOST_SQLITE_EXTENSION | ( | Name, | |
Conn ) |
Declare a sqlite module.
Name | The name of the module |
Conn | The parameter name of the connection |
This macro can be used to create an sqlite extension.
{.cpp}
Definition at line 47 of file extension.hpp.
|
strong |
void boost::sqlite::backup | ( | connection & | source, |
connection & | target, | ||
cstring_ref | source_name, | ||
cstring_ref | target_name, | ||
system::error_code & | ec, | ||
error_info & | ei ) |
Backup a database.
This function will create a backup of an existing database. This can be useful to write an in memory database to disk et vice versa.
source | The source database to backup |
target | The target of the backup |
source_name | The source database to read the backup from. Default is 'main'. |
target_name | The target database to write the backup to. Default is 'main'. |
system_error | from overload without ec & ei |
or you need to pass
ec | The system::error_code to capture any possibly errors |
ei | Additional error_info when error occurs. |
void boost::sqlite::backup | ( | connection & | source, |
connection & | target, | ||
cstring_ref | source_name = "main", | ||
cstring_ref | target_name = "main" ) |
Backup a database.
This function will create a backup of an existing database. This can be useful to write an in memory database to disk et vice versa.
source | The source database to backup |
target | The target of the backup |
source_name | The source database to read the backup from. Default is 'main'. |
target_name | The target database to write the backup to. Default is 'main'. |
system_error | from overload without ec & ei |
or you need to pass
ec | The system::error_code to capture any possibly errors |
ei | Additional error_info when error occurs. |
bool boost::sqlite::commit_hook | ( | connection & | conn, |
Func && | func ) |
Install a commit hook.
The commit hook gets called before a commit gets performed. If func
returns true, the commit goes, otherwise it gets rolled back.
func
is a nullptr
the hook gets reset.conn | The database connection to install the hook in |
func | The hook function |
void boost::sqlite::create_aggregate_function | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func ) |
create a aggregate function
conn | The connection to add the function to. |
name | The name of the function |
func | The function to be added |
ec | The system::error_code |
`system::system_error` | when the overload without ec is used. |
func
needs to be an object with two functions:
State
can be any type and will get deduced together with N
. An aggregrate function will create a new State
for a new aggregate
and call step
for every step. When the aggregation is done final
is called and the result is returned to sqlite.
Definition at line 299 of file function.hpp.
void boost::sqlite::create_aggregate_function | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func, | ||
system::error_code & | ec, | ||
error_info & | ei ) |
create a aggregate function
conn | The connection to add the function to. |
name | The name of the function |
func | The function to be added |
ec | The system::error_code |
`system::system_error` | when the overload without ec is used. |
func
needs to be an object with two functions:
State
can be any type and will get deduced together with N
. An aggregrate function will create a new State
for a new aggregate
and call step
for every step. When the aggregation is done final
is called and the result is returned to sqlite.
Definition at line 279 of file function.hpp.
auto boost::sqlite::create_collation | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func ) |
Define a custom collation function
conn | A connection to the database in which to install the collation. |
name | The name of the collation. |
func | The function |
The function must be callable with two string_view
and return an int, indicating the comparison results.
Definition at line 88 of file collation.hpp.
void boost::sqlite::create_collation | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func, | ||
typename std::enable_if< std::is_convertible< decltype(func(string_view(), string_view())), int >::value, system::error_code >::type & | ec ) |
Define a custom collation function
conn | A connection to the database in which to install the collation. |
name | The name of the collation. |
func | The function |
The function must be callable with two string_view
and return an int, indicating the comparison results.
Definition at line 49 of file collation.hpp.
auto boost::sqlite::create_module | ( | connection & | conn, |
cstring_ref | name, | ||
T && | module, | ||
system::error_code & | ec, | ||
error_info & | ei ) -> typename std::decay<T>::type & |
Register a vtable.
conn | The connection to install the vtable into |
name | The name for the vtable |
module | The module to install as a vtable. See vtab_module_prototype for the structure required |
ec | The system::error_code used to deliver errors for the exception less overload. |
info | The error_info used to deliver errors for the exception less overload. |
The | requirements for module . |
T | The implementation type of the module. It must inherit |
Definition at line 566 of file vtable.hpp.
auto boost::sqlite::create_scalar_function | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func ) -> typename std::enable_if< std::is_same< decltype( detail::create_scalar_function( static_cast<sqlite3*>(nullptr), name, std::declval<Func>()) ), int>::value>::type |
create a scalar function
conn | The connection to add the function to. |
name | The name of the function |
func | The function to be added |
ec | The system::error_code |
`system::system_error` | when the overload without ec is used. |
func
must take context<Args...>
as the first and a span<value, N>
as the second value. If N
is not dynamic_extent
it will be used to deduce the number of arguments for the function.
Definition at line 209 of file function.hpp.
auto boost::sqlite::create_scalar_function | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func, | ||
system::error_code & | ec ) |
create a scalar function
conn | The connection to add the function to. |
name | The name of the function |
func | The function to be added |
ec | The system::error_code |
`system::system_error` | when the overload without ec is used. |
func
must take context<Args...>
as the first and a span<value, N>
as the second value. If N
is not dynamic_extent
it will be used to deduce the number of arguments for the function.
Definition at line 154 of file function.hpp.
void boost::sqlite::create_window_function | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func ) |
create a aggregate window function
conn | The connection to add the function to. |
name | The name of the function |
func | The function to be added |
ec | The system::error_code |
`system::system_error` | when the overload without ec is used. |
func
needs to be an object with three functions:
State
can be any type and will get deduced together with N
. An aggregrate function will create a new State
for a new aggregate
and call step
for every step. When an element is removed from the window inverse
is called. When the aggregation is done final
is called and the result is returned to sqlite.
Definition at line 382 of file function.hpp.
void boost::sqlite::create_window_function | ( | connection & | conn, |
cstring_ref | name, | ||
Func && | func, | ||
system::error_code & | ec ) |
create a aggregate window function
conn | The connection to add the function to. |
name | The name of the function |
func | The function to be added |
ec | The system::error_code |
`system::system_error` | when the overload without ec is used. |
func
needs to be an object with three functions:
State
can be any type and will get deduced together with N
. An aggregrate function will create a new State
for a new aggregate
and call step
for every step. When an element is removed from the window inverse
is called. When the aggregation is done final
is called and the result is returned to sqlite.
Definition at line 367 of file function.hpp.
bool boost::sqlite::preupdate_hook | ( | connection & | conn, |
Func && | func ) |
A hook for pre-update events.
SQLITE_ENABLE_PREUPDATE_HOOK
enabled.The function will get called
func
is a nullptr
the hook gets reset.conn | The database connection to install the hook in |
func | The hook function |
The signature of the handler is as following (it must noexcept):
bool boost::sqlite::rollback_hook | ( | connection & | conn, |
Func && | func ) |
Install a rollback hook.
The rollback hook gets called when a rollback gets performed.
func
is a nullptr
the hook gets reset.conn | The database connection to install the hook in |
func | The hook function |
bool boost::sqlite::update_hook | ( | connection & | conn, |
Func && | func ) |
Install an update hook.
The update hook gets called when an update was performed.
The signature of the function is void(int op, core::string_view db, core::string_view table, sqlite3_int64 id)
. op
is either SQLITE_INSERT
, SQLITE_DELETE
and SQLITE_UPDATE
.
func
is a nullptr
the hook gets reset.conn | The database connection to install the hook in |
func | The hook function |