9#ifndef HEADER_SQLITEPP_DATABASE_IFACE_INCLUDED
10#define HEADER_SQLITEPP_DATABASE_IFACE_INCLUDED
13#include "exception_iface.hpp"
14#include "mutex_iface.hpp"
15#include "blob_iface.hpp"
16#include "snapshot_iface.hpp"
17#include "memory_iface.hpp"
18#include "string_param.hpp"
27 #pragma GCC diagnostic push
28 #pragma GCC diagnostic ignored "-Wcast-function-type"
30 #if defined(__APPLE__) && defined(__clang__) && defined(SQLITE_AVAILABLE)
31 #pragma GCC diagnostic ignored "-Wunguarded-availability-new"
32 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
46 struct database_detector
48 SQLITEPP_CALL_DETECTOR(enable_load_extension,
int, sqlite3_enable_load_extension, (T *)
nullptr,
int{});
49 SQLITEPP_CALL_DETECTOR(load_extension,
int, sqlite3_load_extension, (T *)
nullptr,
50 (
const char *)
nullptr,
51 (
const char *)
nullptr,
54 SQLITEPP_METHOD_DETECTOR(
void, step, (context *)
nullptr,
int{}, (value **)
nullptr);
55 SQLITEPP_METHOD_DETECTOR(
void, last, (context *)
nullptr);
56 SQLITEPP_METHOD_DETECTOR(
void, inverse, (context *)
nullptr,
int{}, (value **)
nullptr);
57 SQLITEPP_METHOD_DETECTOR(
void, current, (context *)
nullptr);
64 static constexpr bool is_aggregate_function = has_noexcept_step<T> && has_noexcept_last<T>;
67 static constexpr bool is_aggregate_window_function = is_aggregate_function<T> && has_noexcept_inverse<T> && has_noexcept_current<T>;
69 template<
class R,
class T,
class... ArgTypes>
73 template<
class R,
class T,
class... ArgTypes>
81 is_function<std::remove_pointer_t<T>> ||
82 is_aggregate_function<std::remove_pointer_t<T>>
110 template<
int Code,
class ...Args>
113 static void apply(
database & db, Args && ...args)
120 template<
int Code>
struct config_mapping;
122 template<
int Code,
class ...Args>
123 struct vtab_config_option
125 static void apply(
database & db, Args && ...args)
132 template<
int Code>
struct vtab_config_mapping;
166 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 36, 1)
196 #if __cpp_char8_t >= 201811
250 #if __cpp_char8_t >= 201811
295 SQLITEPP_ENABLE_IF((database_detector::is_pointer_to_callback<bool, T, int>),
332 SQLITEPP_ENABLE_IF((database_detector::is_pointer_to_callback<void, T, database *, int, const char *>),
365 SQLITEPP_ENABLE_IF((database_detector::is_pointer_to_callback<bool, T>),
399 SQLITEPP_ENABLE_IF((database_detector::is_pointer_to_callback<void, T>),
435 SQLITEPP_ENABLE_IF((database_detector::is_pointer_to_callback<void, T, int, const char *, const char *, int64_t>),
440 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 16, 0) && defined(SQLITE_ENABLE_PREUPDATE_HOOK)
487 SQLITEPP_ENABLE_IF((database_detector::is_pointer_to_callback<void, T, database *, int, const char *, const char *, int64_t, int64_t>),
522 SQLITEPP_ENABLE_IF((database_detector::is_pointer_to_throwing_callback<void, T, database *, const char *, int>),
529 #if defined(SQLITE_ENABLE_PREUPDATE_HOOK)
530 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 16, 0)
593 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 36, 0)
669 int (*compare)(
type_identity_t<T> collator,
int lhs_len,
const void * lhs_bytes,
int rhs_len,
const void * rhs_bytes)
noexcept,
729 void (*last)(
context*)
noexcept,
761 SQLITEPP_ENABLE_IF(database_detector::is_pointer_to_function<T>,
767#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 25, 0)
795 void (*last)(
context*)
noexcept,
796 void (*current)(
context*)
noexcept,
827 SQLITEPP_ENABLE_IF(database_detector::is_pointer_to_window_function<T>,
835#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 10, 0)
863 template<
int Code,
class ...Args>
868 config_mapping<Code>::type::apply(*
this,
std::forward<
decltype(args)>(args)...)
906 T * data,
void(*destructor)(T *) =
nullptr)
935 template<
int Code,
class ...Args>
940 vtab_config_mapping<Code>::type::apply(*
this,
std::forward<
decltype(args)>(args)...)
960#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 30, 0)
990 SQLITEPP_ENABLE_IF(N > 0,
993 if (keep[N-1] !=
nullptr)
throw exception(SQLITE_MISUSE);
1007 template<
class ...Args>
1045 return ret ? ret :
"";
1064 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 41, 0)
1084#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 18, 0)
1121 { check_error(call_sqlite3_enable_load_extension(this->
c_ptr(), val)); }
1131 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 8, 7)
1311 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 36, 1)
1318#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 34, 0)
1342#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 39, 0)
1396 {
deserialize(schema_name, (
std::byte *)buf, size, buf_size, flags | SQLITE_DESERIALIZE_READONLY); }
1412 unsigned flags = 0);
1423#if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 10, 0) && THINSQLITEPP_ENABLE_EXPIREMENTAL
1467 #if SQLITE_VERSION_NUMBER >= SQLITEPP_SQLITE_VERSION(3, 39, 0)
1486 void check_error(
int res)
const
1488 if (res != SQLITE_OK)
1493 static int call_sqlite3_enable_load_extension(T * db,
int onoff)
1495 if constexpr (database_detector::has_enable_load_extension<T>)
1502 static int call_sqlite3_load_extension(T * db,
const char * file,
const char * proc,
char ** err)
1504 if constexpr (database_detector::has_load_extension<T>)
1516 SQLITEPP_SUPPRESS_SILLY_VARARG_WARNING_BEGIN
1518 #if SQLITEPP_USE_VARARG_POUND_POUND_TRICK
1520 #define SQLITEPP_DEFINE_DB_OPTION(code, ...) \
1521 template<> struct database::config_mapping<code> { using type = database::config_option<code, ##__VA_ARGS__>; };
1525 #define SQLITEPP_DEFINE_VTAB_OPTION_0(code) \
1526 template<> struct database::vtab_config_mapping<code> { using type = database::vtab_config_option<code>; };
1527 #define SQLITEPP_DEFINE_VTAB_OPTION_N(code, ...) \
1528 template<> struct database::vtab_config_mapping<code> { using type = database::vtab_config_option<code, ##__VA_ARGS__>; };
1532 #define SQLITEPP_DEFINE_DB_OPTION(code, ...) \
1533 template<> struct database::config_mapping<code> { using type = database::config_option<code __VA_OPT__(,) __VA_ARGS__>; };
1535 #define SQLITEPP_DEFINE_VTAB_OPTION_N(code, ...) \
1536 template<> struct database::vtab_config_mapping<code> { using type = database::vtab_config_option<code __VA_OPT__(,) __VA_ARGS__>; };
1538 #define SQLITEPP_DEFINE_VTAB_OPTION_0(code) SQLITEPP_DEFINE_VTAB_OPTION_N(code)
1544#ifdef SQLITE_DBCONFIG_MAINDBNAME
1545 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_MAINDBNAME,
const char *);
1547 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_LOOKASIDE,
void *,
int,
int);
1548 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_FKEY,
int,
int *);
1549 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_TRIGGER,
int,
int *);
1550#ifdef SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
1551 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,
int,
int *);
1553#ifdef SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION
1554 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,
int,
int *);
1556#ifdef SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE
1557 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,
int,
int *);
1559#ifdef SQLITE_DBCONFIG_ENABLE_QPSG
1560 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_QPSG,
int,
int *);
1562#ifdef SQLITE_DBCONFIG_TRIGGER_EQP
1563 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_TRIGGER_EQP,
int,
int *);
1565#ifdef SQLITE_DBCONFIG_RESET_DATABASE
1566 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_RESET_DATABASE,
int,
int *);
1568#ifdef SQLITE_DBCONFIG_DEFENSIVE
1569 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_DEFENSIVE,
int,
int *);
1571#ifdef SQLITE_DBCONFIG_WRITABLE_SCHEMA
1572 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_WRITABLE_SCHEMA,
int,
int *);
1574#ifdef SQLITE_DBCONFIG_LEGACY_ALTER_TABLE
1575 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,
int,
int *);
1577#ifdef SQLITE_DBCONFIG_ENABLE_VIEW
1578 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_VIEW,
int,
int *);
1580#ifdef SQLITE_DBCONFIG_LEGACY_FILE_FORMAT
1581 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_LEGACY_FILE_FORMAT,
int,
int *);
1583#ifdef SQLITE_DBCONFIG_TRUSTED_SCHEMA
1584 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_TRUSTED_SCHEMA,
int,
int *);
1586#ifdef SQLITE_DBCONFIG_STMT_SCANSTATUS
1587 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_STMT_SCANSTATUS,
int,
int *);
1589#ifdef SQLITE_DBCONFIG_REVERSE_SCANORDER
1590 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_REVERSE_SCANORDER,
int,
int *);
1592#ifdef SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE
1593 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE,
int,
int *);
1595#ifdef SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE
1596 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE,
int,
int *);
1598#ifdef SQLITE_DBCONFIG_ENABLE_COMMENTS
1599 SQLITEPP_DEFINE_DB_OPTION( SQLITE_DBCONFIG_ENABLE_COMMENTS,
int,
int *);
1605 SQLITEPP_DEFINE_VTAB_OPTION_N(SQLITE_VTAB_CONSTRAINT_SUPPORT,
int);
1606#ifdef SQLITE_VTAB_INNOCUOUS
1607 SQLITEPP_DEFINE_VTAB_OPTION_0(SQLITE_VTAB_INNOCUOUS );
1609#ifdef SQLITE_VTAB_DIRECTONLY
1610 SQLITEPP_DEFINE_VTAB_OPTION_0(SQLITE_VTAB_DIRECTONLY );
1612#ifdef SQLITE_VTAB_USES_ALL_SCHEMAS
1613 SQLITEPP_DEFINE_VTAB_OPTION_0(SQLITE_VTAB_USES_ALL_SCHEMAS );
1618 #undef SQLITEPP_DEFINE_DB_OPTION
1619 #undef SQLITEPP_DEFINE_VTAB_OPTION_0
1620 #undef SQLITEPP_DEFINE_VTAB_OPTION_N
1622 SQLITEPP_SUPPRESS_SILLY_VARARG_WARNING_END
1628 #pragma GCC diagnostic pop
sqlite3_cancel_auto_extension
A reference to a null terminated string.
Definition string_param.hpp:37
const T * c_str() const noexcept
Returns the stored pointer.
Definition string_param.hpp:50
SQL Function Context Object.
Definition context_iface.hpp:37
Database Connection.
Definition database_iface.hpp:108
void release_memory() const
Free memory used by the database connection.
Definition database_iface.hpp:1262
bool auto_increment
Whether column is auto-increment.
Definition database_iface.hpp:1290
void interrupt() noexcept
Interrupt a long-running query.
Definition database_iface.hpp:1061
void drop_modules_except(const char *const *keep)
Remove virtual table modules from database connection.
Definition database_iface.hpp:978
const char * collation_sequence
Collation sequence name.
Definition database_iface.hpp:1287
int vtab_on_conflict() const noexcept
Determine the virtual table conflict policy.
Definition database_iface.hpp:956
void create_module(const string_param &name, const sqlite3_module *mod, T *data, void(*destructor)(T *)=nullptr)
Register a virtual table implementation.
Definition database_iface.hpp:905
value * preupdate_new(int column_idx)
Returns value of a column of the table row after it is updated.
void busy_timeout(int ms)
Set a busy timeout.
Definition database_iface.hpp:154
void enable_load_extension(bool val)
Enable or disable extension loading.
Definition database_iface.hpp:1120
std::unique_ptr< blob > open_blob(const string_param &dbname, const string_param &table, const string_param &column, int64_t rowid, bool writable)
Open a blob.
void commit_hook(int(*handler)(type_identity_t< T > data_ptr) noexcept, T data_ptr) noexcept
Register a callback to be called on commit.
Definition database_iface.hpp:348
void drop_modules_except(const char *const (&keep)[N])
Remove virtual table modules from database connection.
Definition database_iface.hpp:991
class mutex * mutex() const noexcept
Retrieve the mutex for the database connection.
Definition database_iface.hpp:1174
void cacheflush()
Flush caches to disk mid-transaction.
Definition database_iface.hpp:843
void create_function(const char *name, int arg_count, int flags, T data_ptr, void(*func)(context *, int, value **) noexcept, void(*step)(context *, int, value **) noexcept, void(*last)(context *) noexcept, void(*destructor)(type_identity_t< T > data_ptr) noexcept)
Create or redefine SQL function.
T exec(std::u8string_view sql, T callback)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition database_iface.hpp:253
void update_hook(T handler_ptr) noexcept
Register a callback to be called whenever a row is updated, inserted or deleted in a rowid table.
int txn_state(const string_param &schema) const noexcept
Returns the transaction state of a database.
Definition database_iface.hpp:1327
T exec(std::string_view sql, T callback)
Run multiple statements of SQL with a callback.
void drop_modules()
Remove all virtual table modules from database connection.
Definition database_iface.hpp:968
void deserialize(const string_param &schema_name, std::byte *buf, size_t size, size_t buf_size, unsigned flags=0)
Deserialize a database.
Definition database_iface.hpp:1374
void overload_function(const string_param &name, int arg_count) noexcept
Overload a function for a virtual table.
Definition database_iface.hpp:1198
void create_function(const char *name, int arg_count, int flags, T impl_ptr, void(*destructor)(type_identity_t< T > obj) noexcept=nullptr)
Create or redefine SQL function.
void create_collation(const string_param &name, int encoding, T collator_ptr, void(*destructor)(type_identity_t< T > obj) noexcept=nullptr)
Define a new collating sequence.
void drop_modules_except(Args &&...args)
Remove virtual table modules from database connection.
Definition database_iface.hpp:1009
void autocheckpoint(int num_frames)
Configure an auto-checkpoint.
Definition database_iface.hpp:637
void file_control(const string_param &db_name, int op, void *data)
Low-level control of database file.
Definition database_iface.hpp:1034
void open_snapshot(const string_param &schema, const snapshot &snap)
Start a read transaction on an historical snapshot.
Definition database_iface.hpp:1446
void wal_hook(int(*handler)(type_identity_t< T > data_ptr, database *db, const char *db_name, int num_pages) noexcept, T data_ptr) noexcept
Register a callback to be called each time data is committed to a database in wal mode.
Definition database_iface.hpp:503
void declare_vtab(const string_param &sdl)
Declare the schema of a virtual table.
Definition database_iface.hpp:917
column_metadata table_column_metadata(const string_param &db_name, const string_param &table_name, const string_param &column_name) const
Extract metadata about a column of a table.
void create_collation(const string_param &name, int encoding, T collator_ptr, int(*compare)(type_identity_t< T > collator, int lhs_len, const void *lhs_bytes, int rhs_len, const void *rhs_bytes) noexcept, void(*destructor)(type_identity_t< T > collator) noexcept)
Define a new collating sequence.
void busy_handler(T handler_ptr)
Register a callback to handle SQLITE_BUSY errors.
void commit_hook(T handler_ptr) noexcept
Register a callback to be called on commit.
auto config(Args &&...args) -> void
Configure database connection.
Definition database_iface.hpp:864
bool is_interrupted() noexcept
Returns whether or not an interrupt is currently in effect.
Definition database_iface.hpp:1072
std::unique_ptr< snapshot > get_snapshot(const string_param &schema)
Record a database snapshot.
void auto_extension(void(*entry_point)(database *, const char **, const struct sqlite3_api_routines *))
Automatically load statically linked extension.
Definition database_iface.hpp:1140
~database() noexcept
Equivalent to sqlite3_close_v2.
Definition database_iface.hpp:143
std::pair< int, int > checkpoint(const string_param &db_name, int mode=SQLITE_CHECKPOINT_PASSIVE)
Checkpoint a database.
void create_window_function(const char *name, int arg_count, int flags, T impl_ptr, void(*destructor)(type_identity_t< T > obj) noexcept=nullptr)
Create or redefine SQL aggregate window function
int preupdate_blobwrite() const noexcept
Returns the index of the column being written via sqlite3_blob_write.
Definition database_iface.hpp:604
void cancel_auto_extension(void(*entry_point)(database *, const char **, const struct sqlite3_api_routines *))
Cancel automatic extension Loading.
Definition database_iface.hpp:1151
static std::unique_ptr< database > open(const string_param &db_filename, int flags, const char *vfs=nullptr)
Open a new database connection.
void preupdate_hook(T handler_ptr) noexcept
Register a callback to be called prior to each INSERT, UPDATE, and DELETE operation on a database tab...
void extended_result_codes(bool onoff)
Enable or disable extended result codes.
Definition database_iface.hpp:1025
const char * filename(const string_param &db_name) const noexcept
Return the filename for the database connection.
Definition database_iface.hpp:1042
int preupdate_count() const noexcept
Returns the number of columns in the row that is being inserted, updated, or deleted.
Definition database_iface.hpp:570
int limit(int id, int new_val) noexcept
Set or retrieve run-time limits.
Definition database_iface.hpp:1106
class statement * next_statement(const class statement *prev) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition database_iface.hpp:1188
void update_hook(void(*handler)(type_identity_t< T > data_ptr, int op, const char *db_name, const char *table, sqlite3_int64 rowid) noexcept, T data_ptr) noexcept
Register a callback to be called whenever a row is updated, inserted or deleted in a rowid table.
Definition database_iface.hpp:416
void create_window_function(const char *name, int arg_count, int flags, T data_ptr, void(*step)(context *, int, value **) noexcept, void(*last)(context *) noexcept, void(*current)(context *) noexcept, void(*inverse)(context *, int, value **) noexcept, void(*destructor)(type_identity_t< T > data_ptr) noexcept)
Create or redefine SQL aggregate window function
void collation_needed(T data_ptr, void(*handler)(type_identity_t< T > data_ptr, database *, int encoding, const char *name) noexcept)
Register a callback to be called when undefined collation sequence is required.
Definition database_iface.hpp:312
void deserialize(const string_param &schema_name, const std::byte *buf, size_t size, size_t buf_size, unsigned flags=0)
Deserialize a database.
Definition database_iface.hpp:1391
void load_extension(const string_param &file, const string_param &proc=nullptr)
Load an extension.
int64_t last_insert_rowid() const noexcept
Returns last insert rowid.
Definition database_iface.hpp:1081
void progress_handler(int step_count, T handler_ptr) const noexcept
Register a callback to be called on query progress.
int preupdate_depth() const noexcept
Returns the "depth" of an update from the top level SQL.
Definition database_iface.hpp:588
void deserialize(const string_param &schema_name, allocated_bytes buf, size_t size, size_t buf_size, unsigned flags=0)
Deserialize a database.
void preupdate_hook(void(*handler)(type_identity_t< T > data_ptr, database *db, int op, const char *db_name, const char *table, sqlite3_int64 rowid_old, sqlite3_int64 rowid_new) noexcept, T data_ptr) noexcept
Register a callback to be called prior to each INSERT, UPDATE, and DELETE operation on a database tab...
Definition database_iface.hpp:456
std::optional< bool > readonly(const string_param &db_name) const noexcept
Determine if a database is read-only.
const class statement * next_statement(const class statement *prev) const noexcept
Find the next prepared statement.
Definition database_iface.hpp:1184
bool not_null
Whether NOT NULL constraint exists.
Definition database_iface.hpp:1288
void create_module(const string_param &name, const sqlite3_module *mod)
Register a virtual table implementation.
Definition database_iface.hpp:891
value * preupdate_old(int column_idx)
Returns value of a column of the table row before it is updated.
void rollback_hook(T handler_ptr) noexcept
Register a callback to be called on rollback.
void collation_needed(T handler_ptr)
Register a callback to be called when undefined collation sequence is required.
T exec(std::u8string_view sql)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition database_iface.hpp:199
bool get_autocommit() const noexcept
Return the auto-commit mode.
Definition database_iface.hpp:1053
int64_t total_changes() const noexcept
Returns total number of rows modified.
Definition database_iface.hpp:1309
const char * data_type
Declared data type.
Definition database_iface.hpp:1286
void progress_handler(int step_count, int(*handler)(type_identity_t< T > data_ptr) noexcept, T data_ptr) const noexcept
Register a callback to be called on query progress.
Definition database_iface.hpp:1219
void busy_handler(int(*handler)(type_identity_t< T > data_ptr, int count_invoked) noexcept, T data_ptr)
Register a callback to handle SQLITE_BUSY errors.
Definition database_iface.hpp:277
auto vtab_config(Args &&...args) -> void
Configure virtual table.
Definition database_iface.hpp:936
int64_t changes() const noexcept
Count of the number of rows modified.
Definition database_iface.hpp:164
std::pair< allocated_bytes, size_t > serialize(const string_param &schema_name)
Serialize a database.
void recover_snapshot(const string_param &db)
Recover snapshots from a wal file.
Definition database_iface.hpp:1459
void exec(std::string_view sql)
Run multiple statements of SQL.
void rollback_hook(void(*handler)(type_identity_t< T > data_ptr) noexcept, T data_ptr) noexcept
Register a callback to be called on rollback.
Definition database_iface.hpp:382
span< std::byte > serialize_reference(const string_param &schema_name) noexcept
Serialize a database.
void reset_auto_extension() noexcept
Reset automatic extension loading.
Definition database_iface.hpp:1162
void set_last_insert_rowid(int64_t value) noexcept
Set the last insert rowid value.
Definition database_iface.hpp:1092
bool primary_key
Whether column part of PK.
Definition database_iface.hpp:1289
const char * db_name(int idx) noexcept
Return schema names.
Definition database_iface.hpp:1478
void wal_hook(T handler_ptr) noexcept
Register a callback to be called each time data is committed to a database in wal mode.
Return type for status()
Definition database_iface.hpp:1269
Exception used to report any SQLite errors.
Definition exception_iface.hpp:166
Base functionality for all fake wrapper classes
Definition handle.hpp:27
T * c_ptr() const noexcept
Access the real underlying SQLite type.
Definition handle.hpp:45
SQLite Mutex.
Definition mutex_iface.hpp:45
A database snapshot.
Definition snapshot_iface.hpp:42
Prepared Statement Object.
Definition statement_iface.hpp:41
Dynamically Typed Value Object.
Definition value_iface.hpp:35
sqlite3_db_release_memory
sqlite3_enable_load_extension
sqlite3_extended_result_codes
basic_string_param< char > string_param
Convenience typedef.
Definition string_param.hpp:57
@ reset
Reset the statement (does not affect the bindings)
T is_nothrow_invocable_r_v
sqlite3_last_insert_rowid
ThinSQLite++ namespace.
Definition backup_iface.hpp:17
sqlite3_overload_function
sqlite3_reset_auto_extension
sqlite3_set_last_insert_rowid
sqlite3_wal_autocheckpoint