@@ -146,9 +146,9 @@ extern "C" {
146146** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147** [sqlite_version()] and [sqlite_source_id()].
148148*/
149- #define SQLITE_VERSION "3.39.2 "
150- #define SQLITE_VERSION_NUMBER 3039002
151- #define SQLITE_SOURCE_ID "2022-07-21 15:24:47 698edb77537b67c41adc68f9b892db56bcf9a55e00371a61420f3ddd668e6603 "
149+ #define SQLITE_VERSION "3.40.0 "
150+ #define SQLITE_VERSION_NUMBER 3040000
151+ #define SQLITE_SOURCE_ID "2022-11-16 12:10:08 89c459e766ea7e9165d0beeb124708b955a4950d0f4792f457465d71b158d318 "
152152
153153/*
154154** CAPI3REF: Run-Time Library Version Numbers
@@ -670,13 +670,17 @@ SQLITE_API int sqlite3_exec(
670670**
671671** SQLite uses one of these integer values as the second
672672** argument to calls it makes to the xLock() and xUnlock() methods
673- ** of an [sqlite3_io_methods] object.
673+ ** of an [sqlite3_io_methods] object. These values are ordered from
674+ ** lest restrictive to most restrictive.
675+ **
676+ ** The argument to xLock() is always SHARED or higher. The argument to
677+ ** xUnlock is either SHARED or NONE.
674678*/
675- #define SQLITE_LOCK_NONE 0
676- #define SQLITE_LOCK_SHARED 1
677- #define SQLITE_LOCK_RESERVED 2
678- #define SQLITE_LOCK_PENDING 3
679- #define SQLITE_LOCK_EXCLUSIVE 4
679+ #define SQLITE_LOCK_NONE 0 /* xUnlock() only */
680+ #define SQLITE_LOCK_SHARED 1 /* xLock() or xUnlock() */
681+ #define SQLITE_LOCK_RESERVED 2 /* xLock() only */
682+ #define SQLITE_LOCK_PENDING 3 /* xLock() only */
683+ #define SQLITE_LOCK_EXCLUSIVE 4 /* xLock() only */
680684
681685/*
682686** CAPI3REF: Synchronization Type Flags
@@ -754,7 +758,14 @@ struct sqlite3_file {
754758** <li> [SQLITE_LOCK_PENDING], or
755759** <li> [SQLITE_LOCK_EXCLUSIVE].
756760** </ul>
757- ** xLock() increases the lock. xUnlock() decreases the lock.
761+ ** xLock() upgrades the database file lock. In other words, xLock() moves the
762+ ** database file lock in the direction NONE toward EXCLUSIVE. The argument to
763+ ** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
764+ ** SQLITE_LOCK_NONE. If the database file lock is already at or above the
765+ ** requested lock, then the call to xLock() is a no-op.
766+ ** xUnlock() downgrades the database file lock to either SHARED or NONE.
767+ * If the lock is already at or below the requested lock state, then the call
768+ ** to xUnlock() is a no-op.
758769** The xCheckReservedLock() method checks whether any database connection,
759770** either in this process or in some other process, is holding a RESERVED,
760771** PENDING, or EXCLUSIVE lock on the file. It returns true
@@ -859,9 +870,8 @@ struct sqlite3_io_methods {
859870** opcode causes the xFileControl method to write the current state of
860871** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
861872** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
862- ** into an integer that the pArg argument points to. This capability
863- ** is used during testing and is only available when the SQLITE_TEST
864- ** compile-time option is used.
873+ ** into an integer that the pArg argument points to.
874+ ** This capability is only available if SQLite is compiled with [SQLITE_DEBUG].
865875**
866876** <li>[[SQLITE_FCNTL_SIZE_HINT]]
867877** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
@@ -1253,6 +1263,26 @@ typedef struct sqlite3_mutex sqlite3_mutex;
12531263*/
12541264typedef struct sqlite3_api_routines sqlite3_api_routines;
12551265
1266+ /*
1267+ ** CAPI3REF: File Name
1268+ **
1269+ ** Type [sqlite3_filename] is used by SQLite to pass filenames to the
1270+ ** xOpen method of a [VFS]. It may be cast to (const char*) and treated
1271+ ** as a normal, nul-terminated, UTF-8 buffer containing the filename, but
1272+ ** may also be passed to special APIs such as:
1273+ **
1274+ ** <ul>
1275+ ** <li> sqlite3_filename_database()
1276+ ** <li> sqlite3_filename_journal()
1277+ ** <li> sqlite3_filename_wal()
1278+ ** <li> sqlite3_uri_parameter()
1279+ ** <li> sqlite3_uri_boolean()
1280+ ** <li> sqlite3_uri_int64()
1281+ ** <li> sqlite3_uri_key()
1282+ ** </ul>
1283+ */
1284+ typedef const char *sqlite3_filename;
1285+
12561286/*
12571287** CAPI3REF: OS Interface Object
12581288**
@@ -1431,7 +1461,7 @@ struct sqlite3_vfs {
14311461 sqlite3_vfs *pNext; /* Next registered VFS */
14321462 const char *zName; /* Name of this virtual file system */
14331463 void *pAppData; /* Pointer to application-specific data */
1434- int (*xOpen)(sqlite3_vfs*, const char * zName, sqlite3_file*,
1464+ int (*xOpen)(sqlite3_vfs*, sqlite3_filename zName, sqlite3_file*,
14351465 int flags, int *pOutFlags);
14361466 int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
14371467 int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
@@ -2309,6 +2339,7 @@ struct sqlite3_mem_methods {
23092339** <ul>
23102340** <li> The [PRAGMA writable_schema=ON] statement.
23112341** <li> The [PRAGMA journal_mode=OFF] statement.
2342+ ** <li> The [PRAGMA schema_version=N] statement.
23122343** <li> Writes to the [sqlite_dbpage] virtual table.
23132344** <li> Direct writes to [shadow tables].
23142345** </ul>
@@ -3424,6 +3455,9 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
34243455** <dd>The database is opened [shared cache] enabled, overriding
34253456** the default shared cache setting provided by
34263457** [sqlite3_enable_shared_cache()].)^
3458+ ** The [use of shared cache mode is discouraged] and hence shared cache
3459+ ** capabilities may be omitted from many builds of SQLite. In such cases,
3460+ ** this option is a no-op.
34273461**
34283462** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
34293463** <dd>The database is opened [shared cache] disabled, overriding
@@ -3439,7 +3473,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
34393473** to return an extended result code.</dd>
34403474**
34413475** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt>
3442- ** <dd>The database filename is not allowed to be a symbolic link</dd>
3476+ ** <dd>The database filename is not allowed to contain a symbolic link</dd>
34433477** </dl>)^
34443478**
34453479** If the 3rd parameter to sqlite3_open_v2() is not one of the
@@ -3698,10 +3732,10 @@ SQLITE_API int sqlite3_open_v2(
36983732**
36993733** See the [URI filename] documentation for additional information.
37003734*/
3701- SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename , const char *zParam);
3702- SQLITE_API int sqlite3_uri_boolean(const char *zFile , const char *zParam, int bDefault);
3703- SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char* , const char*, sqlite3_int64);
3704- SQLITE_API const char *sqlite3_uri_key(const char *zFilename , int N);
3735+ SQLITE_API const char *sqlite3_uri_parameter(sqlite3_filename z , const char *zParam);
3736+ SQLITE_API int sqlite3_uri_boolean(sqlite3_filename z , const char *zParam, int bDefault);
3737+ SQLITE_API sqlite3_int64 sqlite3_uri_int64(sqlite3_filename , const char*, sqlite3_int64);
3738+ SQLITE_API const char *sqlite3_uri_key(sqlite3_filename z , int N);
37053739
37063740/*
37073741** CAPI3REF: Translate filenames
@@ -3730,9 +3764,9 @@ SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N);
37303764** return value from [sqlite3_db_filename()], then the result is
37313765** undefined and is likely a memory access violation.
37323766*/
3733- SQLITE_API const char *sqlite3_filename_database(const char* );
3734- SQLITE_API const char *sqlite3_filename_journal(const char* );
3735- SQLITE_API const char *sqlite3_filename_wal(const char* );
3767+ SQLITE_API const char *sqlite3_filename_database(sqlite3_filename );
3768+ SQLITE_API const char *sqlite3_filename_journal(sqlite3_filename );
3769+ SQLITE_API const char *sqlite3_filename_wal(sqlite3_filename );
37363770
37373771/*
37383772** CAPI3REF: Database File Corresponding To A Journal
@@ -3798,14 +3832,14 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
37983832** then the corresponding [sqlite3_module.xClose() method should also be
37993833** invoked prior to calling sqlite3_free_filename(Y).
38003834*/
3801- SQLITE_API char * sqlite3_create_filename(
3835+ SQLITE_API sqlite3_filename sqlite3_create_filename(
38023836 const char *zDatabase,
38033837 const char *zJournal,
38043838 const char *zWal,
38053839 int nParam,
38063840 const char **azParam
38073841);
3808- SQLITE_API void sqlite3_free_filename(char* );
3842+ SQLITE_API void sqlite3_free_filename(sqlite3_filename );
38093843
38103844/*
38113845** CAPI3REF: Error Codes And Messages
@@ -5508,6 +5542,16 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
55085542** then the conversion is performed. Otherwise no conversion occurs.
55095543** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
55105544**
5545+ ** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8],
5546+ ** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current encoding
5547+ ** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
5548+ ** returns something other than SQLITE_TEXT, then the return value from
5549+ ** sqlite3_value_encoding(X) is meaningless. ^Calls to
5550+ ** sqlite3_value_text(X), sqlite3_value_text16(X), sqlite3_value_text16be(X),
5551+ ** sqlite3_value_text16le(X), sqlite3_value_bytes(X), or
5552+ ** sqlite3_value_bytes16(X) might change the encoding of the value X and
5553+ ** thus change the return from subsequent calls to sqlite3_value_encoding(X).
5554+ **
55115555** ^Within the [xUpdate] method of a [virtual table], the
55125556** sqlite3_value_nochange(X) interface returns true if and only if
55135557** the column corresponding to X is unchanged by the UPDATE operation
@@ -5572,6 +5616,7 @@ SQLITE_API int sqlite3_value_type(sqlite3_value*);
55725616SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
55735617SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
55745618SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
5619+ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
55755620
55765621/*
55775622** CAPI3REF: Finding The Subtype Of SQL Values
@@ -5625,7 +5670,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
56255670**
56265671** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer
56275672** when first called if N is less than or equal to zero or if a memory
5628- ** allocate error occurs.
5673+ ** allocation error occurs.
56295674**
56305675** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
56315676** determined by the N parameter on first successful call. Changing the
@@ -5830,9 +5875,10 @@ typedef void (*sqlite3_destructor_type)(void*);
58305875** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
58315876** ^SQLite takes the text result from the application from
58325877** the 2nd parameter of the sqlite3_result_text* interfaces.
5833- ** ^If the 3rd parameter to the sqlite3_result_text* interfaces
5834- ** is negative, then SQLite takes result text from the 2nd parameter
5835- ** through the first zero character.
5878+ ** ^If the 3rd parameter to any of the sqlite3_result_text* interfaces
5879+ ** other than sqlite3_result_text64() is negative, then SQLite computes
5880+ ** the string length itself by searching the 2nd parameter for the first
5881+ ** zero character.
58365882** ^If the 3rd parameter to the sqlite3_result_text* interfaces
58375883** is non-negative, then as many bytes (not characters) of the text
58385884** pointed to by the 2nd parameter are taken as the application-defined
@@ -6328,7 +6374,7 @@ SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N);
63286374** <li> [sqlite3_filename_wal()]
63296375** </ul>
63306376*/
6331- SQLITE_API const char * sqlite3_db_filename(sqlite3 *db, const char *zDbName);
6377+ SQLITE_API sqlite3_filename sqlite3_db_filename(sqlite3 *db, const char *zDbName);
63326378
63336379/*
63346380** CAPI3REF: Determine if a database is read-only
@@ -6465,7 +6511,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
64656511** function C that is invoked prior to each autovacuum of the database
64666512** file. ^The callback is passed a copy of the generic data pointer (P),
64676513** the schema-name of the attached database that is being autovacuumed,
6468- ** the the size of the database file in pages, the number of free pages,
6514+ ** the size of the database file in pages, the number of free pages,
64696515** and the number of bytes per page, respectively. The callback should
64706516** return the number of free pages that should be removed by the
64716517** autovacuum. ^If the callback returns zero, then no autovacuum happens.
@@ -6586,6 +6632,11 @@ SQLITE_API void *sqlite3_update_hook(
65866632** to the same database. Sharing is enabled if the argument is true
65876633** and disabled if the argument is false.)^
65886634**
6635+ ** This interface is omitted if SQLite is compiled with
6636+ ** [-DSQLITE_OMIT_SHARED_CACHE]. The [-DSQLITE_OMIT_SHARED_CACHE]
6637+ ** compile-time option is recommended because the
6638+ ** [use of shared cache mode is discouraged].
6639+ **
65896640** ^Cache sharing is enabled and disabled for an entire process.
65906641** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
65916642** In prior versions of SQLite,
@@ -6684,7 +6735,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
66846735** ^The soft heap limit may not be greater than the hard heap limit.
66856736** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N)
66866737** is invoked with a value of N that is greater than the hard heap limit,
6687- ** the the soft heap limit is set to the value of the hard heap limit.
6738+ ** the soft heap limit is set to the value of the hard heap limit.
66886739** ^The soft heap limit is automatically enabled whenever the hard heap
66896740** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and
66906741** the soft heap limit is outside the range of 1..N, then the soft heap
@@ -8979,7 +9030,7 @@ typedef struct sqlite3_backup sqlite3_backup;
89799030** if the application incorrectly accesses the destination [database connection]
89809031** and so no error code is reported, but the operations may malfunction
89819032** nevertheless. Use of the destination database connection while a
8982- ** backup is in progress might also also cause a mutex deadlock.
9033+ ** backup is in progress might also cause a mutex deadlock.
89839034**
89849035** If running in [shared cache mode], the application must
89859036** guarantee that the shared cache used by the destination database
@@ -9407,7 +9458,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
94079458*/
94089459#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
94099460#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
9410- #define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
9461+ #define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for readers */
94119462#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
94129463
94139464/*
0 commit comments