CoolFace
Modelpublic

AryaWu/sqlite

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
sqlite3.h13989 linesDownload Raw Back to root
1/*2** 2001-09-153**4** The author disclaims copyright to this source code.  In place of5** a legal notice, here is a blessing:6**7**    May you do good and not evil.8**    May you find forgiveness for yourself and forgive others.9**    May you share freely, never taking more than you give.10**11*************************************************************************12** This header file defines the interface that the SQLite library13** presents to client programs.  If a C-function, structure, datatype,14** or constant definition does not appear in this file, then it is15** not a published API of SQLite, is subject to change without16** notice, and should not be referenced by programs that use SQLite.17**18** Some of the definitions that are in this file are marked as19** "experimental".  Experimental interfaces are normally new20** features recently added to SQLite.  We do not anticipate changes21** to experimental interfaces but reserve the right to make minor changes22** if experience from use "in the wild" suggest such changes are prudent.23**24** The official C-language API documentation for SQLite is derived25** from comments in this file.  This file is the authoritative source26** on how SQLite interfaces are supposed to operate.27**28** The name of this file under configuration management is "sqlite.h.in".29** The makefile makes some minor changes to this file (such as inserting30** the version number) and changes its name to "sqlite3.h" as31** part of the build process.32*/33#ifndef SQLITE3_H34#define SQLITE3_H35#include <stdarg.h>     /* Needed for the definition of va_list */36 37/*38** Make sure we can call this stuff from C++.39*/40#ifdef __cplusplus41extern "C" {42#endif43 44 45/*46** Facilitate override of interface linkage and calling conventions.47** Be aware that these macros may not be used within this particular48** translation of the amalgamation and its associated header file.49**50** The SQLITE_EXTERN and SQLITE_API macros are used to instruct the51** compiler that the target identifier should have external linkage.52**53** The SQLITE_CDECL macro is used to set the calling convention for54** public functions that accept a variable number of arguments.55**56** The SQLITE_APICALL macro is used to set the calling convention for57** public functions that accept a fixed number of arguments.58**59** The SQLITE_STDCALL macro is no longer used and is now deprecated.60**61** The SQLITE_CALLBACK macro is used to set the calling convention for62** function pointers.63**64** The SQLITE_SYSAPI macro is used to set the calling convention for65** functions provided by the operating system.66**67** Currently, the SQLITE_CDECL, SQLITE_APICALL, SQLITE_CALLBACK, and68** SQLITE_SYSAPI macros are used only when building for environments69** that require non-default calling conventions.70*/71#ifndef SQLITE_EXTERN72# define SQLITE_EXTERN extern73#endif74#ifndef SQLITE_API75# define SQLITE_API76#endif77#ifndef SQLITE_CDECL78# define SQLITE_CDECL79#endif80#ifndef SQLITE_APICALL81# define SQLITE_APICALL82#endif83#ifndef SQLITE_STDCALL84# define SQLITE_STDCALL SQLITE_APICALL85#endif86#ifndef SQLITE_CALLBACK87# define SQLITE_CALLBACK88#endif89#ifndef SQLITE_SYSAPI90# define SQLITE_SYSAPI91#endif92 93/*94** These no-op macros are used in front of interfaces to mark those95** interfaces as either deprecated or experimental.  New applications96** should not use deprecated interfaces - they are supported for backwards97** compatibility only.  Application writers should be aware that98** experimental interfaces are subject to change in point releases.99**100** These macros used to resolve to various kinds of compiler magic that101** would generate warning messages when they were used.  But that102** compiler magic ended up generating such a flurry of bug reports103** that we have taken it all out and gone back to using simple104** noop macros.105*/106#define SQLITE_DEPRECATED107#define SQLITE_EXPERIMENTAL108 109/*110** Ensure these symbols were not defined by some previous header file.111*/112#ifdef SQLITE_VERSION113# undef SQLITE_VERSION114#endif115#ifdef SQLITE_VERSION_NUMBER116# undef SQLITE_VERSION_NUMBER117#endif118 119/*120** CAPI3REF: Compile-Time Library Version Numbers121**122** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header123** evaluates to a string literal that is the SQLite version in the124** format "X.Y.Z" where X is the major version number (always 3 for125** SQLite3) and Y is the minor version number and Z is the release number.)^126** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer127** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same128** numbers used in [SQLITE_VERSION].)^129** The SQLITE_VERSION_NUMBER for any given release of SQLite will also130** be larger than the release from which it is derived.  Either Y will131** be held constant and Z will be incremented or else Y will be incremented132** and Z will be reset to zero.133**134** Since [version 3.6.18] ([dateof:3.6.18]),135** SQLite source code has been stored in the136** <a href="http://fossil-scm.org/">Fossil configuration management137** system</a>.  ^The SQLITE_SOURCE_ID macro evaluates to138** a string which identifies a particular check-in of SQLite139** within its configuration management system.  ^The SQLITE_SOURCE_ID140** string contains the date and time of the check-in (UTC) and a SHA1141** or SHA3-256 hash of the entire source tree.  If the source code has142** been edited in any way since it was last checked in, then the last143** four hexadecimal digits of the hash may be modified.144**145** See also: [sqlite3_libversion()],146** [sqlite3_libversion_number()], [sqlite3_sourceid()],147** [sqlite_version()] and [sqlite_source_id()].148*/149#define SQLITE_VERSION        "3.52.0"150#define SQLITE_VERSION_NUMBER 3052000151#define SQLITE_SOURCE_ID      "2025-12-13 00:13:40 850d5dbfb0f1eacd1e5213759810ec7e5eba4fcc0b2718dabccd5b269b12alt1"152#define SQLITE_SCM_BRANCH     "trunk"153#define SQLITE_SCM_TAGS       ""154#define SQLITE_SCM_DATETIME   "2025-12-13T00:13:40.858Z"155 156/*157** CAPI3REF: Run-Time Library Version Numbers158** KEYWORDS: sqlite3_version sqlite3_sourceid159**160** These interfaces provide the same information as the [SQLITE_VERSION],161** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros162** but are associated with the library instead of the header file.  ^(Cautious163** programmers might include assert() statements in their application to164** verify that values returned by these interfaces match the macros in165** the header, and thus ensure that the application is166** compiled with matching library and header files.167**168** <blockquote><pre>169** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );170** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );171** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );172** </pre></blockquote>)^173**174** ^The sqlite3_version[] string constant contains the text of the175** [SQLITE_VERSION] macro.  ^The sqlite3_libversion() function returns a176** pointer to the sqlite3_version[] string constant.  The sqlite3_libversion()177** function is provided for use in DLLs since DLL users usually do not have178** direct access to string constants within the DLL.  ^The179** sqlite3_libversion_number() function returns an integer equal to180** [SQLITE_VERSION_NUMBER].  ^(The sqlite3_sourceid() function returns181** a pointer to a string constant whose value is the same as the182** [SQLITE_SOURCE_ID] C preprocessor macro.  Except if SQLite is built183** using an edited copy of [the amalgamation], then the last four characters184** of the hash might be different from [SQLITE_SOURCE_ID].)^185**186** See also: [sqlite_version()] and [sqlite_source_id()].187*/188SQLITE_API SQLITE_EXTERN const char sqlite3_version[];189SQLITE_API const char *sqlite3_libversion(void);190SQLITE_API const char *sqlite3_sourceid(void);191SQLITE_API int sqlite3_libversion_number(void);192 193/*194** CAPI3REF: Run-Time Library Compilation Options Diagnostics195**196** ^The sqlite3_compileoption_used() function returns 0 or 1197** indicating whether the specified option was defined at198** compile time.  ^The SQLITE_ prefix may be omitted from the199** option name passed to sqlite3_compileoption_used().200**201** ^The sqlite3_compileoption_get() function allows iterating202** over the list of options that were defined at compile time by203** returning the N-th compile time option string.  ^If N is out of range,204** sqlite3_compileoption_get() returns a NULL pointer.  ^The SQLITE_205** prefix is omitted from any strings returned by206** sqlite3_compileoption_get().207**208** ^Support for the diagnostic functions sqlite3_compileoption_used()209** and sqlite3_compileoption_get() may be omitted by specifying the210** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.211**212** See also: SQL functions [sqlite_compileoption_used()] and213** [sqlite_compileoption_get()] and the [compile_options pragma].214*/215#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS216SQLITE_API int sqlite3_compileoption_used(const char *zOptName);217SQLITE_API const char *sqlite3_compileoption_get(int N);218#else219# define sqlite3_compileoption_used(X) 0220# define sqlite3_compileoption_get(X)  ((void*)0)221#endif222 223/*224** CAPI3REF: Test To See If The Library Is Threadsafe225**226** ^The sqlite3_threadsafe() function returns zero if and only if227** SQLite was compiled with mutexing code omitted due to the228** [SQLITE_THREADSAFE] compile-time option being set to 0.229**230** SQLite can be compiled with or without mutexes.  When231** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes232** are enabled and SQLite is threadsafe.  When the233** [SQLITE_THREADSAFE] macro is 0,234** the mutexes are omitted.  Without the mutexes, it is not safe235** to use SQLite concurrently from more than one thread.236**237** Enabling mutexes incurs a measurable performance penalty.238** So if speed is of utmost importance, it makes sense to disable239** the mutexes.  But for maximum safety, mutexes should be enabled.240** ^The default behavior is for mutexes to be enabled.241**242** This interface can be used by an application to make sure that the243** version of SQLite that it is linking against was compiled with244** the desired setting of the [SQLITE_THREADSAFE] macro.245**246** This interface only reports on the compile-time mutex setting247** of the [SQLITE_THREADSAFE] flag.  If SQLite is compiled with248** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but249** can be fully or partially disabled using a call to [sqlite3_config()]250** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],251** or [SQLITE_CONFIG_SERIALIZED].  ^(The return value of the252** sqlite3_threadsafe() function shows only the compile-time setting of253** thread safety, not any run-time changes to that setting made by254** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()255** is unchanged by calls to sqlite3_config().)^256**257** See the [threading mode] documentation for additional information.258*/259SQLITE_API int sqlite3_threadsafe(void);260 261/*262** CAPI3REF: Database Connection Handle263** KEYWORDS: {database connection} {database connections}264**265** Each open SQLite database is represented by a pointer to an instance of266** the opaque structure named "sqlite3".  It is useful to think of an sqlite3267** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and268** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]269** and [sqlite3_close_v2()] are its destructors.  There are many other270** interfaces (such as271** [sqlite3_prepare_v2()], [sqlite3_create_function()], and272** [sqlite3_busy_timeout()] to name but three) that are methods on an273** sqlite3 object.274*/275typedef struct sqlite3 sqlite3;276 277/*278** CAPI3REF: 64-Bit Integer Types279** KEYWORDS: sqlite_int64 sqlite_uint64280**281** Because there is no cross-platform way to specify 64-bit integer types282** SQLite includes typedefs for 64-bit signed and unsigned integers.283**284** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.285** The sqlite_int64 and sqlite_uint64 types are supported for backwards286** compatibility only.287**288** ^The sqlite3_int64 and sqlite_int64 types can store integer values289** between -9223372036854775808 and +9223372036854775807 inclusive.  ^The290** sqlite3_uint64 and sqlite_uint64 types can store integer values291** between 0 and +18446744073709551615 inclusive.292*/293#ifdef SQLITE_INT64_TYPE294  typedef SQLITE_INT64_TYPE sqlite_int64;295# ifdef SQLITE_UINT64_TYPE296    typedef SQLITE_UINT64_TYPE sqlite_uint64;297# else298    typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;299# endif300#elif defined(_MSC_VER) || defined(__BORLANDC__)301  typedef __int64 sqlite_int64;302  typedef unsigned __int64 sqlite_uint64;303#else304  typedef long long int sqlite_int64;305  typedef unsigned long long int sqlite_uint64;306#endif307typedef sqlite_int64 sqlite3_int64;308typedef sqlite_uint64 sqlite3_uint64;309 310/*311** If compiling for a processor that lacks floating point support,312** substitute integer for floating-point.313*/314#ifdef SQLITE_OMIT_FLOATING_POINT315# define double sqlite3_int64316#endif317 318/*319** CAPI3REF: Closing A Database Connection320** DESTRUCTOR: sqlite3321**322** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors323** for the [sqlite3] object.324** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if325** the [sqlite3] object is successfully destroyed and all associated326** resources are deallocated.327**328** Ideally, applications should [sqlite3_finalize | finalize] all329** [prepared statements], [sqlite3_blob_close | close] all [BLOB handles], and330** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated331** with the [sqlite3] object prior to attempting to close the object.332** ^If the database connection is associated with unfinalized prepared333** statements, BLOB handlers, and/or unfinished sqlite3_backup objects then334** sqlite3_close() will leave the database connection open and return335** [SQLITE_BUSY]. ^If sqlite3_close_v2() is called with unfinalized prepared336** statements, unclosed BLOB handlers, and/or unfinished sqlite3_backups,337** it returns [SQLITE_OK] regardless, but instead of deallocating the database338** connection immediately, it marks the database connection as an unusable339** "zombie" and makes arrangements to automatically deallocate the database340** connection after all prepared statements are finalized, all BLOB handles341** are closed, and all backups have finished. The sqlite3_close_v2() interface342** is intended for use with host languages that are garbage collected, and343** where the order in which destructors are called is arbitrary.344**345** ^If an [sqlite3] object is destroyed while a transaction is open,346** the transaction is automatically rolled back.347**348** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]349** must be either a NULL350** pointer or an [sqlite3] object pointer obtained351** from [sqlite3_open()], [sqlite3_open16()], or352** [sqlite3_open_v2()], and not previously closed.353** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer354** argument is a harmless no-op.355*/356SQLITE_API int sqlite3_close(sqlite3*);357SQLITE_API int sqlite3_close_v2(sqlite3*);358 359/*360** The type for a callback function.361** This is legacy and deprecated.  It is included for historical362** compatibility and is not documented.363*/364typedef int (*sqlite3_callback)(void*,int,char**, char**);365 366/*367** CAPI3REF: One-Step Query Execution Interface368** METHOD: sqlite3369**370** The sqlite3_exec() interface is a convenience wrapper around371** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],372** that allows an application to run multiple statements of SQL373** without having to use a lot of C code.374**375** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,376** semicolon-separated SQL statements passed into its 2nd argument,377** in the context of the [database connection] passed in as its 1st378** argument.  ^If the callback function of the 3rd argument to379** sqlite3_exec() is not NULL, then it is invoked for each result row380** coming out of the evaluated SQL statements.  ^The 4th argument to381** sqlite3_exec() is relayed through to the 1st argument of each382** callback invocation.  ^If the callback pointer to sqlite3_exec()383** is NULL, then no callback is ever invoked and result rows are384** ignored.385**386** ^If an error occurs while evaluating the SQL statements passed into387** sqlite3_exec(), then execution of the current statement stops and388** subsequent statements are skipped.  ^If the 5th parameter to sqlite3_exec()389** is not NULL then any error message is written into memory obtained390** from [sqlite3_malloc()] and passed back through the 5th parameter.391** To avoid memory leaks, the application should invoke [sqlite3_free()]392** on error message strings returned through the 5th parameter of393** sqlite3_exec() after the error message string is no longer needed.394** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors395** occur, then sqlite3_exec() sets the pointer in its 5th parameter to396** NULL before returning.397**398** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()399** routine returns SQLITE_ABORT without invoking the callback again and400** without running any subsequent SQL statements.401**402** ^The 2nd argument to the sqlite3_exec() callback function is the403** number of columns in the result.  ^The 3rd argument to the sqlite3_exec()404** callback is an array of pointers to strings obtained as if from405** [sqlite3_column_text()], one for each column.  ^If an element of a406** result row is NULL then the corresponding string pointer for the407** sqlite3_exec() callback is a NULL pointer.  ^The 4th argument to the408** sqlite3_exec() callback is an array of pointers to strings where each409** entry represents the name of a corresponding result column as obtained410** from [sqlite3_column_name()].411**412** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer413** to an empty string, or a pointer that contains only whitespace and/or414** SQL comments, then no SQL statements are evaluated and the database415** is not changed.416**417** Restrictions:418**419** <ul>420** <li> The application must ensure that the 1st parameter to sqlite3_exec()421**      is a valid and open [database connection].422** <li> The application must not close the [database connection] specified by423**      the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.424** <li> The application must not modify the SQL statement text passed into425**      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.426** <li> The application must not dereference the arrays or string pointers427**       passed as the 3rd and 4th callback parameters after it returns.428** </ul>429*/430SQLITE_API int sqlite3_exec(431  sqlite3*,                                  /* An open database */432  const char *sql,                           /* SQL to be evaluated */433  int (*callback)(void*,int,char**,char**),  /* Callback function */434  void *,                                    /* 1st argument to callback */435  char **errmsg                              /* Error msg written here */436);437 438/*439** CAPI3REF: Result Codes440** KEYWORDS: {result code definitions}441**442** Many SQLite functions return an integer result code from the set shown443** here in order to indicate success or failure.444**445** New error codes may be added in future versions of SQLite.446**447** See also: [extended result code definitions]448*/449#define SQLITE_OK           0   /* Successful result */450/* beginning-of-error-codes */451#define SQLITE_ERROR        1   /* Generic error */452#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */453#define SQLITE_PERM         3   /* Access permission denied */454#define SQLITE_ABORT        4   /* Callback routine requested an abort */455#define SQLITE_BUSY         5   /* The database file is locked */456#define SQLITE_LOCKED       6   /* A table in the database is locked */457#define SQLITE_NOMEM        7   /* A malloc() failed */458#define SQLITE_READONLY     8   /* Attempt to write a readonly database */459#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/460#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */461#define SQLITE_CORRUPT     11   /* The database disk image is malformed */462#define SQLITE_NOTFOUND    12   /* Unknown opcode in sqlite3_file_control() */463#define SQLITE_FULL        13   /* Insertion failed because database is full */464#define SQLITE_CANTOPEN    14   /* Unable to open the database file */465#define SQLITE_PROTOCOL    15   /* Database lock protocol error */466#define SQLITE_EMPTY       16   /* Internal use only */467#define SQLITE_SCHEMA      17   /* The database schema changed */468#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */469#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */470#define SQLITE_MISMATCH    20   /* Data type mismatch */471#define SQLITE_MISUSE      21   /* Library used incorrectly */472#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */473#define SQLITE_AUTH        23   /* Authorization denied */474#define SQLITE_FORMAT      24   /* Not used */475#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */476#define SQLITE_NOTADB      26   /* File opened that is not a database file */477#define SQLITE_NOTICE      27   /* Notifications from sqlite3_log() */478#define SQLITE_WARNING     28   /* Warnings from sqlite3_log() */479#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */480#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */481/* end-of-error-codes */482 483/*484** CAPI3REF: Extended Result Codes485** KEYWORDS: {extended result code definitions}486**487** In its default configuration, SQLite API routines return one of 30 integer488** [result codes].  However, experience has shown that many of489** these result codes are too coarse-grained.  They do not provide as490** much information about problems as programmers might like.  In an effort to491** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]492** and later) include493** support for additional result codes that provide more detailed information494** about errors. These [extended result codes] are enabled or disabled495** on a per database connection basis using the496** [sqlite3_extended_result_codes()] API.  Or, the extended code for497** the most recent error can be obtained using498** [sqlite3_extended_errcode()].499*/500#define SQLITE_ERROR_MISSING_COLLSEQ   (SQLITE_ERROR | (1<<8))501#define SQLITE_ERROR_RETRY             (SQLITE_ERROR | (2<<8))502#define SQLITE_ERROR_SNAPSHOT          (SQLITE_ERROR | (3<<8))503#define SQLITE_ERROR_RESERVESIZE       (SQLITE_ERROR | (4<<8))504#define SQLITE_ERROR_KEY               (SQLITE_ERROR | (5<<8))505#define SQLITE_ERROR_UNABLE            (SQLITE_ERROR | (6<<8))506#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))507#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))508#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))509#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))510#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))511#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))512#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))513#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))514#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))515#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))516#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))517#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))518#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))519#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))520#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))521#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))522#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))523#define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))524#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))525#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))526#define SQLITE_IOERR_SHMMAP            (SQLITE_IOERR | (21<<8))527#define SQLITE_IOERR_SEEK              (SQLITE_IOERR | (22<<8))528#define SQLITE_IOERR_DELETE_NOENT      (SQLITE_IOERR | (23<<8))529#define SQLITE_IOERR_MMAP              (SQLITE_IOERR | (24<<8))530#define SQLITE_IOERR_GETTEMPPATH       (SQLITE_IOERR | (25<<8))531#define SQLITE_IOERR_CONVPATH          (SQLITE_IOERR | (26<<8))532#define SQLITE_IOERR_VNODE             (SQLITE_IOERR | (27<<8))533#define SQLITE_IOERR_AUTH              (SQLITE_IOERR | (28<<8))534#define SQLITE_IOERR_BEGIN_ATOMIC      (SQLITE_IOERR | (29<<8))535#define SQLITE_IOERR_COMMIT_ATOMIC     (SQLITE_IOERR | (30<<8))536#define SQLITE_IOERR_ROLLBACK_ATOMIC   (SQLITE_IOERR | (31<<8))537#define SQLITE_IOERR_DATA              (SQLITE_IOERR | (32<<8))538#define SQLITE_IOERR_CORRUPTFS         (SQLITE_IOERR | (33<<8))539#define SQLITE_IOERR_IN_PAGE           (SQLITE_IOERR | (34<<8))540#define SQLITE_IOERR_BADKEY            (SQLITE_IOERR | (35<<8))541#define SQLITE_IOERR_CODEC             (SQLITE_IOERR | (36<<8))542#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))543#define SQLITE_LOCKED_VTAB             (SQLITE_LOCKED |  (2<<8))544#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))545#define SQLITE_BUSY_SNAPSHOT           (SQLITE_BUSY   |  (2<<8))546#define SQLITE_BUSY_TIMEOUT            (SQLITE_BUSY   |  (3<<8))547#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))548#define SQLITE_CANTOPEN_ISDIR          (SQLITE_CANTOPEN | (2<<8))549#define SQLITE_CANTOPEN_FULLPATH       (SQLITE_CANTOPEN | (3<<8))550#define SQLITE_CANTOPEN_CONVPATH       (SQLITE_CANTOPEN | (4<<8))551#define SQLITE_CANTOPEN_DIRTYWAL       (SQLITE_CANTOPEN | (5<<8)) /* Not Used */552#define SQLITE_CANTOPEN_SYMLINK        (SQLITE_CANTOPEN | (6<<8))553#define SQLITE_CORRUPT_VTAB            (SQLITE_CORRUPT | (1<<8))554#define SQLITE_CORRUPT_SEQUENCE        (SQLITE_CORRUPT | (2<<8))555#define SQLITE_CORRUPT_INDEX           (SQLITE_CORRUPT | (3<<8))556#define SQLITE_READONLY_RECOVERY       (SQLITE_READONLY | (1<<8))557#define SQLITE_READONLY_CANTLOCK       (SQLITE_READONLY | (2<<8))558#define SQLITE_READONLY_ROLLBACK       (SQLITE_READONLY | (3<<8))559#define SQLITE_READONLY_DBMOVED        (SQLITE_READONLY | (4<<8))560#define SQLITE_READONLY_CANTINIT       (SQLITE_READONLY | (5<<8))561#define SQLITE_READONLY_DIRECTORY      (SQLITE_READONLY | (6<<8))562#define SQLITE_ABORT_ROLLBACK          (SQLITE_ABORT | (2<<8))563#define SQLITE_CONSTRAINT_CHECK        (SQLITE_CONSTRAINT | (1<<8))564#define SQLITE_CONSTRAINT_COMMITHOOK   (SQLITE_CONSTRAINT | (2<<8))565#define SQLITE_CONSTRAINT_FOREIGNKEY   (SQLITE_CONSTRAINT | (3<<8))566#define SQLITE_CONSTRAINT_FUNCTION     (SQLITE_CONSTRAINT | (4<<8))567#define SQLITE_CONSTRAINT_NOTNULL      (SQLITE_CONSTRAINT | (5<<8))568#define SQLITE_CONSTRAINT_PRIMARYKEY   (SQLITE_CONSTRAINT | (6<<8))569#define SQLITE_CONSTRAINT_TRIGGER      (SQLITE_CONSTRAINT | (7<<8))570#define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))571#define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))572#define SQLITE_CONSTRAINT_ROWID        (SQLITE_CONSTRAINT |(10<<8))573#define SQLITE_CONSTRAINT_PINNED       (SQLITE_CONSTRAINT |(11<<8))574#define SQLITE_CONSTRAINT_DATATYPE     (SQLITE_CONSTRAINT |(12<<8))575#define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))576#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))577#define SQLITE_NOTICE_RBU              (SQLITE_NOTICE | (3<<8))578#define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))579#define SQLITE_AUTH_USER               (SQLITE_AUTH | (1<<8))580#define SQLITE_OK_LOAD_PERMANENTLY     (SQLITE_OK | (1<<8))581#define SQLITE_OK_SYMLINK              (SQLITE_OK | (2<<8)) /* internal use only */582 583/*584** CAPI3REF: Flags For File Open Operations585**586** These bit values are intended for use in the587** 3rd parameter to the [sqlite3_open_v2()] interface and588** in the 4th parameter to the [sqlite3_vfs.xOpen] method.589**590** Only those flags marked as "Ok for sqlite3_open_v2()" may be591** used as the third argument to the [sqlite3_open_v2()] interface.592** The other flags have historically been ignored by sqlite3_open_v2(),593** though future versions of SQLite might change so that an error is594** raised if any of the disallowed bits are passed into sqlite3_open_v2().595** Applications should not depend on the historical behavior.596**597** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into598** [sqlite3_open_v2()] does *not* cause the underlying database file599** to be opened using O_EXCL.  Passing SQLITE_OPEN_EXCLUSIVE into600** [sqlite3_open_v2()] has historically been a no-op and might become an601** error in future versions of SQLite.602*/603#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */604#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */605#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */606#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */607#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */608#define SQLITE_OPEN_AUTOPROXY        0x00000020  /* VFS only */609#define SQLITE_OPEN_URI              0x00000040  /* Ok for sqlite3_open_v2() */610#define SQLITE_OPEN_MEMORY           0x00000080  /* Ok for sqlite3_open_v2() */611#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */612#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */613#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */614#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */615#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */616#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */617#define SQLITE_OPEN_SUPER_JOURNAL    0x00004000  /* VFS only */618#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */619#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */620#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */621#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */622#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */623#define SQLITE_OPEN_NOFOLLOW         0x01000000  /* Ok for sqlite3_open_v2() */624#define SQLITE_OPEN_EXRESCODE        0x02000000  /* Extended result codes */625 626/* Reserved:                         0x00F00000 */627/* Legacy compatibility: */628#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */629 630 631/*632** CAPI3REF: Device Characteristics633**634** The xDeviceCharacteristics method of the [sqlite3_io_methods]635** object returns an integer which is a vector of these636** bit values expressing I/O characteristics of the mass storage637** device that holds the file that the [sqlite3_io_methods]638** refers to.639**640** The SQLITE_IOCAP_ATOMIC property means that all writes of641** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values642** mean that writes of blocks that are nnn bytes in size and643** are aligned to an address which is an integer multiple of644** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means645** that when data is appended to a file, the data is appended646** first then the size of the file is extended, never the other647** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that648** information is written to disk in the same order as calls649** to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that650** after reboot following a crash or power loss, the only bytes in a651** file that were written at the application level might have changed652** and that adjacent bytes, even bytes within the same sector are653** guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN654** flag indicates that a file cannot be deleted when open.  The655** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on656** read-only media and cannot be changed even by processes with657** elevated privileges.658**659** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying660** filesystem supports doing multiple write operations atomically when those661** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and662** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].663**664** The SQLITE_IOCAP_SUBPAGE_READ property means that it is ok to read665** from the database file in amounts that are not a multiple of the666** page size and that do not begin at a page boundary.  Without this667** property, SQLite is careful to only do full-page reads and write668** on aligned pages, with the one exception that it will do a sub-page669** read of the first page to access the database header.670*/671#define SQLITE_IOCAP_ATOMIC                 0x00000001672#define SQLITE_IOCAP_ATOMIC512              0x00000002673#define SQLITE_IOCAP_ATOMIC1K               0x00000004674#define SQLITE_IOCAP_ATOMIC2K               0x00000008675#define SQLITE_IOCAP_ATOMIC4K               0x00000010676#define SQLITE_IOCAP_ATOMIC8K               0x00000020677#define SQLITE_IOCAP_ATOMIC16K              0x00000040678#define SQLITE_IOCAP_ATOMIC32K              0x00000080679#define SQLITE_IOCAP_ATOMIC64K              0x00000100680#define SQLITE_IOCAP_SAFE_APPEND            0x00000200681#define SQLITE_IOCAP_SEQUENTIAL             0x00000400682#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  0x00000800683#define SQLITE_IOCAP_POWERSAFE_OVERWRITE    0x00001000684#define SQLITE_IOCAP_IMMUTABLE              0x00002000685#define SQLITE_IOCAP_BATCH_ATOMIC           0x00004000686#define SQLITE_IOCAP_SUBPAGE_READ           0x00008000687 688/*689** CAPI3REF: File Locking Levels690**691** SQLite uses one of these integer values as the second692** argument to calls it makes to the xLock() and xUnlock() methods693** of an [sqlite3_io_methods] object.  These values are ordered from694** least restrictive to most restrictive.695**696** The argument to xLock() is always SHARED or higher.  The argument to697** xUnlock is either SHARED or NONE.698*/699#define SQLITE_LOCK_NONE          0       /* xUnlock() only */700#define SQLITE_LOCK_SHARED        1       /* xLock() or xUnlock() */701#define SQLITE_LOCK_RESERVED      2       /* xLock() only */702#define SQLITE_LOCK_PENDING       3       /* xLock() only */703#define SQLITE_LOCK_EXCLUSIVE     4       /* xLock() only */704 705/*706** CAPI3REF: Synchronization Type Flags707**708** When SQLite invokes the xSync() method of an709** [sqlite3_io_methods] object it uses a combination of710** these integer values as the second argument.711**712** When the SQLITE_SYNC_DATAONLY flag is used, it means that the713** sync operation only needs to flush data to mass storage.  Inode714** information need not be flushed. If the lower four bits of the flag715** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.716** If the lower four bits equal SQLITE_SYNC_FULL, that means717** to use Mac OS X style fullsync instead of fsync().718**719** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags720** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL721** settings.  The [synchronous pragma] determines when calls to the722** xSync VFS method occur and applies uniformly across all platforms.723** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how724** energetic or rigorous or forceful the sync operations are and725** only make a difference on Mac OSX for the default SQLite code.726** (Third-party VFS implementations might also make the distinction727** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the728** operating systems natively supported by SQLite, only Mac OSX729** cares about the difference.)730*/731#define SQLITE_SYNC_NORMAL        0x00002732#define SQLITE_SYNC_FULL          0x00003733#define SQLITE_SYNC_DATAONLY      0x00010734 735/*736** CAPI3REF: OS Interface Open File Handle737**738** An [sqlite3_file] object represents an open file in the739** [sqlite3_vfs | OS interface layer].  Individual OS interface740** implementations will741** want to subclass this object by appending additional fields742** for their own use.  The pMethods entry is a pointer to an743** [sqlite3_io_methods] object that defines methods for performing744** I/O operations on the open file.745*/746typedef struct sqlite3_file sqlite3_file;747struct sqlite3_file {748  const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */749};750 751/*752** CAPI3REF: OS Interface File Virtual Methods Object753**754** Every file opened by the [sqlite3_vfs.xOpen] method populates an755** [sqlite3_file] object (or, more commonly, a subclass of the756** [sqlite3_file] object) with a pointer to an instance of this object.757** This object defines the methods used to perform various operations758** against the open file represented by the [sqlite3_file] object.759**760** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element761** to a non-NULL pointer, then the sqlite3_io_methods.xClose method762** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The763** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]764** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element765** to NULL.766**767** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or768** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().769** The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]770** flag may be ORed in to indicate that only the data of the file771** and not its inode needs to be synced.772**773** The integer values to xLock() and xUnlock() are one of774** <ul>775** <li> [SQLITE_LOCK_NONE],776** <li> [SQLITE_LOCK_SHARED],777** <li> [SQLITE_LOCK_RESERVED],778** <li> [SQLITE_LOCK_PENDING], or779** <li> [SQLITE_LOCK_EXCLUSIVE].780** </ul>781** xLock() upgrades the database file lock.  In other words, xLock() moves the782** database file lock in the direction NONE toward EXCLUSIVE. The argument to783** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never784** SQLITE_LOCK_NONE.  If the database file lock is already at or above the785** requested lock, then the call to xLock() is a no-op.786** xUnlock() downgrades the database file lock to either SHARED or NONE.787** If the lock is already at or below the requested lock state, then the call788** to xUnlock() is a no-op.789** The xCheckReservedLock() method checks whether any database connection,790** either in this process or in some other process, is holding a RESERVED,791** PENDING, or EXCLUSIVE lock on the file.  It returns, via its output792** pointer parameter, true if such a lock exists and false otherwise.793**794** The xFileControl() method is a generic interface that allows custom795** VFS implementations to directly control an open file using the796** [sqlite3_file_control()] interface.  The second "op" argument is an797** integer opcode.  The third argument is a generic pointer intended to798** point to a structure that may contain arguments or space in which to799** write return values.  Potential uses for xFileControl() might be800** functions to enable blocking locks with timeouts, to change the801** locking strategy (for example to use dot-file locks), to inquire802** about the status of a lock, or to break stale locks.  The SQLite803** core reserves all opcodes less than 100 for its own use.804** A [file control opcodes | list of opcodes] less than 100 is available.805** Applications that define a custom xFileControl method should use opcodes806** greater than 100 to avoid conflicts.  VFS implementations should807** return [SQLITE_NOTFOUND] for file control opcodes that they do not808** recognize.809**810** The xSectorSize() method returns the sector size of the811** device that underlies the file.  The sector size is the812** minimum write that can be performed without disturbing813** other bytes in the file.  The xDeviceCharacteristics()814** method returns a bit vector describing behaviors of the815** underlying device:816**817** <ul>818** <li> [SQLITE_IOCAP_ATOMIC]819** <li> [SQLITE_IOCAP_ATOMIC512]820** <li> [SQLITE_IOCAP_ATOMIC1K]821** <li> [SQLITE_IOCAP_ATOMIC2K]822** <li> [SQLITE_IOCAP_ATOMIC4K]823** <li> [SQLITE_IOCAP_ATOMIC8K]824** <li> [SQLITE_IOCAP_ATOMIC16K]825** <li> [SQLITE_IOCAP_ATOMIC32K]826** <li> [SQLITE_IOCAP_ATOMIC64K]827** <li> [SQLITE_IOCAP_SAFE_APPEND]828** <li> [SQLITE_IOCAP_SEQUENTIAL]829** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]830** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]831** <li> [SQLITE_IOCAP_IMMUTABLE]832** <li> [SQLITE_IOCAP_BATCH_ATOMIC]833** <li> [SQLITE_IOCAP_SUBPAGE_READ]834** </ul>835**836** The SQLITE_IOCAP_ATOMIC property means that all writes of837** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values838** mean that writes of blocks that are nnn bytes in size and839** are aligned to an address which is an integer multiple of840** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means841** that when data is appended to a file, the data is appended842** first then the size of the file is extended, never the other843** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that844** information is written to disk in the same order as calls845** to xWrite().846**847** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill848** in the unread portions of the buffer with zeros.  A VFS that849** fails to zero-fill short reads might seem to work.  However,850** failure to zero-fill short reads will eventually lead to851** database corruption.852*/853typedef struct sqlite3_io_methods sqlite3_io_methods;854struct sqlite3_io_methods {855  int iVersion;856  int (*xClose)(sqlite3_file*);857  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);858  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);859  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);860  int (*xSync)(sqlite3_file*, int flags);861  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);862  int (*xLock)(sqlite3_file*, int);863  int (*xUnlock)(sqlite3_file*, int);864  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);865  int (*xFileControl)(sqlite3_file*, int op, void *pArg);866  int (*xSectorSize)(sqlite3_file*);867  int (*xDeviceCharacteristics)(sqlite3_file*);868  /* Methods above are valid for version 1 */869  int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);870  int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);871  void (*xShmBarrier)(sqlite3_file*);872  int (*xShmUnmap)(sqlite3_file*, int deleteFlag);873  /* Methods above are valid for version 2 */874  int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);875  int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);876  /* Methods above are valid for version 3 */877  /* Additional methods may be added in future releases */878};879 880/*881** CAPI3REF: Standard File Control Opcodes882** KEYWORDS: {file control opcodes} {file control opcode}883**884** These integer constants are opcodes for the xFileControl method885** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]886** interface.887**888** <ul>889** <li>[[SQLITE_FCNTL_LOCKSTATE]]890** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This891** opcode causes the xFileControl method to write the current state of892** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],893** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])894** into an integer that the pArg argument points to.895** This capability is only available if SQLite is compiled with [SQLITE_DEBUG].896**897** <li>[[SQLITE_FCNTL_SIZE_HINT]]898** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS899** layer a hint of how large the database file will grow to be during the900** current transaction.  This hint is not guaranteed to be accurate but it901** is often close.  The underlying VFS might choose to preallocate database902** file space based on this hint in order to help writes to the database903** file run faster.904**905** <li>[[SQLITE_FCNTL_SIZE_LIMIT]]906** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that907** implements [sqlite3_deserialize()] to set an upper bound on the size908** of the in-memory database.  The argument is a pointer to a [sqlite3_int64].909** If the integer pointed to is negative, then it is filled in with the910** current limit.  Otherwise the limit is set to the larger of the value911** of the integer pointed to and the current database size.  The integer912** pointed to is set to the new limit.913**914** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]915** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS916** extends and truncates the database file in chunks of a size specified917** by the user. The fourth argument to [sqlite3_file_control()] should918** point to an integer (type int) containing the new chunk-size to use919** for the nominated database. Allocating database file space in large920** chunks (say 1MB at a time), may reduce file-system fragmentation and921** improve performance on some systems.922**923** <li>[[SQLITE_FCNTL_FILE_POINTER]]924** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer925** to the [sqlite3_file] object associated with a particular database926** connection.  See also [SQLITE_FCNTL_JOURNAL_POINTER].927**928** <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]929** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer930** to the [sqlite3_file] object associated with the journal file (either931** the [rollback journal] or the [write-ahead log]) for a particular database932** connection.  See also [SQLITE_FCNTL_FILE_POINTER].933**934** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]935** The SQLITE_FCNTL_SYNC_OMITTED file-control is no longer used.936**937** <li>[[SQLITE_FCNTL_SYNC]]938** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and939** sent to the VFS immediately before the xSync method is invoked on a940** database file descriptor. Or, if the xSync method is not invoked941** because the user has configured SQLite with942** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place943** of the xSync method. In most cases, the pointer argument passed with944** this file-control is NULL. However, if the database file is being synced945** as part of a multi-database commit, the argument points to a nul-terminated946** string containing the transactions super-journal file name. VFSes that947** do not need this signal should silently ignore this opcode. Applications948** should not call [sqlite3_file_control()] with this opcode as doing so may949** disrupt the operation of the specialized VFSes that do require it.950**951** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]952** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite953** and sent to the VFS after a transaction has been committed immediately954** but before the database is unlocked. VFSes that do not need this signal955** should silently ignore this opcode. Applications should not call956** [sqlite3_file_control()] with this opcode as doing so may disrupt the957** operation of the specialized VFSes that do require it.958**959** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]960** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic961** retry counts and intervals for certain disk I/O operations for the962** windows [VFS] in order to provide robustness in the presence of963** anti-virus programs.  By default, the windows VFS will retry file read,964** file write, and file delete operations up to 10 times, with a delay965** of 25 milliseconds before the first retry and with the delay increasing966** by an additional 25 milliseconds with each subsequent retry.  This967** opcode allows these two values (10 retries and 25 milliseconds of delay)968** to be adjusted.  The values are changed for all database connections969** within the same process.  The argument is a pointer to an array of two970** integers where the first integer is the new retry count and the second971** integer is the delay.  If either integer is negative, then the setting972** is not changed but instead the prior value of that setting is written973** into the array entry, allowing the current retry settings to be974** interrogated.  The zDbName parameter is ignored.975**976** <li>[[SQLITE_FCNTL_PERSIST_WAL]]977** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the978** persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary979** write ahead log ([WAL file]) and shared memory980** files used for transaction control981** are automatically deleted when the latest connection to the database982** closes.  Setting persistent WAL mode causes those files to persist after983** close.  Persisting the files is useful when other processes that do not984** have write permission on the directory containing the database file want985** to read the database file, as the WAL and shared memory files must exist986** in order for the database to be readable.  The fourth parameter to987** [sqlite3_file_control()] for this opcode should be a pointer to an integer.988** That integer is 0 to disable persistent WAL mode or 1 to enable persistent989** WAL mode.  If the integer is -1, then it is overwritten with the current990** WAL persistence setting.991**992** <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]993** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the994** persistent "powersafe-overwrite" or "PSOW" setting.  The PSOW setting995** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the996** xDeviceCharacteristics methods. The fourth parameter to997** [sqlite3_file_control()] for this opcode should be a pointer to an integer.998** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage999** mode.  If the integer is -1, then it is overwritten with the current1000** zero-damage mode setting.1001**1002** <li>[[SQLITE_FCNTL_OVERWRITE]]1003** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening1004** a write transaction to indicate that, unless it is rolled back for some1005** reason, the entire database file will be overwritten by the current1006** transaction. This is used by VACUUM operations.1007**1008** <li>[[SQLITE_FCNTL_VFSNAME]]1009** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of1010** all [VFSes] in the VFS stack.  The names of all VFS shims and the1011** final bottom-level VFS are written into memory obtained from1012** [sqlite3_malloc()] and the result is stored in the char* variable1013** that the fourth parameter of [sqlite3_file_control()] points to.1014** The caller is responsible for freeing the memory when done.  As with1015** all file-control actions, there is no guarantee that this will actually1016** do anything.  Callers should initialize the char* variable to a NULL1017** pointer in case this file-control is not implemented.  This file-control1018** is intended for diagnostic use only.1019**1020** <li>[[SQLITE_FCNTL_VFS_POINTER]]1021** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level1022** [VFSes] currently in use.  ^(The argument X in1023** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be1024** of type "[sqlite3_vfs] **".  This opcode will set *X1025** to a pointer to the top-level VFS.)^1026** ^When there are multiple VFS shims in the stack, this opcode finds the1027** upper-most shim only.1028**1029** <li>[[SQLITE_FCNTL_PRAGMA]]1030** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]1031** file control is sent to the open [sqlite3_file] object corresponding1032** to the database file to which the pragma statement refers. ^The argument1033** to the [SQLITE_FCNTL_PRAGMA] file control is an array of1034** pointers to strings (char**) in which the second element of the array1035** is the name of the pragma and the third element is the argument to the1036** pragma or NULL if the pragma has no argument.  ^The handler for an1037** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element1038** of the char** argument point to a string obtained from [sqlite3_mprintf()]1039** or the equivalent and that string will become the result of the pragma or1040** the error message if the pragma fails. ^If the1041** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal1042** [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]1043** file control returns [SQLITE_OK], then the parser assumes that the1044** VFS has handled the PRAGMA itself and the parser generates a no-op1045** prepared statement if result string is NULL, or that returns a copy1046** of the result string if the string is non-NULL.1047** ^If the [SQLITE_FCNTL_PRAGMA] file control returns1048** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means1049** that the VFS encountered an error while handling the [PRAGMA] and the1050** compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]1051** file control occurs at the beginning of pragma statement analysis and so1052** it is able to override built-in [PRAGMA] statements.1053**1054** <li>[[SQLITE_FCNTL_BUSYHANDLER]]1055** ^The [SQLITE_FCNTL_BUSYHANDLER]1056** file-control may be invoked by SQLite on the database file handle1057** shortly after it is opened in order to provide a custom VFS with access1058** to the connection's busy-handler callback. The argument is of type (void**)1059** - an array of two (void *) values. The first (void *) actually points1060** to a function of type (int (*)(void *)). In order to invoke the connection's1061** busy-handler, this function should be invoked with the second (void *) in1062** the array as the only argument. If it returns non-zero, then the operation1063** should be retried. If it returns zero, the custom VFS should abandon the1064** current operation.1065**1066** <li>[[SQLITE_FCNTL_TEMPFILENAME]]1067** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control1068** to have SQLite generate a1069** temporary filename using the same algorithm that is followed to generate1070** temporary filenames for TEMP tables and other internal uses.  The1071** argument should be a char** which will be filled with the filename1072** written into memory obtained from [sqlite3_malloc()].  The caller should1073** invoke [sqlite3_free()] on the result to avoid a memory leak.1074**1075** <li>[[SQLITE_FCNTL_MMAP_SIZE]]1076** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the1077** maximum number of bytes that will be used for memory-mapped I/O.1078** The argument is a pointer to a value of type sqlite3_int64 that1079** is an advisory maximum number of bytes in the file to memory map.  The1080** pointer is overwritten with the old value.  The limit is not changed if1081** the value originally pointed to is negative, and so the current limit1082** can be queried by passing in a pointer to a negative number.  This1083** file-control is used internally to implement [PRAGMA mmap_size].1084**1085** <li>[[SQLITE_FCNTL_TRACE]]1086** The [SQLITE_FCNTL_TRACE] file control provides advisory information1087** to the VFS about what the higher layers of the SQLite stack are doing.1088** This file control is used by some VFS activity tracing [shims].1089** The argument is a zero-terminated string.  Higher layers in the1090** SQLite stack may generate instances of this file control if1091** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.1092**1093** <li>[[SQLITE_FCNTL_HAS_MOVED]]1094** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a1095** pointer to an integer and it writes a boolean into that integer depending1096** on whether or not the file has been renamed, moved, or deleted since it1097** was first opened.1098**1099** <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]1100** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the1101** underlying native file handle associated with a file handle.  This file1102** control interprets its argument as a pointer to a native file handle and1103** writes the resulting value there.1104**1105** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]1106** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This1107** opcode causes the xFileControl method to swap the file handle with the one1108** pointed to by the pArg argument.  This capability is used during testing1109** and only needs to be supported when SQLITE_TEST is defined.1110**1111** <li>[[SQLITE_FCNTL_NULL_IO]]1112** The [SQLITE_FCNTL_NULL_IO] opcode sets the low-level file descriptor1113** or file handle for the [sqlite3_file] object such that it will no longer1114** read or write to the database file.1115**1116** <li>[[SQLITE_FCNTL_WAL_BLOCK]]1117** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might1118** be advantageous to block on the next WAL lock if the lock is not immediately1119** available.  The WAL subsystem issues this signal during rare1120** circumstances in order to fix a problem with priority inversion.1121** Applications should <em>not</em> use this file-control.1122**1123** <li>[[SQLITE_FCNTL_ZIPVFS]]1124** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other1125** VFS should return SQLITE_NOTFOUND for this opcode.1126**1127** <li>[[SQLITE_FCNTL_RBU]]1128** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by1129** the RBU extension only.  All other VFS should return SQLITE_NOTFOUND for1130** this opcode.1131**1132** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]1133** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then1134** the file descriptor is placed in "batch write mode", which1135** means all subsequent write operations will be deferred and done1136** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].  Systems1137** that do not support batch atomic writes will return SQLITE_NOTFOUND.1138** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to1139** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or1140** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make1141** no VFS interface calls on the same [sqlite3_file] file descriptor1142** except for calls to the xWrite method and the xFileControl method1143** with [SQLITE_FCNTL_SIZE_HINT].1144**1145** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]1146** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write1147** operations since the previous successful call to1148** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.1149** This file control returns [SQLITE_OK] if and only if the writes were1150** all performed successfully and have been committed to persistent storage.1151** ^Regardless of whether or not it is successful, this file control takes1152** the file descriptor out of batch write mode so that all subsequent1153** write operations are independent.1154** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without1155** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].1156**1157** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]1158** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write1159** operations since the previous successful call to1160** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.1161** ^This file control takes the file descriptor out of batch write mode1162** so that all subsequent write operations are independent.1163** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without1164** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].1165**1166** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]1167** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS1168** to block for up to M milliseconds before failing when attempting to1169** obtain a file lock using the xLock or xShmLock methods of the VFS.1170** The parameter is a pointer to a 32-bit signed integer that contains1171** the value that M is to be set to. Before returning, the 32-bit signed1172** integer is overwritten with the previous value of M.1173**1174** <li>[[SQLITE_FCNTL_BLOCK_ON_CONNECT]]1175** The [SQLITE_FCNTL_BLOCK_ON_CONNECT] opcode is used to configure the1176** VFS to block when taking a SHARED lock to connect to a wal mode database.1177** This is used to implement the functionality associated with1178** SQLITE_SETLK_BLOCK_ON_CONNECT.1179**1180** <li>[[SQLITE_FCNTL_DATA_VERSION]]1181** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to1182** a database file.  The argument is a pointer to a 32-bit unsigned integer.1183** The "data version" for the pager is written into the pointer.  The1184** "data version" changes whenever any change occurs to the corresponding1185** database file, either through SQL statements on the same database1186** connection or through transactions committed by separate database1187** connections possibly in other processes. The [sqlite3_total_changes()]1188** interface can be used to find if any database on the connection has changed,1189** but that interface responds to changes on TEMP as well as MAIN and does1190** not provide a mechanism to detect changes to MAIN only.  Also, the1191** [sqlite3_total_changes()] interface responds to internal changes only and1192** omits changes made by other database connections.  The1193** [PRAGMA data_version] command provides a mechanism to detect changes to1194** a single attached database that occur due to other database connections,1195** but omits changes implemented by the database connection on which it is1196** called.  This file control is the only mechanism to detect changes that1197** happen either internally or externally and that are associated with1198** a particular attached database.1199**1200** <li>[[SQLITE_FCNTL_CKPT_START]]

Showing the first 1,200 of 13989 lines. Download the file for the rest.