| // ignore_for_file: camel_case_types, non_constant_identifier_names |
| |
| // AUTO GENERATED FILE, DO NOT EDIT. |
| // |
| // Generated by `package:ffigen`. |
| // ignore_for_file: type=lint |
| import 'dart:ffi' as ffi; |
| |
| /// Bindings to SQLite. |
| class SQLite { |
| /// Holds the symbol lookup function. |
| final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) |
| _lookup; |
| |
| /// The symbols are looked up in [dynamicLibrary]. |
| SQLite(ffi.DynamicLibrary dynamicLibrary) : _lookup = dynamicLibrary.lookup; |
| |
| /// The symbols are looked up with [lookup]. |
| SQLite.fromLookup( |
| ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName) |
| lookup) |
| : _lookup = lookup; |
| |
| /// CAPI3REF: Run-Time Library Version Numbers |
| /// KEYWORDS: sqlite3_version sqlite3_sourceid |
| /// |
| /// These interfaces provide the same information as the [SQLITE_VERSION], |
| /// [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| /// but are associated with the library instead of the header file. ^(Cautious |
| /// programmers might include assert() statements in their application to |
| /// verify that values returned by these interfaces match the macros in |
| /// the header, and thus ensure that the application is |
| /// compiled with matching library and header files. |
| /// |
| /// <blockquote><pre> |
| /// assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER ); |
| /// assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 ); |
| /// assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 ); |
| /// </pre></blockquote>)^ |
| /// |
| /// ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] |
| /// macro. ^The sqlite3_libversion() function returns a pointer to the |
| /// to the sqlite3_version[] string constant. The sqlite3_libversion() |
| /// function is provided for use in DLLs since DLL users usually do not have |
| /// direct access to string constants within the DLL. ^The |
| /// sqlite3_libversion_number() function returns an integer equal to |
| /// [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns |
| /// a pointer to a string constant whose value is the same as the |
| /// [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built |
| /// using an edited copy of [the amalgamation], then the last four characters |
| /// of the hash might be different from [SQLITE_SOURCE_ID].)^ |
| /// |
| /// See also: [sqlite_version()] and [sqlite_source_id()]. |
| late final ffi.Pointer<ffi.Pointer<ffi.Char>> _sqlite3_version = |
| _lookup<ffi.Pointer<ffi.Char>>('sqlite3_version'); |
| |
| ffi.Pointer<ffi.Char> get sqlite3_version => _sqlite3_version.value; |
| |
| set sqlite3_version(ffi.Pointer<ffi.Char> value) => |
| _sqlite3_version.value = value; |
| |
| ffi.Pointer<ffi.Char> sqlite3_libversion() { |
| return _sqlite3_libversion(); |
| } |
| |
| late final _sqlite3_libversionPtr = |
| _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>( |
| 'sqlite3_libversion'); |
| late final _sqlite3_libversion = |
| _sqlite3_libversionPtr.asFunction<ffi.Pointer<ffi.Char> Function()>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_sourceid() { |
| return _sqlite3_sourceid(); |
| } |
| |
| late final _sqlite3_sourceidPtr = |
| _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function()>>( |
| 'sqlite3_sourceid'); |
| late final _sqlite3_sourceid = |
| _sqlite3_sourceidPtr.asFunction<ffi.Pointer<ffi.Char> Function()>(); |
| |
| int sqlite3_libversion_number() { |
| return _sqlite3_libversion_number(); |
| } |
| |
| late final _sqlite3_libversion_numberPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function()>>( |
| 'sqlite3_libversion_number'); |
| late final _sqlite3_libversion_number = |
| _sqlite3_libversion_numberPtr.asFunction<int Function()>(); |
| |
| int sqlite3_compileoption_used( |
| ffi.Pointer<ffi.Char> zOptName, |
| ) { |
| return _sqlite3_compileoption_used( |
| zOptName, |
| ); |
| } |
| |
| late final _sqlite3_compileoption_usedPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Char>)>>( |
| 'sqlite3_compileoption_used'); |
| late final _sqlite3_compileoption_used = _sqlite3_compileoption_usedPtr |
| .asFunction<int Function(ffi.Pointer<ffi.Char>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_compileoption_get( |
| int N, |
| ) { |
| return _sqlite3_compileoption_get( |
| N, |
| ); |
| } |
| |
| late final _sqlite3_compileoption_getPtr = |
| _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int)>>( |
| 'sqlite3_compileoption_get'); |
| late final _sqlite3_compileoption_get = _sqlite3_compileoption_getPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(int)>(); |
| |
| /// CAPI3REF: Test To See If The Library Is Threadsafe |
| /// |
| /// ^The sqlite3_threadsafe() function returns zero if and only if |
| /// SQLite was compiled with mutexing code omitted due to the |
| /// [SQLITE_THREADSAFE] compile-time option being set to 0. |
| /// |
| /// SQLite can be compiled with or without mutexes. When |
| /// the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes |
| /// are enabled and SQLite is threadsafe. When the |
| /// [SQLITE_THREADSAFE] macro is 0, |
| /// the mutexes are omitted. Without the mutexes, it is not safe |
| /// to use SQLite concurrently from more than one thread. |
| /// |
| /// Enabling mutexes incurs a measurable performance penalty. |
| /// So if speed is of utmost importance, it makes sense to disable |
| /// the mutexes. But for maximum safety, mutexes should be enabled. |
| /// ^The default behavior is for mutexes to be enabled. |
| /// |
| /// This interface can be used by an application to make sure that the |
| /// version of SQLite that it is linking against was compiled with |
| /// the desired setting of the [SQLITE_THREADSAFE] macro. |
| /// |
| /// This interface only reports on the compile-time mutex setting |
| /// of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with |
| /// SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but |
| /// can be fully or partially disabled using a call to [sqlite3_config()] |
| /// with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], |
| /// or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the |
| /// sqlite3_threadsafe() function shows only the compile-time setting of |
| /// thread safety, not any run-time changes to that setting made by |
| /// sqlite3_config(). In other words, the return value from sqlite3_threadsafe() |
| /// is unchanged by calls to sqlite3_config().)^ |
| /// |
| /// See the [threading mode] documentation for additional information. |
| int sqlite3_threadsafe() { |
| return _sqlite3_threadsafe(); |
| } |
| |
| late final _sqlite3_threadsafePtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function()>>('sqlite3_threadsafe'); |
| late final _sqlite3_threadsafe = |
| _sqlite3_threadsafePtr.asFunction<int Function()>(); |
| |
| /// CAPI3REF: Closing A Database Connection |
| /// DESTRUCTOR: sqlite3 |
| /// |
| /// ^The sqlite3_close() and sqlite3_close_v2() routines are destructors |
| /// for the [sqlite3] object. |
| /// ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if |
| /// the [sqlite3] object is successfully destroyed and all associated |
| /// resources are deallocated. |
| /// |
| /// Ideally, applications should [sqlite3_finalize | finalize] all |
| /// [prepared statements], [sqlite3_blob_close | close] all [BLOB handles], and |
| /// [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated |
| /// with the [sqlite3] object prior to attempting to close the object. |
| /// ^If the database connection is associated with unfinalized prepared |
| /// statements, BLOB handlers, and/or unfinished sqlite3_backup objects then |
| /// sqlite3_close() will leave the database connection open and return |
| /// [SQLITE_BUSY]. ^If sqlite3_close_v2() is called with unfinalized prepared |
| /// statements, unclosed BLOB handlers, and/or unfinished sqlite3_backups, |
| /// it returns [SQLITE_OK] regardless, but instead of deallocating the database |
| /// connection immediately, it marks the database connection as an unusable |
| /// "zombie" and makes arrangements to automatically deallocate the database |
| /// connection after all prepared statements are finalized, all BLOB handles |
| /// are closed, and all backups have finished. The sqlite3_close_v2() interface |
| /// is intended for use with host languages that are garbage collected, and |
| /// where the order in which destructors are called is arbitrary. |
| /// |
| /// ^If an [sqlite3] object is destroyed while a transaction is open, |
| /// the transaction is automatically rolled back. |
| /// |
| /// The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] |
| /// must be either a NULL |
| /// pointer or an [sqlite3] object pointer obtained |
| /// from [sqlite3_open()], [sqlite3_open16()], or |
| /// [sqlite3_open_v2()], and not previously closed. |
| /// ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer |
| /// argument is a harmless no-op. |
| int sqlite3_close( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_close( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_closePtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_close'); |
| late final _sqlite3_close = |
| _sqlite3_closePtr.asFunction<int Function(ffi.Pointer<sqlite3>)>(); |
| |
| int sqlite3_close_v2( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_close_v2( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_close_v2Ptr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_close_v2'); |
| late final _sqlite3_close_v2 = |
| _sqlite3_close_v2Ptr.asFunction<int Function(ffi.Pointer<sqlite3>)>(); |
| |
| /// CAPI3REF: One-Step Query Execution Interface |
| /// METHOD: sqlite3 |
| /// |
| /// The sqlite3_exec() interface is a convenience wrapper around |
| /// [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], |
| /// that allows an application to run multiple statements of SQL |
| /// without having to use a lot of C code. |
| /// |
| /// ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, |
| /// semicolon-separate SQL statements passed into its 2nd argument, |
| /// in the context of the [database connection] passed in as its 1st |
| /// argument. ^If the callback function of the 3rd argument to |
| /// sqlite3_exec() is not NULL, then it is invoked for each result row |
| /// coming out of the evaluated SQL statements. ^The 4th argument to |
| /// sqlite3_exec() is relayed through to the 1st argument of each |
| /// callback invocation. ^If the callback pointer to sqlite3_exec() |
| /// is NULL, then no callback is ever invoked and result rows are |
| /// ignored. |
| /// |
| /// ^If an error occurs while evaluating the SQL statements passed into |
| /// sqlite3_exec(), then execution of the current statement stops and |
| /// subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() |
| /// is not NULL then any error message is written into memory obtained |
| /// from [sqlite3_malloc()] and passed back through the 5th parameter. |
| /// To avoid memory leaks, the application should invoke [sqlite3_free()] |
| /// on error message strings returned through the 5th parameter of |
| /// sqlite3_exec() after the error message string is no longer needed. |
| /// ^If the 5th parameter to sqlite3_exec() is not NULL and no errors |
| /// occur, then sqlite3_exec() sets the pointer in its 5th parameter to |
| /// NULL before returning. |
| /// |
| /// ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() |
| /// routine returns SQLITE_ABORT without invoking the callback again and |
| /// without running any subsequent SQL statements. |
| /// |
| /// ^The 2nd argument to the sqlite3_exec() callback function is the |
| /// number of columns in the result. ^The 3rd argument to the sqlite3_exec() |
| /// callback is an array of pointers to strings obtained as if from |
| /// [sqlite3_column_text()], one for each column. ^If an element of a |
| /// result row is NULL then the corresponding string pointer for the |
| /// sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the |
| /// sqlite3_exec() callback is an array of pointers to strings where each |
| /// entry represents the name of corresponding result column as obtained |
| /// from [sqlite3_column_name()]. |
| /// |
| /// ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer |
| /// to an empty string, or a pointer that contains only whitespace and/or |
| /// SQL comments, then no SQL statements are evaluated and the database |
| /// is not changed. |
| /// |
| /// Restrictions: |
| /// |
| /// <ul> |
| /// <li> The application must ensure that the 1st parameter to sqlite3_exec() |
| /// is a valid and open [database connection]. |
| /// <li> The application must not close the [database connection] specified by |
| /// the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. |
| /// <li> The application must not modify the SQL statement text passed into |
| /// the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. |
| /// </ul> |
| int sqlite3_exec( |
| ffi.Pointer<sqlite3> arg0, |
| ffi.Pointer<ffi.Char> sql, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>> |
| callback, |
| ffi.Pointer<ffi.Void> arg3, |
| ffi.Pointer<ffi.Pointer<ffi.Char>> errmsg, |
| ) { |
| return _sqlite3_exec( |
| arg0, |
| sql, |
| callback, |
| arg3, |
| errmsg, |
| ); |
| } |
| |
| late final _sqlite3_execPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>, |
| ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('sqlite3_exec'); |
| late final _sqlite3_exec = _sqlite3_execPtr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>, |
| ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>(); |
| |
| /// CAPI3REF: Initialize The SQLite Library |
| /// |
| /// ^The sqlite3_initialize() routine initializes the |
| /// SQLite library. ^The sqlite3_shutdown() routine |
| /// deallocates any resources that were allocated by sqlite3_initialize(). |
| /// These routines are designed to aid in process initialization and |
| /// shutdown on embedded systems. Workstation applications using |
| /// SQLite normally do not need to invoke either of these routines. |
| /// |
| /// A call to sqlite3_initialize() is an "effective" call if it is |
| /// the first time sqlite3_initialize() is invoked during the lifetime of |
| /// the process, or if it is the first time sqlite3_initialize() is invoked |
| /// following a call to sqlite3_shutdown(). ^(Only an effective call |
| /// of sqlite3_initialize() does any initialization. All other calls |
| /// are harmless no-ops.)^ |
| /// |
| /// A call to sqlite3_shutdown() is an "effective" call if it is the first |
| /// call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only |
| /// an effective call to sqlite3_shutdown() does any deinitialization. |
| /// All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ |
| /// |
| /// The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() |
| /// is not. The sqlite3_shutdown() interface must only be called from a |
| /// single thread. All open [database connections] must be closed and all |
| /// other SQLite resources must be deallocated prior to invoking |
| /// sqlite3_shutdown(). |
| /// |
| /// Among other things, ^sqlite3_initialize() will invoke |
| /// sqlite3_os_init(). Similarly, ^sqlite3_shutdown() |
| /// will invoke sqlite3_os_end(). |
| /// |
| /// ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. |
| /// ^If for some reason, sqlite3_initialize() is unable to initialize |
| /// the library (perhaps it is unable to allocate a needed resource such |
| /// as a mutex) it returns an [error code] other than [SQLITE_OK]. |
| /// |
| /// ^The sqlite3_initialize() routine is called internally by many other |
| /// SQLite interfaces so that an application usually does not need to |
| /// invoke sqlite3_initialize() directly. For example, [sqlite3_open()] |
| /// calls sqlite3_initialize() so the SQLite library will be automatically |
| /// initialized when [sqlite3_open()] is called if it has not be initialized |
| /// already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] |
| /// compile-time option, then the automatic calls to sqlite3_initialize() |
| /// are omitted and the application must call sqlite3_initialize() directly |
| /// prior to using any other SQLite interface. For maximum portability, |
| /// it is recommended that applications always invoke sqlite3_initialize() |
| /// directly prior to using any other SQLite interface. Future releases |
| /// of SQLite may require this. In other words, the behavior exhibited |
| /// when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the |
| /// default behavior in some future release of SQLite. |
| /// |
| /// The sqlite3_os_init() routine does operating-system specific |
| /// initialization of the SQLite library. The sqlite3_os_end() |
| /// routine undoes the effect of sqlite3_os_init(). Typical tasks |
| /// performed by these routines include allocation or deallocation |
| /// of static resources, initialization of global variables, |
| /// setting up a default [sqlite3_vfs] module, or setting up |
| /// a default configuration using [sqlite3_config()]. |
| /// |
| /// The application should never invoke either sqlite3_os_init() |
| /// or sqlite3_os_end() directly. The application should only invoke |
| /// sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() |
| /// interface is called automatically by sqlite3_initialize() and |
| /// sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate |
| /// implementations for sqlite3_os_init() and sqlite3_os_end() |
| /// are built into SQLite when it is compiled for Unix, Windows, or OS/2. |
| /// When [custom builds | built for other platforms] |
| /// (using the [SQLITE_OS_OTHER=1] compile-time |
| /// option) the application must supply a suitable implementation for |
| /// sqlite3_os_init() and sqlite3_os_end(). An application-supplied |
| /// implementation of sqlite3_os_init() or sqlite3_os_end() |
| /// must return [SQLITE_OK] on success and some other [error code] upon |
| /// failure. |
| int sqlite3_initialize() { |
| return _sqlite3_initialize(); |
| } |
| |
| late final _sqlite3_initializePtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function()>>('sqlite3_initialize'); |
| late final _sqlite3_initialize = |
| _sqlite3_initializePtr.asFunction<int Function()>(); |
| |
| int sqlite3_shutdown() { |
| return _sqlite3_shutdown(); |
| } |
| |
| late final _sqlite3_shutdownPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function()>>('sqlite3_shutdown'); |
| late final _sqlite3_shutdown = |
| _sqlite3_shutdownPtr.asFunction<int Function()>(); |
| |
| int sqlite3_os_init() { |
| return _sqlite3_os_init(); |
| } |
| |
| late final _sqlite3_os_initPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function()>>('sqlite3_os_init'); |
| late final _sqlite3_os_init = |
| _sqlite3_os_initPtr.asFunction<int Function()>(); |
| |
| int sqlite3_os_end() { |
| return _sqlite3_os_end(); |
| } |
| |
| late final _sqlite3_os_endPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function()>>('sqlite3_os_end'); |
| late final _sqlite3_os_end = _sqlite3_os_endPtr.asFunction<int Function()>(); |
| |
| /// CAPI3REF: Configuring The SQLite Library |
| /// |
| /// The sqlite3_config() interface is used to make global configuration |
| /// changes to SQLite in order to tune SQLite to the specific needs of |
| /// the application. The default configuration is recommended for most |
| /// applications and so this routine is usually not necessary. It is |
| /// provided to support rare applications with unusual needs. |
| /// |
| /// <b>The sqlite3_config() interface is not threadsafe. The application |
| /// must ensure that no other SQLite interfaces are invoked by other |
| /// threads while sqlite3_config() is running.</b> |
| /// |
| /// The sqlite3_config() interface |
| /// may only be invoked prior to library initialization using |
| /// [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. |
| /// ^If sqlite3_config() is called after [sqlite3_initialize()] and before |
| /// [sqlite3_shutdown()] then it will return SQLITE_MISUSE. |
| /// Note, however, that ^sqlite3_config() can be called as part of the |
| /// implementation of an application-defined [sqlite3_os_init()]. |
| /// |
| /// The first argument to sqlite3_config() is an integer |
| /// [configuration option] that determines |
| /// what property of SQLite is to be configured. Subsequent arguments |
| /// vary depending on the [configuration option] |
| /// in the first argument. |
| /// |
| /// ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. |
| /// ^If the option is unknown or SQLite is unable to set the option |
| /// then this routine returns a non-zero [error code]. |
| int sqlite3_config( |
| int arg0, |
| ) { |
| return _sqlite3_config( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_configPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Int)>>('sqlite3_config'); |
| late final _sqlite3_config = |
| _sqlite3_configPtr.asFunction<int Function(int)>(); |
| |
| /// CAPI3REF: Configure database connections |
| /// METHOD: sqlite3 |
| /// |
| /// The sqlite3_db_config() interface is used to make configuration |
| /// changes to a [database connection]. The interface is similar to |
| /// [sqlite3_config()] except that the changes apply to a single |
| /// [database connection] (specified in the first argument). |
| /// |
| /// The second argument to sqlite3_db_config(D,V,...) is the |
| /// [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code |
| /// that indicates what aspect of the [database connection] is being configured. |
| /// Subsequent arguments vary depending on the configuration verb. |
| /// |
| /// ^Calls to sqlite3_db_config() return SQLITE_OK if and only if |
| /// the call is considered successful. |
| int sqlite3_db_config( |
| ffi.Pointer<sqlite3> arg0, |
| int op, |
| ) { |
| return _sqlite3_db_config( |
| arg0, |
| op, |
| ); |
| } |
| |
| late final _sqlite3_db_configPtr = _lookup< |
| ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>, ffi.Int)>>( |
| 'sqlite3_db_config'); |
| late final _sqlite3_db_config = _sqlite3_db_configPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3>, int)>(); |
| |
| /// CAPI3REF: Enable Or Disable Extended Result Codes |
| /// METHOD: sqlite3 |
| /// |
| /// ^The sqlite3_extended_result_codes() routine enables or disables the |
| /// [extended result codes] feature of SQLite. ^The extended result |
| /// codes are disabled by default for historical compatibility. |
| int sqlite3_extended_result_codes( |
| ffi.Pointer<sqlite3> arg0, |
| int onoff, |
| ) { |
| return _sqlite3_extended_result_codes( |
| arg0, |
| onoff, |
| ); |
| } |
| |
| late final _sqlite3_extended_result_codesPtr = _lookup< |
| ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>, ffi.Int)>>( |
| 'sqlite3_extended_result_codes'); |
| late final _sqlite3_extended_result_codes = _sqlite3_extended_result_codesPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3>, int)>(); |
| |
| /// CAPI3REF: Last Insert Rowid |
| /// METHOD: sqlite3 |
| /// |
| /// ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables) |
| /// has a unique 64-bit signed |
| /// integer key called the [ROWID | "rowid"]. ^The rowid is always available |
| /// as an undeclared column named ROWID, OID, or _ROWID_ as long as those |
| /// names are not also used by explicitly declared columns. ^If |
| /// the table has a column of type [INTEGER PRIMARY KEY] then that column |
| /// is another alias for the rowid. |
| /// |
| /// ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of |
| /// the most recent successful [INSERT] into a rowid table or [virtual table] |
| /// on database connection D. ^Inserts into [WITHOUT ROWID] tables are not |
| /// recorded. ^If no successful [INSERT]s into rowid tables have ever occurred |
| /// on the database connection D, then sqlite3_last_insert_rowid(D) returns |
| /// zero. |
| /// |
| /// As well as being set automatically as rows are inserted into database |
| /// tables, the value returned by this function may be set explicitly by |
| /// [sqlite3_set_last_insert_rowid()] |
| /// |
| /// Some virtual table implementations may INSERT rows into rowid tables as |
| /// part of committing a transaction (e.g. to flush data accumulated in memory |
| /// to disk). In this case subsequent calls to this function return the rowid |
| /// associated with these internal INSERT operations, which leads to |
| /// unintuitive results. Virtual table implementations that do write to rowid |
| /// tables in this way can avoid this problem by restoring the original |
| /// rowid value using [sqlite3_set_last_insert_rowid()] before returning |
| /// control to the user. |
| /// |
| /// ^(If an [INSERT] occurs within a trigger then this routine will |
| /// return the [rowid] of the inserted row as long as the trigger is |
| /// running. Once the trigger program ends, the value returned |
| /// by this routine reverts to what it was before the trigger was fired.)^ |
| /// |
| /// ^An [INSERT] that fails due to a constraint violation is not a |
| /// successful [INSERT] and does not change the value returned by this |
| /// routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, |
| /// and INSERT OR ABORT make no changes to the return value of this |
| /// routine when their insertion fails. ^(When INSERT OR REPLACE |
| /// encounters a constraint violation, it does not fail. The |
| /// INSERT continues to completion after deleting rows that caused |
| /// the constraint problem so INSERT OR REPLACE will always change |
| /// the return value of this interface.)^ |
| /// |
| /// ^For the purposes of this routine, an [INSERT] is considered to |
| /// be successful even if it is subsequently rolled back. |
| /// |
| /// This function is accessible to SQL statements via the |
| /// [last_insert_rowid() SQL function]. |
| /// |
| /// If a separate thread performs a new [INSERT] on the same |
| /// database connection while the [sqlite3_last_insert_rowid()] |
| /// function is running and thus changes the last insert [rowid], |
| /// then the value returned by [sqlite3_last_insert_rowid()] is |
| /// unpredictable and might not equal either the old or the new |
| /// last insert [rowid]. |
| int sqlite3_last_insert_rowid( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_last_insert_rowid( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_last_insert_rowidPtr = |
| _lookup<ffi.NativeFunction<sqlite3_int64 Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_last_insert_rowid'); |
| late final _sqlite3_last_insert_rowid = _sqlite3_last_insert_rowidPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3>)>(); |
| |
| /// CAPI3REF: Set the Last Insert Rowid value. |
| /// METHOD: sqlite3 |
| /// |
| /// The sqlite3_set_last_insert_rowid(D, R) method allows the application to |
| /// set the value returned by calling sqlite3_last_insert_rowid(D) to R |
| /// without inserting a row into the database. |
| void sqlite3_set_last_insert_rowid( |
| ffi.Pointer<sqlite3> arg0, |
| int arg1, |
| ) { |
| return _sqlite3_set_last_insert_rowid( |
| arg0, |
| arg1, |
| ); |
| } |
| |
| late final _sqlite3_set_last_insert_rowidPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Void Function(ffi.Pointer<sqlite3>, |
| sqlite3_int64)>>('sqlite3_set_last_insert_rowid'); |
| late final _sqlite3_set_last_insert_rowid = _sqlite3_set_last_insert_rowidPtr |
| .asFunction<void Function(ffi.Pointer<sqlite3>, int)>(); |
| |
| /// CAPI3REF: Count The Number Of Rows Modified |
| /// METHOD: sqlite3 |
| /// |
| /// ^This function returns the number of rows modified, inserted or |
| /// deleted by the most recently completed INSERT, UPDATE or DELETE |
| /// statement on the database connection specified by the only parameter. |
| /// ^Executing any other type of SQL statement does not modify the value |
| /// returned by this function. |
| /// |
| /// ^Only changes made directly by the INSERT, UPDATE or DELETE statement are |
| /// considered - auxiliary changes caused by [CREATE TRIGGER | triggers], |
| /// [foreign key actions] or [REPLACE] constraint resolution are not counted. |
| /// |
| /// Changes to a view that are intercepted by |
| /// [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value |
| /// returned by sqlite3_changes() immediately after an INSERT, UPDATE or |
| /// DELETE statement run on a view is always zero. Only changes made to real |
| /// tables are counted. |
| /// |
| /// Things are more complicated if the sqlite3_changes() function is |
| /// executed while a trigger program is running. This may happen if the |
| /// program uses the [changes() SQL function], or if some other callback |
| /// function invokes sqlite3_changes() directly. Essentially: |
| /// |
| /// <ul> |
| /// <li> ^(Before entering a trigger program the value returned by |
| /// sqlite3_changes() function is saved. After the trigger program |
| /// has finished, the original value is restored.)^ |
| /// |
| /// <li> ^(Within a trigger program each INSERT, UPDATE and DELETE |
| /// statement sets the value returned by sqlite3_changes() |
| /// upon completion as normal. Of course, this value will not include |
| /// any changes performed by sub-triggers, as the sqlite3_changes() |
| /// value will be saved and restored after each sub-trigger has run.)^ |
| /// </ul> |
| /// |
| /// ^This means that if the changes() SQL function (or similar) is used |
| /// by the first INSERT, UPDATE or DELETE statement within a trigger, it |
| /// returns the value as set when the calling statement began executing. |
| /// ^If it is used by the second or subsequent such statement within a trigger |
| /// program, the value returned reflects the number of rows modified by the |
| /// previous INSERT, UPDATE or DELETE statement within the same trigger. |
| /// |
| /// If a separate thread makes changes on the same database connection |
| /// while [sqlite3_changes()] is running then the value returned |
| /// is unpredictable and not meaningful. |
| /// |
| /// See also: |
| /// <ul> |
| /// <li> the [sqlite3_total_changes()] interface |
| /// <li> the [count_changes pragma] |
| /// <li> the [changes() SQL function] |
| /// <li> the [data_version pragma] |
| /// </ul> |
| int sqlite3_changes( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_changes( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_changesPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_changes'); |
| late final _sqlite3_changes = |
| _sqlite3_changesPtr.asFunction<int Function(ffi.Pointer<sqlite3>)>(); |
| |
| /// CAPI3REF: Total Number Of Rows Modified |
| /// METHOD: sqlite3 |
| /// |
| /// ^This function returns the total number of rows inserted, modified or |
| /// deleted by all [INSERT], [UPDATE] or [DELETE] statements completed |
| /// since the database connection was opened, including those executed as |
| /// part of trigger programs. ^Executing any other type of SQL statement |
| /// does not affect the value returned by sqlite3_total_changes(). |
| /// |
| /// ^Changes made as part of [foreign key actions] are included in the |
| /// count, but those made as part of REPLACE constraint resolution are |
| /// not. ^Changes to a view that are intercepted by INSTEAD OF triggers |
| /// are not counted. |
| /// |
| /// The [sqlite3_total_changes(D)] interface only reports the number |
| /// of rows that changed due to SQL statement run against database |
| /// connection D. Any changes by other database connections are ignored. |
| /// To detect changes against a database file from other database |
| /// connections use the [PRAGMA data_version] command or the |
| /// [SQLITE_FCNTL_DATA_VERSION] [file control]. |
| /// |
| /// If a separate thread makes changes on the same database connection |
| /// while [sqlite3_total_changes()] is running then the value |
| /// returned is unpredictable and not meaningful. |
| /// |
| /// See also: |
| /// <ul> |
| /// <li> the [sqlite3_changes()] interface |
| /// <li> the [count_changes pragma] |
| /// <li> the [changes() SQL function] |
| /// <li> the [data_version pragma] |
| /// <li> the [SQLITE_FCNTL_DATA_VERSION] [file control] |
| /// </ul> |
| int sqlite3_total_changes( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_total_changes( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_total_changesPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_total_changes'); |
| late final _sqlite3_total_changes = _sqlite3_total_changesPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3>)>(); |
| |
| /// CAPI3REF: Interrupt A Long-Running Query |
| /// METHOD: sqlite3 |
| /// |
| /// ^This function causes any pending database operation to abort and |
| /// return at its earliest opportunity. This routine is typically |
| /// called in response to a user action such as pressing "Cancel" |
| /// or Ctrl-C where the user wants a long query operation to halt |
| /// immediately. |
| /// |
| /// ^It is safe to call this routine from a thread different from the |
| /// thread that is currently running the database operation. But it |
| /// is not safe to call this routine with a [database connection] that |
| /// is closed or might close before sqlite3_interrupt() returns. |
| /// |
| /// ^If an SQL operation is very nearly finished at the time when |
| /// sqlite3_interrupt() is called, then it might not have an opportunity |
| /// to be interrupted and might continue to completion. |
| /// |
| /// ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. |
| /// ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE |
| /// that is inside an explicit transaction, then the entire transaction |
| /// will be rolled back automatically. |
| /// |
| /// ^The sqlite3_interrupt(D) call is in effect until all currently running |
| /// SQL statements on [database connection] D complete. ^Any new SQL statements |
| /// that are started after the sqlite3_interrupt() call and before the |
| /// running statement count reaches zero are interrupted as if they had been |
| /// running prior to the sqlite3_interrupt() call. ^New SQL statements |
| /// that are started after the running statement count reaches zero are |
| /// not effected by the sqlite3_interrupt(). |
| /// ^A call to sqlite3_interrupt(D) that occurs when there are no running |
| /// SQL statements is a no-op and has no effect on SQL statements |
| /// that are started after the sqlite3_interrupt() call returns. |
| void sqlite3_interrupt( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_interrupt( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_interruptPtr = |
| _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_interrupt'); |
| late final _sqlite3_interrupt = |
| _sqlite3_interruptPtr.asFunction<void Function(ffi.Pointer<sqlite3>)>(); |
| |
| /// CAPI3REF: Determine If An SQL Statement Is Complete |
| /// |
| /// These routines are useful during command-line input to determine if the |
| /// currently entered text seems to form a complete SQL statement or |
| /// if additional input is needed before sending the text into |
| /// SQLite for parsing. ^These routines return 1 if the input string |
| /// appears to be a complete SQL statement. ^A statement is judged to be |
| /// complete if it ends with a semicolon token and is not a prefix of a |
| /// well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within |
| /// string literals or quoted identifier names or comments are not |
| /// independent tokens (they are part of the token in which they are |
| /// embedded) and thus do not count as a statement terminator. ^Whitespace |
| /// and comments that follow the final semicolon are ignored. |
| /// |
| /// ^These routines return 0 if the statement is incomplete. ^If a |
| /// memory allocation fails, then SQLITE_NOMEM is returned. |
| /// |
| /// ^These routines do not parse the SQL statements thus |
| /// will not detect syntactically incorrect SQL. |
| /// |
| /// ^(If SQLite has not been initialized using [sqlite3_initialize()] prior |
| /// to invoking sqlite3_complete16() then sqlite3_initialize() is invoked |
| /// automatically by sqlite3_complete16(). If that initialization fails, |
| /// then the return value from sqlite3_complete16() will be non-zero |
| /// regardless of whether or not the input SQL is complete.)^ |
| /// |
| /// The input to [sqlite3_complete()] must be a zero-terminated |
| /// UTF-8 string. |
| /// |
| /// The input to [sqlite3_complete16()] must be a zero-terminated |
| /// UTF-16 string in native byte order. |
| int sqlite3_complete( |
| ffi.Pointer<ffi.Char> sql, |
| ) { |
| return _sqlite3_complete( |
| sql, |
| ); |
| } |
| |
| late final _sqlite3_completePtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Char>)>>( |
| 'sqlite3_complete'); |
| late final _sqlite3_complete = |
| _sqlite3_completePtr.asFunction<int Function(ffi.Pointer<ffi.Char>)>(); |
| |
| int sqlite3_complete16( |
| ffi.Pointer<ffi.Void> sql, |
| ) { |
| return _sqlite3_complete16( |
| sql, |
| ); |
| } |
| |
| late final _sqlite3_complete16Ptr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>)>>( |
| 'sqlite3_complete16'); |
| late final _sqlite3_complete16 = |
| _sqlite3_complete16Ptr.asFunction<int Function(ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors |
| /// KEYWORDS: {busy-handler callback} {busy handler} |
| /// METHOD: sqlite3 |
| /// |
| /// ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X |
| /// that might be invoked with argument P whenever |
| /// an attempt is made to access a database table associated with |
| /// [database connection] D when another thread |
| /// or process has the table locked. |
| /// The sqlite3_busy_handler() interface is used to implement |
| /// [sqlite3_busy_timeout()] and [PRAGMA busy_timeout]. |
| /// |
| /// ^If the busy callback is NULL, then [SQLITE_BUSY] |
| /// is returned immediately upon encountering the lock. ^If the busy callback |
| /// is not NULL, then the callback might be invoked with two arguments. |
| /// |
| /// ^The first argument to the busy handler is a copy of the void* pointer which |
| /// is the third argument to sqlite3_busy_handler(). ^The second argument to |
| /// the busy handler callback is the number of times that the busy handler has |
| /// been invoked previously for the same locking event. ^If the |
| /// busy callback returns 0, then no additional attempts are made to |
| /// access the database and [SQLITE_BUSY] is returned |
| /// to the application. |
| /// ^If the callback returns non-zero, then another attempt |
| /// is made to access the database and the cycle repeats. |
| /// |
| /// The presence of a busy handler does not guarantee that it will be invoked |
| /// when there is lock contention. ^If SQLite determines that invoking the busy |
| /// handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] |
| /// to the application instead of invoking the |
| /// busy handler. |
| /// Consider a scenario where one process is holding a read lock that |
| /// it is trying to promote to a reserved lock and |
| /// a second process is holding a reserved lock that it is trying |
| /// to promote to an exclusive lock. The first process cannot proceed |
| /// because it is blocked by the second and the second process cannot |
| /// proceed because it is blocked by the first. If both processes |
| /// invoke the busy handlers, neither will make any progress. Therefore, |
| /// SQLite returns [SQLITE_BUSY] for the first process, hoping that this |
| /// will induce the first process to release its read lock and allow |
| /// the second process to proceed. |
| /// |
| /// ^The default busy callback is NULL. |
| /// |
| /// ^(There can only be a single busy handler defined for each |
| /// [database connection]. Setting a new busy handler clears any |
| /// previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] |
| /// or evaluating [PRAGMA busy_timeout=N] will change the |
| /// busy handler and thus clear any previously set busy handler. |
| /// |
| /// The busy callback should not take any actions which modify the |
| /// database connection that invoked the busy handler. In other words, |
| /// the busy handler is not reentrant. Any such actions |
| /// result in undefined behavior. |
| /// |
| /// A busy handler must not close the database connection |
| /// or [prepared statement] that invoked the busy handler. |
| int sqlite3_busy_handler( |
| ffi.Pointer<sqlite3> arg0, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.Pointer<ffi.Void>, ffi.Int)>> |
| arg1, |
| ffi.Pointer<ffi.Void> arg2, |
| ) { |
| return _sqlite3_busy_handler( |
| arg0, |
| arg1, |
| arg2, |
| ); |
| } |
| |
| late final _sqlite3_busy_handlerPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.Pointer<ffi.Void>, ffi.Int)>>, |
| ffi.Pointer<ffi.Void>)>>('sqlite3_busy_handler'); |
| late final _sqlite3_busy_handler = _sqlite3_busy_handlerPtr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.Pointer<ffi.Void>, ffi.Int)>>, |
| ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: Set A Busy Timeout |
| /// METHOD: sqlite3 |
| /// |
| /// ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps |
| /// for a specified amount of time when a table is locked. ^The handler |
| /// will sleep multiple times until at least "ms" milliseconds of sleeping |
| /// have accumulated. ^After at least "ms" milliseconds of sleeping, |
| /// the handler returns 0 which causes [sqlite3_step()] to return |
| /// [SQLITE_BUSY]. |
| /// |
| /// ^Calling this routine with an argument less than or equal to zero |
| /// turns off all busy handlers. |
| /// |
| /// ^(There can only be a single busy handler for a particular |
| /// [database connection] at any given moment. If another busy handler |
| /// was defined (using [sqlite3_busy_handler()]) prior to calling |
| /// this routine, that other busy handler is cleared.)^ |
| /// |
| /// See also: [PRAGMA busy_timeout] |
| int sqlite3_busy_timeout( |
| ffi.Pointer<sqlite3> arg0, |
| int ms, |
| ) { |
| return _sqlite3_busy_timeout( |
| arg0, |
| ms, |
| ); |
| } |
| |
| late final _sqlite3_busy_timeoutPtr = _lookup< |
| ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>, ffi.Int)>>( |
| 'sqlite3_busy_timeout'); |
| late final _sqlite3_busy_timeout = _sqlite3_busy_timeoutPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3>, int)>(); |
| |
| /// CAPI3REF: Convenience Routines For Running Queries |
| /// METHOD: sqlite3 |
| /// |
| /// This is a legacy interface that is preserved for backwards compatibility. |
| /// Use of this interface is not recommended. |
| /// |
| /// Definition: A <b>result table</b> is memory data structure created by the |
| /// [sqlite3_get_table()] interface. A result table records the |
| /// complete query results from one or more queries. |
| /// |
| /// The table conceptually has a number of rows and columns. But |
| /// these numbers are not part of the result table itself. These |
| /// numbers are obtained separately. Let N be the number of rows |
| /// and M be the number of columns. |
| /// |
| /// A result table is an array of pointers to zero-terminated UTF-8 strings. |
| /// There are (N+1)*M elements in the array. The first M pointers point |
| /// to zero-terminated strings that contain the names of the columns. |
| /// The remaining entries all point to query results. NULL values result |
| /// in NULL pointers. All other values are in their UTF-8 zero-terminated |
| /// string representation as returned by [sqlite3_column_text()]. |
| /// |
| /// A result table might consist of one or more memory allocations. |
| /// It is not safe to pass a result table directly to [sqlite3_free()]. |
| /// A result table should be deallocated using [sqlite3_free_table()]. |
| /// |
| /// ^(As an example of the result table format, suppose a query result |
| /// is as follows: |
| /// |
| /// <blockquote><pre> |
| /// Name | Age |
| /// ----------------------- |
| /// Alice | 43 |
| /// Bob | 28 |
| /// Cindy | 21 |
| /// </pre></blockquote> |
| /// |
| /// There are two columns (M==2) and three rows (N==3). Thus the |
| /// result table has 8 entries. Suppose the result table is stored |
| /// in an array named azResult. Then azResult holds this content: |
| /// |
| /// <blockquote><pre> |
| /// azResult[0] = "Name"; |
| /// azResult[1] = "Age"; |
| /// azResult[2] = "Alice"; |
| /// azResult[3] = "43"; |
| /// azResult[4] = "Bob"; |
| /// azResult[5] = "28"; |
| /// azResult[6] = "Cindy"; |
| /// azResult[7] = "21"; |
| /// </pre></blockquote>)^ |
| /// |
| /// ^The sqlite3_get_table() function evaluates one or more |
| /// semicolon-separated SQL statements in the zero-terminated UTF-8 |
| /// string of its 2nd parameter and returns a result table to the |
| /// pointer given in its 3rd parameter. |
| /// |
| /// After the application has finished with the result from sqlite3_get_table(), |
| /// it must pass the result table pointer to sqlite3_free_table() in order to |
| /// release the memory that was malloced. Because of the way the |
| /// [sqlite3_malloc()] happens within sqlite3_get_table(), the calling |
| /// function must not try to call [sqlite3_free()] directly. Only |
| /// [sqlite3_free_table()] is able to release the memory properly and safely. |
| /// |
| /// The sqlite3_get_table() interface is implemented as a wrapper around |
| /// [sqlite3_exec()]. The sqlite3_get_table() routine does not have access |
| /// to any internal data structures of SQLite. It uses only the public |
| /// interface defined here. As a consequence, errors that occur in the |
| /// wrapper layer outside of the internal [sqlite3_exec()] call are not |
| /// reflected in subsequent calls to [sqlite3_errcode()] or |
| /// [sqlite3_errmsg()]. |
| int sqlite3_get_table( |
| ffi.Pointer<sqlite3> db, |
| ffi.Pointer<ffi.Char> zSql, |
| ffi.Pointer<ffi.Pointer<ffi.Pointer<ffi.Char>>> pazResult, |
| ffi.Pointer<ffi.Int> pnRow, |
| ffi.Pointer<ffi.Int> pnColumn, |
| ffi.Pointer<ffi.Pointer<ffi.Char>> pzErrmsg, |
| ) { |
| return _sqlite3_get_table( |
| db, |
| zSql, |
| pazResult, |
| pnRow, |
| pnColumn, |
| pzErrmsg, |
| ); |
| } |
| |
| late final _sqlite3_get_tablePtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Pointer<ffi.Pointer<ffi.Char>>>, |
| ffi.Pointer<ffi.Int>, |
| ffi.Pointer<ffi.Int>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('sqlite3_get_table'); |
| late final _sqlite3_get_table = _sqlite3_get_tablePtr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Pointer<ffi.Pointer<ffi.Char>>>, |
| ffi.Pointer<ffi.Int>, |
| ffi.Pointer<ffi.Int>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>(); |
| |
| void sqlite3_free_table( |
| ffi.Pointer<ffi.Pointer<ffi.Char>> result, |
| ) { |
| return _sqlite3_free_table( |
| result, |
| ); |
| } |
| |
| late final _sqlite3_free_tablePtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('sqlite3_free_table'); |
| late final _sqlite3_free_table = _sqlite3_free_tablePtr |
| .asFunction<void Function(ffi.Pointer<ffi.Pointer<ffi.Char>>)>(); |
| |
| /// CAPI3REF: Formatted String Printing Functions |
| /// |
| /// These routines are work-alikes of the "printf()" family of functions |
| /// from the standard C library. |
| /// These routines understand most of the common formatting options from |
| /// the standard library printf() |
| /// plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]). |
| /// See the [built-in printf()] documentation for details. |
| /// |
| /// ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their |
| /// results into memory obtained from [sqlite3_malloc64()]. |
| /// The strings returned by these two routines should be |
| /// released by [sqlite3_free()]. ^Both routines return a |
| /// NULL pointer if [sqlite3_malloc64()] is unable to allocate enough |
| /// memory to hold the resulting string. |
| /// |
| /// ^(The sqlite3_snprintf() routine is similar to "snprintf()" from |
| /// the standard C library. The result is written into the |
| /// buffer supplied as the second parameter whose size is given by |
| /// the first parameter. Note that the order of the |
| /// first two parameters is reversed from snprintf().)^ This is an |
| /// historical accident that cannot be fixed without breaking |
| /// backwards compatibility. ^(Note also that sqlite3_snprintf() |
| /// returns a pointer to its buffer instead of the number of |
| /// characters actually written into the buffer.)^ We admit that |
| /// the number of characters written would be a more useful return |
| /// value but we cannot change the implementation of sqlite3_snprintf() |
| /// now without breaking compatibility. |
| /// |
| /// ^As long as the buffer size is greater than zero, sqlite3_snprintf() |
| /// guarantees that the buffer is always zero-terminated. ^The first |
| /// parameter "n" is the total size of the buffer, including space for |
| /// the zero terminator. So the longest string that can be completely |
| /// written will be n-1 characters. |
| /// |
| /// ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). |
| /// |
| /// See also: [built-in printf()], [printf() SQL function] |
| ffi.Pointer<ffi.Char> sqlite3_mprintf( |
| ffi.Pointer<ffi.Char> arg0, |
| ) { |
| return _sqlite3_mprintf( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_mprintfPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>)>>('sqlite3_mprintf'); |
| late final _sqlite3_mprintf = _sqlite3_mprintfPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_snprintf( |
| int arg0, |
| ffi.Pointer<ffi.Char> arg1, |
| ffi.Pointer<ffi.Char> arg2, |
| ) { |
| return _sqlite3_snprintf( |
| arg0, |
| arg1, |
| arg2, |
| ); |
| } |
| |
| late final _sqlite3_snprintfPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function(ffi.Int, ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>)>>('sqlite3_snprintf'); |
| late final _sqlite3_snprintf = _sqlite3_snprintfPtr.asFunction< |
| ffi.Pointer<ffi.Char> Function( |
| int, ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>(); |
| |
| /// CAPI3REF: Memory Allocation Subsystem |
| /// |
| /// The SQLite core uses these three routines for all of its own |
| /// internal memory allocation needs. "Core" in the previous sentence |
| /// does not include operating-system specific [VFS] implementation. The |
| /// Windows VFS uses native malloc() and free() for some operations. |
| /// |
| /// ^The sqlite3_malloc() routine returns a pointer to a block |
| /// of memory at least N bytes in length, where N is the parameter. |
| /// ^If sqlite3_malloc() is unable to obtain sufficient free |
| /// memory, it returns a NULL pointer. ^If the parameter N to |
| /// sqlite3_malloc() is zero or negative then sqlite3_malloc() returns |
| /// a NULL pointer. |
| /// |
| /// ^The sqlite3_malloc64(N) routine works just like |
| /// sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead |
| /// of a signed 32-bit integer. |
| /// |
| /// ^Calling sqlite3_free() with a pointer previously returned |
| /// by sqlite3_malloc() or sqlite3_realloc() releases that memory so |
| /// that it might be reused. ^The sqlite3_free() routine is |
| /// a no-op if is called with a NULL pointer. Passing a NULL pointer |
| /// to sqlite3_free() is harmless. After being freed, memory |
| /// should neither be read nor written. Even reading previously freed |
| /// memory might result in a segmentation fault or other severe error. |
| /// Memory corruption, a segmentation fault, or other severe error |
| /// might result if sqlite3_free() is called with a non-NULL pointer that |
| /// was not obtained from sqlite3_malloc() or sqlite3_realloc(). |
| /// |
| /// ^The sqlite3_realloc(X,N) interface attempts to resize a |
| /// prior memory allocation X to be at least N bytes. |
| /// ^If the X parameter to sqlite3_realloc(X,N) |
| /// is a NULL pointer then its behavior is identical to calling |
| /// sqlite3_malloc(N). |
| /// ^If the N parameter to sqlite3_realloc(X,N) is zero or |
| /// negative then the behavior is exactly the same as calling |
| /// sqlite3_free(X). |
| /// ^sqlite3_realloc(X,N) returns a pointer to a memory allocation |
| /// of at least N bytes in size or NULL if insufficient memory is available. |
| /// ^If M is the size of the prior allocation, then min(N,M) bytes |
| /// of the prior allocation are copied into the beginning of buffer returned |
| /// by sqlite3_realloc(X,N) and the prior allocation is freed. |
| /// ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the |
| /// prior allocation is not freed. |
| /// |
| /// ^The sqlite3_realloc64(X,N) interfaces works the same as |
| /// sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead |
| /// of a 32-bit signed integer. |
| /// |
| /// ^If X is a memory allocation previously obtained from sqlite3_malloc(), |
| /// sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then |
| /// sqlite3_msize(X) returns the size of that memory allocation in bytes. |
| /// ^The value returned by sqlite3_msize(X) might be larger than the number |
| /// of bytes requested when X was allocated. ^If X is a NULL pointer then |
| /// sqlite3_msize(X) returns zero. If X points to something that is not |
| /// the beginning of memory allocation, or if it points to a formerly |
| /// valid memory allocation that has now been freed, then the behavior |
| /// of sqlite3_msize(X) is undefined and possibly harmful. |
| /// |
| /// ^The memory returned by sqlite3_malloc(), sqlite3_realloc(), |
| /// sqlite3_malloc64(), and sqlite3_realloc64() |
| /// is always aligned to at least an 8 byte boundary, or to a |
| /// 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time |
| /// option is used. |
| /// |
| /// The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] |
| /// must be either NULL or else pointers obtained from a prior |
| /// invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have |
| /// not yet been released. |
| /// |
| /// The application must not read or write any part of |
| /// a block of memory after it has been released using |
| /// [sqlite3_free()] or [sqlite3_realloc()]. |
| ffi.Pointer<ffi.Void> sqlite3_malloc( |
| int arg0, |
| ) { |
| return _sqlite3_malloc( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_mallocPtr = |
| _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(ffi.Int)>>( |
| 'sqlite3_malloc'); |
| late final _sqlite3_malloc = |
| _sqlite3_mallocPtr.asFunction<ffi.Pointer<ffi.Void> Function(int)>(); |
| |
| ffi.Pointer<ffi.Void> sqlite3_malloc64( |
| int arg0, |
| ) { |
| return _sqlite3_malloc64( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_malloc64Ptr = _lookup< |
| ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(sqlite3_uint64)>>( |
| 'sqlite3_malloc64'); |
| late final _sqlite3_malloc64 = |
| _sqlite3_malloc64Ptr.asFunction<ffi.Pointer<ffi.Void> Function(int)>(); |
| |
| ffi.Pointer<ffi.Void> sqlite3_realloc( |
| ffi.Pointer<ffi.Void> arg0, |
| int arg1, |
| ) { |
| return _sqlite3_realloc( |
| arg0, |
| arg1, |
| ); |
| } |
| |
| late final _sqlite3_reallocPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Void> Function( |
| ffi.Pointer<ffi.Void>, ffi.Int)>>('sqlite3_realloc'); |
| late final _sqlite3_realloc = _sqlite3_reallocPtr |
| .asFunction<ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>, int)>(); |
| |
| ffi.Pointer<ffi.Void> sqlite3_realloc64( |
| ffi.Pointer<ffi.Void> arg0, |
| int arg1, |
| ) { |
| return _sqlite3_realloc64( |
| arg0, |
| arg1, |
| ); |
| } |
| |
| late final _sqlite3_realloc64Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Void> Function( |
| ffi.Pointer<ffi.Void>, sqlite3_uint64)>>('sqlite3_realloc64'); |
| late final _sqlite3_realloc64 = _sqlite3_realloc64Ptr |
| .asFunction<ffi.Pointer<ffi.Void> Function(ffi.Pointer<ffi.Void>, int)>(); |
| |
| void sqlite3_free( |
| ffi.Pointer<ffi.Void> arg0, |
| ) { |
| return _sqlite3_free( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_freePtr = |
| _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>( |
| 'sqlite3_free'); |
| late final _sqlite3_free = |
| _sqlite3_freePtr.asFunction<void Function(ffi.Pointer<ffi.Void>)>(); |
| |
| int sqlite3_msize( |
| ffi.Pointer<ffi.Void> arg0, |
| ) { |
| return _sqlite3_msize( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_msizePtr = _lookup< |
| ffi.NativeFunction<sqlite3_uint64 Function(ffi.Pointer<ffi.Void>)>>( |
| 'sqlite3_msize'); |
| late final _sqlite3_msize = |
| _sqlite3_msizePtr.asFunction<int Function(ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: Memory Allocator Statistics |
| /// |
| /// SQLite provides these two interfaces for reporting on the status |
| /// of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] |
| /// routines, which form the built-in memory allocation subsystem. |
| /// |
| /// ^The [sqlite3_memory_used()] routine returns the number of bytes |
| /// of memory currently outstanding (malloced but not freed). |
| /// ^The [sqlite3_memory_highwater()] routine returns the maximum |
| /// value of [sqlite3_memory_used()] since the high-water mark |
| /// was last reset. ^The values returned by [sqlite3_memory_used()] and |
| /// [sqlite3_memory_highwater()] include any overhead |
| /// added by SQLite in its implementation of [sqlite3_malloc()], |
| /// but not overhead added by the any underlying system library |
| /// routines that [sqlite3_malloc()] may call. |
| /// |
| /// ^The memory high-water mark is reset to the current value of |
| /// [sqlite3_memory_used()] if and only if the parameter to |
| /// [sqlite3_memory_highwater()] is true. ^The value returned |
| /// by [sqlite3_memory_highwater(1)] is the high-water mark |
| /// prior to the reset. |
| int sqlite3_memory_used() { |
| return _sqlite3_memory_used(); |
| } |
| |
| late final _sqlite3_memory_usedPtr = |
| _lookup<ffi.NativeFunction<sqlite3_int64 Function()>>( |
| 'sqlite3_memory_used'); |
| late final _sqlite3_memory_used = |
| _sqlite3_memory_usedPtr.asFunction<int Function()>(); |
| |
| int sqlite3_memory_highwater( |
| int resetFlag, |
| ) { |
| return _sqlite3_memory_highwater( |
| resetFlag, |
| ); |
| } |
| |
| late final _sqlite3_memory_highwaterPtr = |
| _lookup<ffi.NativeFunction<sqlite3_int64 Function(ffi.Int)>>( |
| 'sqlite3_memory_highwater'); |
| late final _sqlite3_memory_highwater = |
| _sqlite3_memory_highwaterPtr.asFunction<int Function(int)>(); |
| |
| /// CAPI3REF: Pseudo-Random Number Generator |
| /// |
| /// SQLite contains a high-quality pseudo-random number generator (PRNG) used to |
| /// select random [ROWID | ROWIDs] when inserting new records into a table that |
| /// already uses the largest possible [ROWID]. The PRNG is also used for |
| /// the built-in random() and randomblob() SQL functions. This interface allows |
| /// applications to access the same PRNG for other purposes. |
| /// |
| /// ^A call to this routine stores N bytes of randomness into buffer P. |
| /// ^The P parameter can be a NULL pointer. |
| /// |
| /// ^If this routine has not been previously called or if the previous |
| /// call had N less than one or a NULL pointer for P, then the PRNG is |
| /// seeded using randomness obtained from the xRandomness method of |
| /// the default [sqlite3_vfs] object. |
| /// ^If the previous call to this routine had an N of 1 or more and a |
| /// non-NULL P then the pseudo-randomness is generated |
| /// internally and without recourse to the [sqlite3_vfs] xRandomness |
| /// method. |
| void sqlite3_randomness( |
| int N, |
| ffi.Pointer<ffi.Void> P, |
| ) { |
| return _sqlite3_randomness( |
| N, |
| P, |
| ); |
| } |
| |
| late final _sqlite3_randomnessPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Int, ffi.Pointer<ffi.Void>)>>('sqlite3_randomness'); |
| late final _sqlite3_randomness = _sqlite3_randomnessPtr |
| .asFunction<void Function(int, ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: Compile-Time Authorization Callbacks |
| /// METHOD: sqlite3 |
| /// KEYWORDS: {authorizer callback} |
| /// |
| /// ^This routine registers an authorizer callback with a particular |
| /// [database connection], supplied in the first argument. |
| /// ^The authorizer callback is invoked as SQL statements are being compiled |
| /// by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], |
| /// [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()], |
| /// and [sqlite3_prepare16_v3()]. ^At various |
| /// points during the compilation process, as logic is being created |
| /// to perform various actions, the authorizer callback is invoked to |
| /// see if those actions are allowed. ^The authorizer callback should |
| /// return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the |
| /// specific action but allow the SQL statement to continue to be |
| /// compiled, or [SQLITE_DENY] to cause the entire SQL statement to be |
| /// rejected with an error. ^If the authorizer callback returns |
| /// any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] |
| /// then the [sqlite3_prepare_v2()] or equivalent call that triggered |
| /// the authorizer will fail with an error message. |
| /// |
| /// When the callback returns [SQLITE_OK], that means the operation |
| /// requested is ok. ^When the callback returns [SQLITE_DENY], the |
| /// [sqlite3_prepare_v2()] or equivalent call that triggered the |
| /// authorizer will fail with an error message explaining that |
| /// access is denied. |
| /// |
| /// ^The first parameter to the authorizer callback is a copy of the third |
| /// parameter to the sqlite3_set_authorizer() interface. ^The second parameter |
| /// to the callback is an integer [SQLITE_COPY | action code] that specifies |
| /// the particular action to be authorized. ^The third through sixth parameters |
| /// to the callback are either NULL pointers or zero-terminated strings |
| /// that contain additional details about the action to be authorized. |
| /// Applications must always be prepared to encounter a NULL pointer in any |
| /// of the third through the sixth parameters of the authorization callback. |
| /// |
| /// ^If the action code is [SQLITE_READ] |
| /// and the callback returns [SQLITE_IGNORE] then the |
| /// [prepared statement] statement is constructed to substitute |
| /// a NULL value in place of the table column that would have |
| /// been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] |
| /// return can be used to deny an untrusted user access to individual |
| /// columns of a table. |
| /// ^When a table is referenced by a [SELECT] but no column values are |
| /// extracted from that table (for example in a query like |
| /// "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback |
| /// is invoked once for that table with a column name that is an empty string. |
| /// ^If the action code is [SQLITE_DELETE] and the callback returns |
| /// [SQLITE_IGNORE] then the [DELETE] operation proceeds but the |
| /// [truncate optimization] is disabled and all rows are deleted individually. |
| /// |
| /// An authorizer is used when [sqlite3_prepare | preparing] |
| /// SQL statements from an untrusted source, to ensure that the SQL statements |
| /// do not try to access data they are not allowed to see, or that they do not |
| /// try to execute malicious statements that damage the database. For |
| /// example, an application may allow a user to enter arbitrary |
| /// SQL queries for evaluation by a database. But the application does |
| /// not want the user to be able to make arbitrary changes to the |
| /// database. An authorizer could then be put in place while the |
| /// user-entered SQL is being [sqlite3_prepare | prepared] that |
| /// disallows everything except [SELECT] statements. |
| /// |
| /// Applications that need to process SQL from untrusted sources |
| /// might also consider lowering resource limits using [sqlite3_limit()] |
| /// and limiting database size using the [max_page_count] [PRAGMA] |
| /// in addition to using an authorizer. |
| /// |
| /// ^(Only a single authorizer can be in place on a database connection |
| /// at a time. Each call to sqlite3_set_authorizer overrides the |
| /// previous call.)^ ^Disable the authorizer by installing a NULL callback. |
| /// The authorizer is disabled by default. |
| /// |
| /// The authorizer callback must not do anything that will modify |
| /// the database connection that invoked the authorizer callback. |
| /// Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| /// database connections for the meaning of "modify" in this paragraph. |
| /// |
| /// ^When [sqlite3_prepare_v2()] is used to prepare a statement, the |
| /// statement might be re-prepared during [sqlite3_step()] due to a |
| /// schema change. Hence, the application should ensure that the |
| /// correct authorizer callback remains in place during the [sqlite3_step()]. |
| /// |
| /// ^Note that the authorizer callback is invoked only during |
| /// [sqlite3_prepare()] or its variants. Authorization is not |
| /// performed during statement evaluation in [sqlite3_step()], unless |
| /// as stated in the previous paragraph, sqlite3_step() invokes |
| /// sqlite3_prepare_v2() to reprepare a statement after a schema change. |
| int sqlite3_set_authorizer( |
| ffi.Pointer<sqlite3> arg0, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>)>> |
| xAuth, |
| ffi.Pointer<ffi.Void> pUserData, |
| ) { |
| return _sqlite3_set_authorizer( |
| arg0, |
| xAuth, |
| pUserData, |
| ); |
| } |
| |
| late final _sqlite3_set_authorizerPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>)>>, |
| ffi.Pointer<ffi.Void>)>>('sqlite3_set_authorizer'); |
| late final _sqlite3_set_authorizer = _sqlite3_set_authorizerPtr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>)>>, |
| ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: Tracing And Profiling Functions |
| /// METHOD: sqlite3 |
| /// |
| /// These routines are deprecated. Use the [sqlite3_trace_v2()] interface |
| /// instead of the routines described here. |
| /// |
| /// These routines register callback functions that can be used for |
| /// tracing and profiling the execution of SQL statements. |
| /// |
| /// ^The callback function registered by sqlite3_trace() is invoked at |
| /// various times when an SQL statement is being run by [sqlite3_step()]. |
| /// ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the |
| /// SQL statement text as the statement first begins executing. |
| /// ^(Additional sqlite3_trace() callbacks might occur |
| /// as each triggered subprogram is entered. The callbacks for triggers |
| /// contain a UTF-8 SQL comment that identifies the trigger.)^ |
| /// |
| /// The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit |
| /// the length of [bound parameter] expansion in the output of sqlite3_trace(). |
| /// |
| /// ^The callback function registered by sqlite3_profile() is invoked |
| /// as each SQL statement finishes. ^The profile callback contains |
| /// the original statement text and an estimate of wall-clock time |
| /// of how long that statement took to run. ^The profile callback |
| /// time is in units of nanoseconds, however the current implementation |
| /// is only capable of millisecond resolution so the six least significant |
| /// digits in the time are meaningless. Future versions of SQLite |
| /// might provide greater resolution on the profiler callback. Invoking |
| /// either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the |
| /// profile callback. |
| ffi.Pointer<ffi.Void> sqlite3_trace( |
| ffi.Pointer<sqlite3> arg0, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>> |
| xTrace, |
| ffi.Pointer<ffi.Void> arg2, |
| ) { |
| return _sqlite3_trace( |
| arg0, |
| xTrace, |
| arg2, |
| ); |
| } |
| |
| late final _sqlite3_tracePtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Void> Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>>, |
| ffi.Pointer<ffi.Void>)>>('sqlite3_trace'); |
| late final _sqlite3_trace = _sqlite3_tracePtr.asFunction< |
| ffi.Pointer<ffi.Void> Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>)>>, |
| ffi.Pointer<ffi.Void>)>(); |
| |
| ffi.Pointer<ffi.Void> sqlite3_profile( |
| ffi.Pointer<sqlite3> arg0, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Char>, |
| sqlite3_uint64)>> |
| xProfile, |
| ffi.Pointer<ffi.Void> arg2, |
| ) { |
| return _sqlite3_profile( |
| arg0, |
| xProfile, |
| arg2, |
| ); |
| } |
| |
| late final _sqlite3_profilePtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Void> Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function(ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Char>, sqlite3_uint64)>>, |
| ffi.Pointer<ffi.Void>)>>('sqlite3_profile'); |
| late final _sqlite3_profile = _sqlite3_profilePtr.asFunction< |
| ffi.Pointer<ffi.Void> Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function(ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Char>, sqlite3_uint64)>>, |
| ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: SQL Trace Hook |
| /// METHOD: sqlite3 |
| /// |
| /// ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback |
| /// function X against [database connection] D, using property mask M |
| /// and context pointer P. ^If the X callback is |
| /// NULL or if the M mask is zero, then tracing is disabled. The |
| /// M argument should be the bitwise OR-ed combination of |
| /// zero or more [SQLITE_TRACE] constants. |
| /// |
| /// ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides |
| /// (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). |
| /// |
| /// ^The X callback is invoked whenever any of the events identified by |
| /// mask M occur. ^The integer return value from the callback is currently |
| /// ignored, though this may change in future releases. Callback |
| /// implementations should return zero to ensure future compatibility. |
| /// |
| /// ^A trace callback is invoked with four arguments: callback(T,C,P,X). |
| /// ^The T argument is one of the [SQLITE_TRACE] |
| /// constants to indicate why the callback was invoked. |
| /// ^The C argument is a copy of the context pointer. |
| /// The P and X arguments are pointers whose meanings depend on T. |
| /// |
| /// The sqlite3_trace_v2() interface is intended to replace the legacy |
| /// interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which |
| /// are deprecated. |
| int sqlite3_trace_v2( |
| ffi.Pointer<sqlite3> arg0, |
| int uMask, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.UnsignedInt, ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>> |
| xCallback, |
| ffi.Pointer<ffi.Void> pCtx, |
| ) { |
| return _sqlite3_trace_v2( |
| arg0, |
| uMask, |
| xCallback, |
| pCtx, |
| ); |
| } |
| |
| late final _sqlite3_trace_v2Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.UnsignedInt, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.UnsignedInt, ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>, |
| ffi.Pointer<ffi.Void>)>>('sqlite3_trace_v2'); |
| late final _sqlite3_trace_v2 = _sqlite3_trace_v2Ptr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| int, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.UnsignedInt, ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>)>>, |
| ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: Query Progress Callbacks |
| /// METHOD: sqlite3 |
| /// |
| /// ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback |
| /// function X to be invoked periodically during long running calls to |
| /// [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for |
| /// database connection D. An example use for this |
| /// interface is to keep a GUI updated during a large query. |
| /// |
| /// ^The parameter P is passed through as the only parameter to the |
| /// callback function X. ^The parameter N is the approximate number of |
| /// [virtual machine instructions] that are evaluated between successive |
| /// invocations of the callback X. ^If N is less than one then the progress |
| /// handler is disabled. |
| /// |
| /// ^Only a single progress handler may be defined at one time per |
| /// [database connection]; setting a new progress handler cancels the |
| /// old one. ^Setting parameter X to NULL disables the progress handler. |
| /// ^The progress handler is also disabled by setting N to a value less |
| /// than 1. |
| /// |
| /// ^If the progress callback returns non-zero, the operation is |
| /// interrupted. This feature can be used to implement a |
| /// "Cancel" button on a GUI progress dialog box. |
| /// |
| /// The progress handler callback must not do anything that will modify |
| /// the database connection that invoked the progress handler. |
| /// Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| /// database connections for the meaning of "modify" in this paragraph. |
| void sqlite3_progress_handler( |
| ffi.Pointer<sqlite3> arg0, |
| int arg1, |
| ffi.Pointer<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>)>> |
| arg2, |
| ffi.Pointer<ffi.Void> arg3, |
| ) { |
| return _sqlite3_progress_handler( |
| arg0, |
| arg1, |
| arg2, |
| arg3, |
| ); |
| } |
| |
| late final _sqlite3_progress_handlerPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Int, |
| ffi.Pointer< |
| ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>)>>, |
| ffi.Pointer<ffi.Void>)>>('sqlite3_progress_handler'); |
| late final _sqlite3_progress_handler = |
| _sqlite3_progress_handlerPtr.asFunction< |
| void Function( |
| ffi.Pointer<sqlite3>, |
| int, |
| ffi.Pointer< |
| ffi.NativeFunction<ffi.Int Function(ffi.Pointer<ffi.Void>)>>, |
| ffi.Pointer<ffi.Void>)>(); |
| |
| /// CAPI3REF: Opening A New Database Connection |
| /// CONSTRUCTOR: sqlite3 |
| /// |
| /// ^These routines open an SQLite database file as specified by the |
| /// filename argument. ^The filename argument is interpreted as UTF-8 for |
| /// sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte |
| /// order for sqlite3_open16(). ^(A [database connection] handle is usually |
| /// returned in *ppDb, even if an error occurs. The only exception is that |
| /// if SQLite is unable to allocate memory to hold the [sqlite3] object, |
| /// a NULL will be written into *ppDb instead of a pointer to the [sqlite3] |
| /// object.)^ ^(If the database is opened (and/or created) successfully, then |
| /// [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The |
| /// [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain |
| /// an English language description of the error following a failure of any |
| /// of the sqlite3_open() routines. |
| /// |
| /// ^The default encoding will be UTF-8 for databases created using |
| /// sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases |
| /// created using sqlite3_open16() will be UTF-16 in the native byte order. |
| /// |
| /// Whether or not an error occurs when it is opened, resources |
| /// associated with the [database connection] handle should be released by |
| /// passing it to [sqlite3_close()] when it is no longer required. |
| /// |
| /// The sqlite3_open_v2() interface works like sqlite3_open() |
| /// except that it accepts two additional parameters for additional control |
| /// over the new database connection. ^(The flags parameter to |
| /// sqlite3_open_v2() must include, at a minimum, one of the following |
| /// three flag combinations:)^ |
| /// |
| /// <dl> |
| /// ^(<dt>[SQLITE_OPEN_READONLY]</dt> |
| /// <dd>The database is opened in read-only mode. If the database does not |
| /// already exist, an error is returned.</dd>)^ |
| /// |
| /// ^(<dt>[SQLITE_OPEN_READWRITE]</dt> |
| /// <dd>The database is opened for reading and writing if possible, or reading |
| /// only if the file is write protected by the operating system. In either |
| /// case the database must already exist, otherwise an error is returned.</dd>)^ |
| /// |
| /// ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt> |
| /// <dd>The database is opened for reading and writing, and is created if |
| /// it does not already exist. This is the behavior that is always used for |
| /// sqlite3_open() and sqlite3_open16().</dd>)^ |
| /// </dl> |
| /// |
| /// In addition to the required flags, the following optional flags are |
| /// also supported: |
| /// |
| /// <dl> |
| /// ^(<dt>[SQLITE_OPEN_URI]</dt> |
| /// <dd>The filename can be interpreted as a URI if this flag is set.</dd>)^ |
| /// |
| /// ^(<dt>[SQLITE_OPEN_MEMORY]</dt> |
| /// <dd>The database will be opened as an in-memory database. The database |
| /// is named by the "filename" argument for the purposes of cache-sharing, |
| /// if shared cache mode is enabled, but the "filename" is otherwise ignored. |
| /// </dd>)^ |
| /// |
| /// ^(<dt>[SQLITE_OPEN_NOMUTEX]</dt> |
| /// <dd>The new database connection will use the "multi-thread" |
| /// [threading mode].)^ This means that separate threads are allowed |
| /// to use SQLite at the same time, as long as each thread is using |
| /// a different [database connection]. |
| /// |
| /// ^(<dt>[SQLITE_OPEN_FULLMUTEX]</dt> |
| /// <dd>The new database connection will use the "serialized" |
| /// [threading mode].)^ This means the multiple threads can safely |
| /// attempt to use the same database connection at the same time. |
| /// (Mutexes will block any actual concurrency, but in this mode |
| /// there is no harm in trying.) |
| /// |
| /// ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt> |
| /// <dd>The database is opened [shared cache] enabled, overriding |
| /// the default shared cache setting provided by |
| /// [sqlite3_enable_shared_cache()].)^ |
| /// |
| /// ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt> |
| /// <dd>The database is opened [shared cache] disabled, overriding |
| /// the default shared cache setting provided by |
| /// [sqlite3_enable_shared_cache()].)^ |
| /// |
| /// [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt> |
| /// <dd>The database filename is not allowed to be a symbolic link</dd> |
| /// </dl>)^ |
| /// |
| /// If the 3rd parameter to sqlite3_open_v2() is not one of the |
| /// required combinations shown above optionally combined with other |
| /// [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] |
| /// then the behavior is undefined. |
| /// |
| /// ^The fourth parameter to sqlite3_open_v2() is the name of the |
| /// [sqlite3_vfs] object that defines the operating system interface that |
| /// the new database connection should use. ^If the fourth parameter is |
| /// a NULL pointer then the default [sqlite3_vfs] object is used. |
| /// |
| /// ^If the filename is ":memory:", then a private, temporary in-memory database |
| /// is created for the connection. ^This in-memory database will vanish when |
| /// the database connection is closed. Future versions of SQLite might |
| /// make use of additional special filenames that begin with the ":" character. |
| /// It is recommended that when a database filename actually does begin with |
| /// a ":" character you should prefix the filename with a pathname such as |
| /// "./" to avoid ambiguity. |
| /// |
| /// ^If the filename is an empty string, then a private, temporary |
| /// on-disk database will be created. ^This private database will be |
| /// automatically deleted as soon as the database connection is closed. |
| /// |
| /// [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3> |
| /// |
| /// ^If [URI filename] interpretation is enabled, and the filename argument |
| /// begins with "file:", then the filename is interpreted as a URI. ^URI |
| /// filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is |
| /// set in the third argument to sqlite3_open_v2(), or if it has |
| /// been enabled globally using the [SQLITE_CONFIG_URI] option with the |
| /// [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. |
| /// URI filename interpretation is turned off |
| /// by default, but future releases of SQLite might enable URI filename |
| /// interpretation by default. See "[URI filenames]" for additional |
| /// information. |
| /// |
| /// URI filenames are parsed according to RFC 3986. ^If the URI contains an |
| /// authority, then it must be either an empty string or the string |
| /// "localhost". ^If the authority is not an empty string or "localhost", an |
| /// error is returned to the caller. ^The fragment component of a URI, if |
| /// present, is ignored. |
| /// |
| /// ^SQLite uses the path component of the URI as the name of the disk file |
| /// which contains the database. ^If the path begins with a '/' character, |
| /// then it is interpreted as an absolute path. ^If the path does not begin |
| /// with a '/' (meaning that the authority section is omitted from the URI) |
| /// then the path is interpreted as a relative path. |
| /// ^(On windows, the first component of an absolute path |
| /// is a drive specification (e.g. "C:").)^ |
| /// |
| /// [[core URI query parameters]] |
| /// The query component of a URI may contain parameters that are interpreted |
| /// either by SQLite itself, or by a [VFS | custom VFS implementation]. |
| /// SQLite and its built-in [VFSes] interpret the |
| /// following query parameters: |
| /// |
| /// <ul> |
| /// <li> <b>vfs</b>: ^The "vfs" parameter may be used to specify the name of |
| /// a VFS object that provides the operating system interface that should |
| /// be used to access the database file on disk. ^If this option is set to |
| /// an empty string the default VFS object is used. ^Specifying an unknown |
| /// VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is |
| /// present, then the VFS specified by the option takes precedence over |
| /// the value passed as the fourth parameter to sqlite3_open_v2(). |
| /// |
| /// <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw", |
| /// "rwc", or "memory". Attempting to set it to any other value is |
| /// an error)^. |
| /// ^If "ro" is specified, then the database is opened for read-only |
| /// access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the |
| /// third argument to sqlite3_open_v2(). ^If the mode option is set to |
| /// "rw", then the database is opened for read-write (but not create) |
| /// access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had |
| /// been set. ^Value "rwc" is equivalent to setting both |
| /// SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is |
| /// set to "memory" then a pure [in-memory database] that never reads |
| /// or writes from disk is used. ^It is an error to specify a value for |
| /// the mode parameter that is less restrictive than that specified by |
| /// the flags passed in the third parameter to sqlite3_open_v2(). |
| /// |
| /// <li> <b>cache</b>: ^The cache parameter may be set to either "shared" or |
| /// "private". ^Setting it to "shared" is equivalent to setting the |
| /// SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to |
| /// sqlite3_open_v2(). ^Setting the cache parameter to "private" is |
| /// equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit. |
| /// ^If sqlite3_open_v2() is used and the "cache" parameter is present in |
| /// a URI filename, its value overrides any behavior requested by setting |
| /// SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag. |
| /// |
| /// <li> <b>psow</b>: ^The psow parameter indicates whether or not the |
| /// [powersafe overwrite] property does or does not apply to the |
| /// storage media on which the database file resides. |
| /// |
| /// <li> <b>nolock</b>: ^The nolock parameter is a boolean query parameter |
| /// which if set disables file locking in rollback journal modes. This |
| /// is useful for accessing a database on a filesystem that does not |
| /// support locking. Caution: Database corruption might result if two |
| /// or more processes write to the same database and any one of those |
| /// processes uses nolock=1. |
| /// |
| /// <li> <b>immutable</b>: ^The immutable parameter is a boolean query |
| /// parameter that indicates that the database file is stored on |
| /// read-only media. ^When immutable is set, SQLite assumes that the |
| /// database file cannot be changed, even by a process with higher |
| /// privilege, and so the database is opened read-only and all locking |
| /// and change detection is disabled. Caution: Setting the immutable |
| /// property on a database file that does in fact change can result |
| /// in incorrect query results and/or [SQLITE_CORRUPT] errors. |
| /// See also: [SQLITE_IOCAP_IMMUTABLE]. |
| /// |
| /// </ul> |
| /// |
| /// ^Specifying an unknown parameter in the query component of a URI is not an |
| /// error. Future versions of SQLite might understand additional query |
| /// parameters. See "[query parameters with special meaning to SQLite]" for |
| /// additional information. |
| /// |
| /// [[URI filename examples]] <h3>URI filename examples</h3> |
| /// |
| /// <table border="1" align=center cellpadding=5> |
| /// <tr><th> URI filenames <th> Results |
| /// <tr><td> file:data.db <td> |
| /// Open the file "data.db" in the current directory. |
| /// <tr><td> file:/home/fred/data.db<br> |
| /// file:///home/fred/data.db <br> |
| /// file://localhost/home/fred/data.db <br> <td> |
| /// Open the database file "/home/fred/data.db". |
| /// <tr><td> file://darkstar/home/fred/data.db <td> |
| /// An error. "darkstar" is not a recognized authority. |
| /// <tr><td style="white-space:nowrap"> |
| /// file:///C:/Documents%20and%20Settings/fred/Desktop/data.db |
| /// <td> Windows only: Open the file "data.db" on fred's desktop on drive |
| /// C:. Note that the %20 escaping in this example is not strictly |
| /// necessary - space characters can be used literally |
| /// in URI filenames. |
| /// <tr><td> file:data.db?mode=ro&cache=private <td> |
| /// Open file "data.db" in the current directory for read-only access. |
| /// Regardless of whether or not shared-cache mode is enabled by |
| /// default, use a private cache. |
| /// <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td> |
| /// Open file "/home/fred/data.db". Use the special VFS "unix-dotfile" |
| /// that uses dot-files in place of posix advisory locking. |
| /// <tr><td> file:data.db?mode=readonly <td> |
| /// An error. "readonly" is not a valid option for the "mode" parameter. |
| /// </table> |
| /// |
| /// ^URI hexadecimal escape sequences (%HH) are supported within the path and |
| /// query components of a URI. A hexadecimal escape sequence consists of a |
| /// percent sign - "%" - followed by exactly two hexadecimal digits |
| /// specifying an octet value. ^Before the path or query components of a |
| /// URI filename are interpreted, they are encoded using UTF-8 and all |
| /// hexadecimal escape sequences replaced by a single byte containing the |
| /// corresponding octet. If this process generates an invalid UTF-8 encoding, |
| /// the results are undefined. |
| /// |
| /// <b>Note to Windows users:</b> The encoding used for the filename argument |
| /// of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever |
| /// codepage is currently defined. Filenames containing international |
| /// characters must be converted to UTF-8 prior to passing them into |
| /// sqlite3_open() or sqlite3_open_v2(). |
| /// |
| /// <b>Note to Windows Runtime users:</b> The temporary directory must be set |
| /// prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various |
| /// features that require the use of temporary files may fail. |
| /// |
| /// See also: [sqlite3_temp_directory] |
| int sqlite3_open( |
| ffi.Pointer<ffi.Char> filename, |
| ffi.Pointer<ffi.Pointer<sqlite3>> ppDb, |
| ) { |
| return _sqlite3_open( |
| filename, |
| ppDb, |
| ); |
| } |
| |
| late final _sqlite3_openPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Pointer<sqlite3>>)>>('sqlite3_open'); |
| late final _sqlite3_open = _sqlite3_openPtr.asFunction< |
| int Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Pointer<sqlite3>>)>(); |
| |
| int sqlite3_open16( |
| ffi.Pointer<ffi.Void> filename, |
| ffi.Pointer<ffi.Pointer<sqlite3>> ppDb, |
| ) { |
| return _sqlite3_open16( |
| filename, |
| ppDb, |
| ); |
| } |
| |
| late final _sqlite3_open16Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.Pointer<ffi.Void>, |
| ffi.Pointer<ffi.Pointer<sqlite3>>)>>('sqlite3_open16'); |
| late final _sqlite3_open16 = _sqlite3_open16Ptr.asFunction< |
| int Function(ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Pointer<sqlite3>>)>(); |
| |
| int sqlite3_open_v2( |
| ffi.Pointer<ffi.Char> filename, |
| ffi.Pointer<ffi.Pointer<sqlite3>> ppDb, |
| int flags, |
| ffi.Pointer<ffi.Char> zVfs, |
| ) { |
| return _sqlite3_open_v2( |
| filename, |
| ppDb, |
| flags, |
| zVfs, |
| ); |
| } |
| |
| late final _sqlite3_open_v2Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Pointer<sqlite3>>, |
| ffi.Int, |
| ffi.Pointer<ffi.Char>)>>('sqlite3_open_v2'); |
| late final _sqlite3_open_v2 = _sqlite3_open_v2Ptr.asFunction< |
| int Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Pointer<sqlite3>>, |
| int, ffi.Pointer<ffi.Char>)>(); |
| |
| /// CAPI3REF: Obtain Values For URI Parameters |
| /// |
| /// These are utility routines, useful to [VFS|custom VFS implementations], |
| /// that check if a database file was a URI that contained a specific query |
| /// parameter, and if so obtains the value of that query parameter. |
| /// |
| /// The first parameter to these interfaces (hereafter referred to |
| /// as F) must be one of: |
| /// <ul> |
| /// <li> A database filename pointer created by the SQLite core and |
| /// passed into the xOpen() method of a VFS implemention, or |
| /// <li> A filename obtained from [sqlite3_db_filename()], or |
| /// <li> A new filename constructed using [sqlite3_create_filename()]. |
| /// </ul> |
| /// If the F parameter is not one of the above, then the behavior is |
| /// undefined and probably undesirable. Older versions of SQLite were |
| /// more tolerant of invalid F parameters than newer versions. |
| /// |
| /// If F is a suitable filename (as described in the previous paragraph) |
| /// and if P is the name of the query parameter, then |
| /// sqlite3_uri_parameter(F,P) returns the value of the P |
| /// parameter if it exists or a NULL pointer if P does not appear as a |
| /// query parameter on F. If P is a query parameter of F and it |
| /// has no explicit value, then sqlite3_uri_parameter(F,P) returns |
| /// a pointer to an empty string. |
| /// |
| /// The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean |
| /// parameter and returns true (1) or false (0) according to the value |
| /// of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the |
| /// value of query parameter P is one of "yes", "true", or "on" in any |
| /// case or if the value begins with a non-zero number. The |
| /// sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of |
| /// query parameter P is one of "no", "false", or "off" in any case or |
| /// if the value begins with a numeric zero. If P is not a query |
| /// parameter on F or if the value of P does not match any of the |
| /// above, then sqlite3_uri_boolean(F,P,B) returns (B!=0). |
| /// |
| /// The sqlite3_uri_int64(F,P,D) routine converts the value of P into a |
| /// 64-bit signed integer and returns that integer, or D if P does not |
| /// exist. If the value of P is something other than an integer, then |
| /// zero is returned. |
| /// |
| /// The sqlite3_uri_key(F,N) returns a pointer to the name (not |
| /// the value) of the N-th query parameter for filename F, or a NULL |
| /// pointer if N is less than zero or greater than the number of query |
| /// parameters minus 1. The N value is zero-based so N should be 0 to obtain |
| /// the name of the first query parameter, 1 for the second parameter, and |
| /// so forth. |
| /// |
| /// If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and |
| /// sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and |
| /// is not a database file pathname pointer that the SQLite core passed |
| /// into the xOpen VFS method, then the behavior of this routine is undefined |
| /// and probably undesirable. |
| /// |
| /// Beginning with SQLite [version 3.31.0] ([dateof:3.31.0]) the input F |
| /// parameter can also be the name of a rollback journal file or WAL file |
| /// in addition to the main database file. Prior to version 3.31.0, these |
| /// routines would only work if F was the name of the main database file. |
| /// When the F parameter is the name of the rollback journal or WAL file, |
| /// it has access to all the same query parameters as were found on the |
| /// main database file. |
| /// |
| /// See the [URI filename] documentation for additional information. |
| ffi.Pointer<ffi.Char> sqlite3_uri_parameter( |
| ffi.Pointer<ffi.Char> zFilename, |
| ffi.Pointer<ffi.Char> zParam, |
| ) { |
| return _sqlite3_uri_parameter( |
| zFilename, |
| zParam, |
| ); |
| } |
| |
| late final _sqlite3_uri_parameterPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>)>>('sqlite3_uri_parameter'); |
| late final _sqlite3_uri_parameter = _sqlite3_uri_parameterPtr.asFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>)>(); |
| |
| int sqlite3_uri_boolean( |
| ffi.Pointer<ffi.Char> zFile, |
| ffi.Pointer<ffi.Char> zParam, |
| int bDefault, |
| ) { |
| return _sqlite3_uri_boolean( |
| zFile, |
| zParam, |
| bDefault, |
| ); |
| } |
| |
| late final _sqlite3_uri_booleanPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, |
| ffi.Int)>>('sqlite3_uri_boolean'); |
| late final _sqlite3_uri_boolean = _sqlite3_uri_booleanPtr.asFunction< |
| int Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int)>(); |
| |
| int sqlite3_uri_int64( |
| ffi.Pointer<ffi.Char> arg0, |
| ffi.Pointer<ffi.Char> arg1, |
| int arg2, |
| ) { |
| return _sqlite3_uri_int64( |
| arg0, |
| arg1, |
| arg2, |
| ); |
| } |
| |
| late final _sqlite3_uri_int64Ptr = _lookup< |
| ffi.NativeFunction< |
| sqlite3_int64 Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, |
| sqlite3_int64)>>('sqlite3_uri_int64'); |
| late final _sqlite3_uri_int64 = _sqlite3_uri_int64Ptr.asFunction< |
| int Function(ffi.Pointer<ffi.Char>, ffi.Pointer<ffi.Char>, int)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_uri_key( |
| ffi.Pointer<ffi.Char> zFilename, |
| int N, |
| ) { |
| return _sqlite3_uri_key( |
| zFilename, |
| N, |
| ); |
| } |
| |
| late final _sqlite3_uri_keyPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>, ffi.Int)>>('sqlite3_uri_key'); |
| late final _sqlite3_uri_key = _sqlite3_uri_keyPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>, int)>(); |
| |
| /// CAPI3REF: Translate filenames |
| /// |
| /// These routines are available to [VFS|custom VFS implementations] for |
| /// translating filenames between the main database file, the journal file, |
| /// and the WAL file. |
| /// |
| /// If F is the name of an sqlite database file, journal file, or WAL file |
| /// passed by the SQLite core into the VFS, then sqlite3_filename_database(F) |
| /// returns the name of the corresponding database file. |
| /// |
| /// If F is the name of an sqlite database file, journal file, or WAL file |
| /// passed by the SQLite core into the VFS, or if F is a database filename |
| /// obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F) |
| /// returns the name of the corresponding rollback journal file. |
| /// |
| /// If F is the name of an sqlite database file, journal file, or WAL file |
| /// that was passed by the SQLite core into the VFS, or if F is a database |
| /// filename obtained from [sqlite3_db_filename()], then |
| /// sqlite3_filename_wal(F) returns the name of the corresponding |
| /// WAL file. |
| /// |
| /// In all of the above, if F is not the name of a database, journal or WAL |
| /// filename passed into the VFS from the SQLite core and F is not the |
| /// return value from [sqlite3_db_filename()], then the result is |
| /// undefined and is likely a memory access violation. |
| ffi.Pointer<ffi.Char> sqlite3_filename_database( |
| ffi.Pointer<ffi.Char> arg0, |
| ) { |
| return _sqlite3_filename_database( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_filename_databasePtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>)>>('sqlite3_filename_database'); |
| late final _sqlite3_filename_database = _sqlite3_filename_databasePtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_filename_journal( |
| ffi.Pointer<ffi.Char> arg0, |
| ) { |
| return _sqlite3_filename_journal( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_filename_journalPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>)>>('sqlite3_filename_journal'); |
| late final _sqlite3_filename_journal = _sqlite3_filename_journalPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_filename_wal( |
| ffi.Pointer<ffi.Char> arg0, |
| ) { |
| return _sqlite3_filename_wal( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_filename_walPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>)>>('sqlite3_filename_wal'); |
| late final _sqlite3_filename_wal = _sqlite3_filename_walPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<ffi.Char>)>(); |
| |
| /// CAPI3REF: Database File Corresponding To A Journal |
| /// |
| /// ^If X is the name of a rollback or WAL-mode journal file that is |
| /// passed into the xOpen method of [sqlite3_vfs], then |
| /// sqlite3_database_file_object(X) returns a pointer to the [sqlite3_file] |
| /// object that represents the main database file. |
| /// |
| /// This routine is intended for use in custom [VFS] implementations |
| /// only. It is not a general-purpose interface. |
| /// The argument sqlite3_file_object(X) must be a filename pointer that |
| /// has been passed into [sqlite3_vfs].xOpen method where the |
| /// flags parameter to xOpen contains one of the bits |
| /// [SQLITE_OPEN_MAIN_JOURNAL] or [SQLITE_OPEN_WAL]. Any other use |
| /// of this routine results in undefined and probably undesirable |
| /// behavior. |
| ffi.Pointer<sqlite3_file> sqlite3_database_file_object( |
| ffi.Pointer<ffi.Char> arg0, |
| ) { |
| return _sqlite3_database_file_object( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_database_file_objectPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<sqlite3_file> Function( |
| ffi.Pointer<ffi.Char>)>>('sqlite3_database_file_object'); |
| late final _sqlite3_database_file_object = _sqlite3_database_file_objectPtr |
| .asFunction<ffi.Pointer<sqlite3_file> Function(ffi.Pointer<ffi.Char>)>(); |
| |
| /// CAPI3REF: Create and Destroy VFS Filenames |
| /// |
| /// These interfces are provided for use by [VFS shim] implementations and |
| /// are not useful outside of that context. |
| /// |
| /// The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of |
| /// database filename D with corresponding journal file J and WAL file W and |
| /// with N URI parameters key/values pairs in the array P. The result from |
| /// sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that |
| /// is safe to pass to routines like: |
| /// <ul> |
| /// <li> [sqlite3_uri_parameter()], |
| /// <li> [sqlite3_uri_boolean()], |
| /// <li> [sqlite3_uri_int64()], |
| /// <li> [sqlite3_uri_key()], |
| /// <li> [sqlite3_filename_database()], |
| /// <li> [sqlite3_filename_journal()], or |
| /// <li> [sqlite3_filename_wal()]. |
| /// </ul> |
| /// If a memory allocation error occurs, sqlite3_create_filename() might |
| /// return a NULL pointer. The memory obtained from sqlite3_create_filename(X) |
| /// must be released by a corresponding call to sqlite3_free_filename(Y). |
| /// |
| /// The P parameter in sqlite3_create_filename(D,J,W,N,P) should be an array |
| /// of 2*N pointers to strings. Each pair of pointers in this array corresponds |
| /// to a key and value for a query parameter. The P parameter may be a NULL |
| /// pointer if N is zero. None of the 2*N pointers in the P array may be |
| /// NULL pointers and key pointers should not be empty strings. |
| /// None of the D, J, or W parameters to sqlite3_create_filename(D,J,W,N,P) may |
| /// be NULL pointers, though they can be empty strings. |
| /// |
| /// The sqlite3_free_filename(Y) routine releases a memory allocation |
| /// previously obtained from sqlite3_create_filename(). Invoking |
| /// sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op. |
| /// |
| /// If the Y parameter to sqlite3_free_filename(Y) is anything other |
| /// than a NULL pointer or a pointer previously acquired from |
| /// sqlite3_create_filename(), then bad things such as heap |
| /// corruption or segfaults may occur. The value Y should be |
| /// used again after sqlite3_free_filename(Y) has been called. This means |
| /// that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y, |
| /// then the corresponding [sqlite3_module.xClose() method should also be |
| /// invoked prior to calling sqlite3_free_filename(Y). |
| ffi.Pointer<ffi.Char> sqlite3_create_filename( |
| ffi.Pointer<ffi.Char> zDatabase, |
| ffi.Pointer<ffi.Char> zJournal, |
| ffi.Pointer<ffi.Char> zWal, |
| int nParam, |
| ffi.Pointer<ffi.Pointer<ffi.Char>> azParam, |
| ) { |
| return _sqlite3_create_filename( |
| zDatabase, |
| zJournal, |
| zWal, |
| nParam, |
| azParam, |
| ); |
| } |
| |
| late final _sqlite3_create_filenamePtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('sqlite3_create_filename'); |
| late final _sqlite3_create_filename = _sqlite3_create_filenamePtr.asFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Pointer<ffi.Char>, |
| int, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>(); |
| |
| void sqlite3_free_filename( |
| ffi.Pointer<ffi.Char> arg0, |
| ) { |
| return _sqlite3_free_filename( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_free_filenamePtr = |
| _lookup<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Char>)>>( |
| 'sqlite3_free_filename'); |
| late final _sqlite3_free_filename = _sqlite3_free_filenamePtr |
| .asFunction<void Function(ffi.Pointer<ffi.Char>)>(); |
| |
| /// CAPI3REF: Error Codes And Messages |
| /// METHOD: sqlite3 |
| /// |
| /// ^If the most recent sqlite3_* API call associated with |
| /// [database connection] D failed, then the sqlite3_errcode(D) interface |
| /// returns the numeric [result code] or [extended result code] for that |
| /// API call. |
| /// ^The sqlite3_extended_errcode() |
| /// interface is the same except that it always returns the |
| /// [extended result code] even when extended result codes are |
| /// disabled. |
| /// |
| /// The values returned by sqlite3_errcode() and/or |
| /// sqlite3_extended_errcode() might change with each API call. |
| /// Except, there are some interfaces that are guaranteed to never |
| /// change the value of the error code. The error-code preserving |
| /// interfaces are: |
| /// |
| /// <ul> |
| /// <li> sqlite3_errcode() |
| /// <li> sqlite3_extended_errcode() |
| /// <li> sqlite3_errmsg() |
| /// <li> sqlite3_errmsg16() |
| /// </ul> |
| /// |
| /// ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language |
| /// text that describes the error, as either UTF-8 or UTF-16 respectively. |
| /// ^(Memory to hold the error message string is managed internally. |
| /// The application does not need to worry about freeing the result. |
| /// However, the error string might be overwritten or deallocated by |
| /// subsequent calls to other SQLite interface functions.)^ |
| /// |
| /// ^The sqlite3_errstr() interface returns the English-language text |
| /// that describes the [result code], as UTF-8. |
| /// ^(Memory to hold the error message string is managed internally |
| /// and must not be freed by the application)^. |
| /// |
| /// When the serialized [threading mode] is in use, it might be the |
| /// case that a second error occurs on a separate thread in between |
| /// the time of the first error and the call to these interfaces. |
| /// When that happens, the second error will be reported since these |
| /// interfaces always report the most recent result. To avoid |
| /// this, each thread can obtain exclusive use of the [database connection] D |
| /// by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning |
| /// to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after |
| /// all calls to the interfaces listed here are completed. |
| /// |
| /// If an interface fails with SQLITE_MISUSE, that means the interface |
| /// was invoked incorrectly by the application. In that case, the |
| /// error code and message may or may not be set. |
| int sqlite3_errcode( |
| ffi.Pointer<sqlite3> db, |
| ) { |
| return _sqlite3_errcode( |
| db, |
| ); |
| } |
| |
| late final _sqlite3_errcodePtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_errcode'); |
| late final _sqlite3_errcode = |
| _sqlite3_errcodePtr.asFunction<int Function(ffi.Pointer<sqlite3>)>(); |
| |
| int sqlite3_extended_errcode( |
| ffi.Pointer<sqlite3> db, |
| ) { |
| return _sqlite3_extended_errcode( |
| db, |
| ); |
| } |
| |
| late final _sqlite3_extended_errcodePtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3>)>>( |
| 'sqlite3_extended_errcode'); |
| late final _sqlite3_extended_errcode = _sqlite3_extended_errcodePtr |
| .asFunction<int Function(ffi.Pointer<sqlite3>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_errmsg( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_errmsg( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_errmsgPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<sqlite3>)>>('sqlite3_errmsg'); |
| late final _sqlite3_errmsg = _sqlite3_errmsgPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<sqlite3>)>(); |
| |
| ffi.Pointer<ffi.Void> sqlite3_errmsg16( |
| ffi.Pointer<sqlite3> arg0, |
| ) { |
| return _sqlite3_errmsg16( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_errmsg16Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Void> Function( |
| ffi.Pointer<sqlite3>)>>('sqlite3_errmsg16'); |
| late final _sqlite3_errmsg16 = _sqlite3_errmsg16Ptr |
| .asFunction<ffi.Pointer<ffi.Void> Function(ffi.Pointer<sqlite3>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_errstr( |
| int arg0, |
| ) { |
| return _sqlite3_errstr( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_errstrPtr = |
| _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Char> Function(ffi.Int)>>( |
| 'sqlite3_errstr'); |
| late final _sqlite3_errstr = |
| _sqlite3_errstrPtr.asFunction<ffi.Pointer<ffi.Char> Function(int)>(); |
| |
| /// CAPI3REF: Run-time Limits |
| /// METHOD: sqlite3 |
| /// |
| /// ^(This interface allows the size of various constructs to be limited |
| /// on a connection by connection basis. The first parameter is the |
| /// [database connection] whose limit is to be set or queried. The |
| /// second parameter is one of the [limit categories] that define a |
| /// class of constructs to be size limited. The third parameter is the |
| /// new limit for that construct.)^ |
| /// |
| /// ^If the new limit is a negative number, the limit is unchanged. |
| /// ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a |
| /// [limits | hard upper bound] |
| /// set at compile-time by a C preprocessor macro called |
| /// [limits | SQLITE_MAX_<i>NAME</i>]. |
| /// (The "_LIMIT_" in the name is changed to "_MAX_".))^ |
| /// ^Attempts to increase a limit above its hard upper bound are |
| /// silently truncated to the hard upper bound. |
| /// |
| /// ^Regardless of whether or not the limit was changed, the |
| /// [sqlite3_limit()] interface returns the prior value of the limit. |
| /// ^Hence, to find the current value of a limit without changing it, |
| /// simply invoke this interface with the third parameter set to -1. |
| /// |
| /// Run-time limits are intended for use in applications that manage |
| /// both their own internal database and also databases that are controlled |
| /// by untrusted external sources. An example application might be a |
| /// web browser that has its own databases for storing history and |
| /// separate databases controlled by JavaScript applications downloaded |
| /// off the Internet. The internal databases can be given the |
| /// large, default limits. Databases managed by external sources can |
| /// be given much smaller limits designed to prevent a denial of service |
| /// attack. Developers might also want to use the [sqlite3_set_authorizer()] |
| /// interface to further control untrusted SQL. The size of the database |
| /// created by an untrusted script can be contained using the |
| /// [max_page_count] [PRAGMA]. |
| /// |
| /// New run-time limit categories may be added in future releases. |
| int sqlite3_limit( |
| ffi.Pointer<sqlite3> arg0, |
| int id, |
| int newVal, |
| ) { |
| return _sqlite3_limit( |
| arg0, |
| id, |
| newVal, |
| ); |
| } |
| |
| late final _sqlite3_limitPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, ffi.Int, ffi.Int)>>('sqlite3_limit'); |
| late final _sqlite3_limit = _sqlite3_limitPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3>, int, int)>(); |
| |
| /// CAPI3REF: Compiling An SQL Statement |
| /// KEYWORDS: {SQL statement compiler} |
| /// METHOD: sqlite3 |
| /// CONSTRUCTOR: sqlite3_stmt |
| /// |
| /// To execute an SQL statement, it must first be compiled into a byte-code |
| /// program using one of these routines. Or, in other words, these routines |
| /// are constructors for the [prepared statement] object. |
| /// |
| /// The preferred routine to use is [sqlite3_prepare_v2()]. The |
| /// [sqlite3_prepare()] interface is legacy and should be avoided. |
| /// [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used |
| /// for special purposes. |
| /// |
| /// The use of the UTF-8 interfaces is preferred, as SQLite currently |
| /// does all parsing using UTF-8. The UTF-16 interfaces are provided |
| /// as a convenience. The UTF-16 interfaces work by converting the |
| /// input text into UTF-8, then invoking the corresponding UTF-8 interface. |
| /// |
| /// The first argument, "db", is a [database connection] obtained from a |
| /// prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or |
| /// [sqlite3_open16()]. The database connection must not have been closed. |
| /// |
| /// The second argument, "zSql", is the statement to be compiled, encoded |
| /// as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(), |
| /// and sqlite3_prepare_v3() |
| /// interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(), |
| /// and sqlite3_prepare16_v3() use UTF-16. |
| /// |
| /// ^If the nByte argument is negative, then zSql is read up to the |
| /// first zero terminator. ^If nByte is positive, then it is the |
| /// number of bytes read from zSql. ^If nByte is zero, then no prepared |
| /// statement is generated. |
| /// If the caller knows that the supplied string is nul-terminated, then |
| /// there is a small performance advantage to passing an nByte parameter that |
| /// is the number of bytes in the input string <i>including</i> |
| /// the nul-terminator. |
| /// |
| /// ^If pzTail is not NULL then *pzTail is made to point to the first byte |
| /// past the end of the first SQL statement in zSql. These routines only |
| /// compile the first statement in zSql, so *pzTail is left pointing to |
| /// what remains uncompiled. |
| /// |
| /// ^*ppStmt is left pointing to a compiled [prepared statement] that can be |
| /// executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set |
| /// to NULL. ^If the input text contains no SQL (if the input is an empty |
| /// string or a comment) then *ppStmt is set to NULL. |
| /// The calling procedure is responsible for deleting the compiled |
| /// SQL statement using [sqlite3_finalize()] after it has finished with it. |
| /// ppStmt may not be NULL. |
| /// |
| /// ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; |
| /// otherwise an [error code] is returned. |
| /// |
| /// The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(), |
| /// and sqlite3_prepare16_v3() interfaces are recommended for all new programs. |
| /// The older interfaces (sqlite3_prepare() and sqlite3_prepare16()) |
| /// are retained for backwards compatibility, but their use is discouraged. |
| /// ^In the "vX" interfaces, the prepared statement |
| /// that is returned (the [sqlite3_stmt] object) contains a copy of the |
| /// original SQL text. This causes the [sqlite3_step()] interface to |
| /// behave differently in three ways: |
| /// |
| /// <ol> |
| /// <li> |
| /// ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it |
| /// always used to do, [sqlite3_step()] will automatically recompile the SQL |
| /// statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY] |
| /// retries will occur before sqlite3_step() gives up and returns an error. |
| /// </li> |
| /// |
| /// <li> |
| /// ^When an error occurs, [sqlite3_step()] will return one of the detailed |
| /// [error codes] or [extended error codes]. ^The legacy behavior was that |
| /// [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code |
| /// and the application would have to make a second call to [sqlite3_reset()] |
| /// in order to find the underlying cause of the problem. With the "v2" prepare |
| /// interfaces, the underlying reason for the error is returned immediately. |
| /// </li> |
| /// |
| /// <li> |
| /// ^If the specific value bound to a [parameter | host parameter] in the |
| /// WHERE clause might influence the choice of query plan for a statement, |
| /// then the statement will be automatically recompiled, as if there had been |
| /// a schema change, on the first [sqlite3_step()] call following any change |
| /// to the [sqlite3_bind_text | bindings] of that [parameter]. |
| /// ^The specific value of a WHERE-clause [parameter] might influence the |
| /// choice of query plan if the parameter is the left-hand side of a [LIKE] |
| /// or [GLOB] operator or if the parameter is compared to an indexed column |
| /// and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. |
| /// </li> |
| /// </ol> |
| /// |
| /// <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having |
| /// the extra prepFlags parameter, which is a bit array consisting of zero or |
| /// more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The |
| /// sqlite3_prepare_v2() interface works exactly the same as |
| /// sqlite3_prepare_v3() with a zero prepFlags parameter. |
| int sqlite3_prepare( |
| ffi.Pointer<sqlite3> db, |
| ffi.Pointer<ffi.Char> zSql, |
| int nByte, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>> ppStmt, |
| ffi.Pointer<ffi.Pointer<ffi.Char>> pzTail, |
| ) { |
| return _sqlite3_prepare( |
| db, |
| zSql, |
| nByte, |
| ppStmt, |
| pzTail, |
| ); |
| } |
| |
| late final _sqlite3_preparePtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('sqlite3_prepare'); |
| late final _sqlite3_prepare = _sqlite3_preparePtr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>(); |
| |
| int sqlite3_prepare_v2( |
| ffi.Pointer<sqlite3> db, |
| ffi.Pointer<ffi.Char> zSql, |
| int nByte, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>> ppStmt, |
| ffi.Pointer<ffi.Pointer<ffi.Char>> pzTail, |
| ) { |
| return _sqlite3_prepare_v2( |
| db, |
| zSql, |
| nByte, |
| ppStmt, |
| pzTail, |
| ); |
| } |
| |
| late final _sqlite3_prepare_v2Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('sqlite3_prepare_v2'); |
| late final _sqlite3_prepare_v2 = _sqlite3_prepare_v2Ptr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>(); |
| |
| int sqlite3_prepare_v3( |
| ffi.Pointer<sqlite3> db, |
| ffi.Pointer<ffi.Char> zSql, |
| int nByte, |
| int prepFlags, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>> ppStmt, |
| ffi.Pointer<ffi.Pointer<ffi.Char>> pzTail, |
| ) { |
| return _sqlite3_prepare_v3( |
| db, |
| zSql, |
| nByte, |
| prepFlags, |
| ppStmt, |
| pzTail, |
| ); |
| } |
| |
| late final _sqlite3_prepare_v3Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| ffi.Int, |
| ffi.UnsignedInt, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>>('sqlite3_prepare_v3'); |
| late final _sqlite3_prepare_v3 = _sqlite3_prepare_v3Ptr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Char>, |
| int, |
| int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Char>>)>(); |
| |
| int sqlite3_prepare16( |
| ffi.Pointer<sqlite3> db, |
| ffi.Pointer<ffi.Void> zSql, |
| int nByte, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>> ppStmt, |
| ffi.Pointer<ffi.Pointer<ffi.Void>> pzTail, |
| ) { |
| return _sqlite3_prepare16( |
| db, |
| zSql, |
| nByte, |
| ppStmt, |
| pzTail, |
| ); |
| } |
| |
| late final _sqlite3_prepare16Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Void>>)>>('sqlite3_prepare16'); |
| late final _sqlite3_prepare16 = _sqlite3_prepare16Ptr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Void>, |
| int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Void>>)>(); |
| |
| int sqlite3_prepare16_v2( |
| ffi.Pointer<sqlite3> db, |
| ffi.Pointer<ffi.Void> zSql, |
| int nByte, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>> ppStmt, |
| ffi.Pointer<ffi.Pointer<ffi.Void>> pzTail, |
| ) { |
| return _sqlite3_prepare16_v2( |
| db, |
| zSql, |
| nByte, |
| ppStmt, |
| pzTail, |
| ); |
| } |
| |
| late final _sqlite3_prepare16_v2Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Void>>)>>('sqlite3_prepare16_v2'); |
| late final _sqlite3_prepare16_v2 = _sqlite3_prepare16_v2Ptr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Void>, |
| int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Void>>)>(); |
| |
| int sqlite3_prepare16_v3( |
| ffi.Pointer<sqlite3> db, |
| ffi.Pointer<ffi.Void> zSql, |
| int nByte, |
| int prepFlags, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>> ppStmt, |
| ffi.Pointer<ffi.Pointer<ffi.Void>> pzTail, |
| ) { |
| return _sqlite3_prepare16_v3( |
| db, |
| zSql, |
| nByte, |
| prepFlags, |
| ppStmt, |
| pzTail, |
| ); |
| } |
| |
| late final _sqlite3_prepare16_v3Ptr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.UnsignedInt, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Void>>)>>('sqlite3_prepare16_v3'); |
| late final _sqlite3_prepare16_v3 = _sqlite3_prepare16_v3Ptr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3>, |
| ffi.Pointer<ffi.Void>, |
| int, |
| int, |
| ffi.Pointer<ffi.Pointer<sqlite3_stmt>>, |
| ffi.Pointer<ffi.Pointer<ffi.Void>>)>(); |
| |
| /// CAPI3REF: Retrieving Statement SQL |
| /// METHOD: sqlite3_stmt |
| /// |
| /// ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 |
| /// SQL text used to create [prepared statement] P if P was |
| /// created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], |
| /// [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. |
| /// ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 |
| /// string containing the SQL text of prepared statement P with |
| /// [bound parameters] expanded. |
| /// ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8 |
| /// string containing the normalized SQL text of prepared statement P. The |
| /// semantics used to normalize a SQL statement are unspecified and subject |
| /// to change. At a minimum, literal values will be replaced with suitable |
| /// placeholders. |
| /// |
| /// ^(For example, if a prepared statement is created using the SQL |
| /// text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 |
| /// and parameter :xyz is unbound, then sqlite3_sql() will return |
| /// the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() |
| /// will return "SELECT 2345,NULL".)^ |
| /// |
| /// ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory |
| /// is available to hold the result, or if the result would exceed the |
| /// the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. |
| /// |
| /// ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of |
| /// bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time |
| /// option causes sqlite3_expanded_sql() to always return NULL. |
| /// |
| /// ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P) |
| /// are managed by SQLite and are automatically freed when the prepared |
| /// statement is finalized. |
| /// ^The string returned by sqlite3_expanded_sql(P), on the other hand, |
| /// is obtained from [sqlite3_malloc()] and must be free by the application |
| /// by passing it to [sqlite3_free()]. |
| ffi.Pointer<ffi.Char> sqlite3_sql( |
| ffi.Pointer<sqlite3_stmt> pStmt, |
| ) { |
| return _sqlite3_sql( |
| pStmt, |
| ); |
| } |
| |
| late final _sqlite3_sqlPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<sqlite3_stmt>)>>('sqlite3_sql'); |
| late final _sqlite3_sql = _sqlite3_sqlPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<sqlite3_stmt>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_expanded_sql( |
| ffi.Pointer<sqlite3_stmt> pStmt, |
| ) { |
| return _sqlite3_expanded_sql( |
| pStmt, |
| ); |
| } |
| |
| late final _sqlite3_expanded_sqlPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<sqlite3_stmt>)>>('sqlite3_expanded_sql'); |
| late final _sqlite3_expanded_sql = _sqlite3_expanded_sqlPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<sqlite3_stmt>)>(); |
| |
| ffi.Pointer<ffi.Char> sqlite3_normalized_sql( |
| ffi.Pointer<sqlite3_stmt> pStmt, |
| ) { |
| return _sqlite3_normalized_sql( |
| pStmt, |
| ); |
| } |
| |
| late final _sqlite3_normalized_sqlPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Pointer<ffi.Char> Function( |
| ffi.Pointer<sqlite3_stmt>)>>('sqlite3_normalized_sql'); |
| late final _sqlite3_normalized_sql = _sqlite3_normalized_sqlPtr |
| .asFunction<ffi.Pointer<ffi.Char> Function(ffi.Pointer<sqlite3_stmt>)>(); |
| |
| /// CAPI3REF: Determine If An SQL Statement Writes The Database |
| /// METHOD: sqlite3_stmt |
| /// |
| /// ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if |
| /// and only if the [prepared statement] X makes no direct changes to |
| /// the content of the database file. |
| /// |
| /// Note that [application-defined SQL functions] or |
| /// [virtual tables] might change the database indirectly as a side effect. |
| /// ^(For example, if an application defines a function "eval()" that |
| /// calls [sqlite3_exec()], then the following SQL statement would |
| /// change the database file through side-effects: |
| /// |
| /// <blockquote><pre> |
| /// SELECT eval('DELETE FROM t1') FROM t2; |
| /// </pre></blockquote> |
| /// |
| /// But because the [SELECT] statement does not change the database file |
| /// directly, sqlite3_stmt_readonly() would still return true.)^ |
| /// |
| /// ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], |
| /// [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, |
| /// since the statements themselves do not actually modify the database but |
| /// rather they control the timing of when other statements modify the |
| /// database. ^The [ATTACH] and [DETACH] statements also cause |
| /// sqlite3_stmt_readonly() to return true since, while those statements |
| /// change the configuration of a database connection, they do not make |
| /// changes to the content of the database files on disk. |
| /// ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since |
| /// [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and |
| /// [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so |
| /// sqlite3_stmt_readonly() returns false for those commands. |
| int sqlite3_stmt_readonly( |
| ffi.Pointer<sqlite3_stmt> pStmt, |
| ) { |
| return _sqlite3_stmt_readonly( |
| pStmt, |
| ); |
| } |
| |
| late final _sqlite3_stmt_readonlyPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3_stmt>)>>( |
| 'sqlite3_stmt_readonly'); |
| late final _sqlite3_stmt_readonly = _sqlite3_stmt_readonlyPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3_stmt>)>(); |
| |
| /// CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement |
| /// METHOD: sqlite3_stmt |
| /// |
| /// ^The sqlite3_stmt_isexplain(S) interface returns 1 if the |
| /// prepared statement S is an EXPLAIN statement, or 2 if the |
| /// statement S is an EXPLAIN QUERY PLAN. |
| /// ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is |
| /// an ordinary statement or a NULL pointer. |
| int sqlite3_stmt_isexplain( |
| ffi.Pointer<sqlite3_stmt> pStmt, |
| ) { |
| return _sqlite3_stmt_isexplain( |
| pStmt, |
| ); |
| } |
| |
| late final _sqlite3_stmt_isexplainPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3_stmt>)>>( |
| 'sqlite3_stmt_isexplain'); |
| late final _sqlite3_stmt_isexplain = _sqlite3_stmt_isexplainPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3_stmt>)>(); |
| |
| /// CAPI3REF: Determine If A Prepared Statement Has Been Reset |
| /// METHOD: sqlite3_stmt |
| /// |
| /// ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the |
| /// [prepared statement] S has been stepped at least once using |
| /// [sqlite3_step(S)] but has neither run to completion (returned |
| /// [SQLITE_DONE] from [sqlite3_step(S)]) nor |
| /// been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) |
| /// interface returns false if S is a NULL pointer. If S is not a |
| /// NULL pointer and is not a pointer to a valid [prepared statement] |
| /// object, then the behavior is undefined and probably undesirable. |
| /// |
| /// This interface can be used in combination [sqlite3_next_stmt()] |
| /// to locate all prepared statements associated with a database |
| /// connection that are in need of being reset. This can be used, |
| /// for example, in diagnostic routines to search for prepared |
| /// statements that are holding a transaction open. |
| int sqlite3_stmt_busy( |
| ffi.Pointer<sqlite3_stmt> arg0, |
| ) { |
| return _sqlite3_stmt_busy( |
| arg0, |
| ); |
| } |
| |
| late final _sqlite3_stmt_busyPtr = |
| _lookup<ffi.NativeFunction<ffi.Int Function(ffi.Pointer<sqlite3_stmt>)>>( |
| 'sqlite3_stmt_busy'); |
| late final _sqlite3_stmt_busy = _sqlite3_stmt_busyPtr |
| .asFunction<int Function(ffi.Pointer<sqlite3_stmt>)>(); |
| |
| /// CAPI3REF: Binding Values To Prepared Statements |
| /// KEYWORDS: {host parameter} {host parameters} {host parameter name} |
| /// KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} |
| /// METHOD: sqlite3_stmt |
| /// |
| /// ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, |
| /// literals may be replaced by a [parameter] that matches one of following |
| /// templates: |
| /// |
| /// <ul> |
| /// <li> ? |
| /// <li> ?NNN |
| /// <li> :VVV |
| /// <li> @VVV |
| /// <li> $VVV |
| /// </ul> |
| /// |
| /// In the templates above, NNN represents an integer literal, |
| /// and VVV represents an alphanumeric identifier.)^ ^The values of these |
| /// parameters (also called "host parameter names" or "SQL parameters") |
| /// can be set using the sqlite3_bind_*() routines defined here. |
| /// |
| /// ^The first argument to the sqlite3_bind_*() routines is always |
| /// a pointer to the [sqlite3_stmt] object returned from |
| /// [sqlite3_prepare_v2()] or its variants. |
| /// |
| /// ^The second argument is the index of the SQL parameter to be set. |
| /// ^The leftmost SQL parameter has an index of 1. ^When the same named |
| /// SQL parameter is used more than once, second and subsequent |
| /// occurrences have the same index as the first occurrence. |
| /// ^The index for named parameters can be looked up using the |
| /// [sqlite3_bind_parameter_index()] API if desired. ^The index |
| /// for "?NNN" parameters is the value of NNN. |
| /// ^The NNN value must be between 1 and the [sqlite3_limit()] |
| /// parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 32766). |
| /// |
| /// ^The third argument is the value to bind to the parameter. |
| /// ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16() |
| /// or sqlite3_bind_blob() is a NULL pointer then the fourth parameter |
| /// is ignored and the end result is the same as sqlite3_bind_null(). |
| /// ^If the third parameter to sqlite3_bind_text() is not NULL, then |
| /// it should be a pointer to well-formed UTF8 text. |
| /// ^If the third parameter to sqlite3_bind_text16() is not NULL, then |
| /// it should be a pointer to well-formed UTF16 text. |
| /// ^If the third parameter to sqlite3_bind_text64() is not NULL, then |
| /// it should be a pointer to a well-formed unicode string that is |
| /// either UTF8 if the sixth parameter is SQLITE_UTF8, or UTF16 |
| /// otherwise. |
| /// |
| /// [[byte-order determination rules]] ^The byte-order of |
| /// UTF16 input text is determined by the byte-order mark (BOM, U+FEFF) |
| /// found in first character, which is removed, or in the absence of a BOM |
| /// the byte order is the native byte order of the host |
| /// machine for sqlite3_bind_text16() or the byte order specified in |
| /// the 6th parameter for sqlite3_bind_text64().)^ |
| /// ^If UTF16 input text contains invalid unicode |
| /// characters, then SQLite might change those invalid characters |
| /// into the unicode replacement character: U+FFFD. |
| /// |
| /// ^(In those routines that have a fourth argument, its value is the |
| /// number of bytes in the parameter. To be clear: the value is the |
| /// number of <u>bytes</u> in the value, not the number of characters.)^ |
| /// ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16() |
| /// is negative, then the length of the string is |
| /// the number of bytes up to the first zero terminator. |
| /// If the fourth parameter to sqlite3_bind_blob() is negative, then |
| /// the behavior is undefined. |
| /// If a non-negative fourth parameter is provided to sqlite3_bind_text() |
| /// or sqlite3_bind_text16() or sqlite3_bind_text64() then |
| /// that parameter must be the byte offset |
| /// where the NUL terminator would occur assuming the string were NUL |
| /// terminated. If any NUL characters occurs at byte offsets less than |
| /// the value of the fourth parameter then the resulting string value will |
| /// contain embedded NULs. The result of expressions involving strings |
| /// with embedded NULs is undefined. |
| /// |
| /// ^The fifth argument to the BLOB and string binding interfaces |
| /// is a destructor used to dispose of the BLOB or |
| /// string after SQLite has finished with it. ^The destructor is called |
| /// to dispose of the BLOB or string even if the call to the bind API fails, |
| /// except the destructor is not called if the third parameter is a NULL |
| /// pointer or the fourth parameter is negative. |
| /// ^If the fifth argument is |
| /// the special value [SQLITE_STATIC], then SQLite assumes that the |
| /// information is in static, unmanaged space and does not need to be freed. |
| /// ^If the fifth argument has the value [SQLITE_TRANSIENT], then |
| /// SQLite makes its own private copy of the data immediately, before |
| /// the sqlite3_bind_*() routine returns. |
| /// |
| /// ^The sixth argument to sqlite3_bind_text64() must be one of |
| /// [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE] |
| /// to specify the encoding of the text in the third parameter. If |
| /// the sixth argument to sqlite3_bind_text64() is not one of the |
| /// allowed values shown above, or if the text encoding is different |
| /// from the encoding specified by the sixth parameter, then the behavior |
| /// is undefined. |
| /// |
| /// ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that |
| /// is filled with zeroes. ^A zeroblob uses a fixed amount of memory |
| /// (just an integer to hold its size) while it is being processed. |
| /// Zeroblobs are intended to serve as placeholders for BLOBs whose |
| /// content is later written using |
| /// [sqlite3_blob_open | incremental BLOB I/O] routines. |
| /// ^A negative value for the zeroblob results in a zero-length BLOB. |
| /// |
| /// ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in |
| /// [prepared statement] S to have an SQL value of NULL, but to also be |
| /// associated with the pointer P of type T. ^D is either a NULL pointer or |
| /// a pointer to a destructor function for P. ^SQLite will invoke the |
| /// destructor D with a single argument of P when it is finished using |
| /// P. The T parameter should be a static string, preferably a string |
| /// literal. The sqlite3_bind_pointer() routine is part of the |
| /// [pointer passing interface] added for SQLite 3.20.0. |
| /// |
| /// ^If any of the sqlite3_bind_*() routines are called with a NULL pointer |
| /// for the [prepared statement] or with a prepared statement for which |
| /// [sqlite3_step()] has been called more recently than [sqlite3_reset()], |
| /// then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() |
| /// routine is passed a [prepared statement] that has been finalized, the |
| /// result is undefined and probably harmful. |
| /// |
| /// ^Bindings are not cleared by the [sqlite3_reset()] routine. |
| /// ^Unbound parameters are interpreted as NULL. |
| /// |
| /// ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an |
| /// [error code] if anything goes wrong. |
| /// ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB |
| /// exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or |
| /// [SQLITE_MAX_LENGTH]. |
| /// ^[SQLITE_RANGE] is returned if the parameter |
| /// index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. |
| /// |
| /// See also: [sqlite3_bind_parameter_count()], |
| /// [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. |
| int sqlite3_bind_blob( |
| ffi.Pointer<sqlite3_stmt> arg0, |
| int arg1, |
| ffi.Pointer<ffi.Void> arg2, |
| int n, |
| ffi.Pointer<ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>> |
| arg4, |
| ) { |
| return _sqlite3_bind_blob( |
| arg0, |
| arg1, |
| arg2, |
| n, |
| arg4, |
| ); |
| } |
| |
| late final _sqlite3_bind_blobPtr = _lookup< |
| ffi.NativeFunction< |
| ffi.Int Function( |
| ffi.Pointer<sqlite3_stmt>, |
| ffi.Int, |
| ffi.Pointer<ffi.Void>, |
| ffi.Int, |
| ffi.Pointer< |
| ffi.NativeFunction< |
| ffi.Void Function( |
| ffi.Pointer<ffi.Void>)>>)>>('sqlite3_bind_blob'); |
| late final _sqlite3_bind_blob = _sqlite3_bind_blobPtr.asFunction< |
| int Function( |
| ffi.Pointer<sqlite3_stmt>, |
| int, |
| ffi.Pointer<ffi.Void>, |
| int, |
| ffi.Pointer< |
| ffi.NativeFunction<ffi.Void Function(ffi.Pointer<ffi.Void>)>>)>(); |
| |
| int sqlite3_bind_blob64( |
| ffi.Pointer<sqlite3_stmt> arg0, |
| int arg1, |
| ffi.Pointer<ffi.Void> arg2, |