@@ -146,9 +146,9 @@ extern "C" {
146
146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147
147
** [sqlite_version()] and [sqlite_source_id()].
148
148
*/
149
- #define SQLITE_VERSION "3.39.4 "
150
- #define SQLITE_VERSION_NUMBER 3039004
151
- #define SQLITE_SOURCE_ID "2022-09-29 15:55:41 a29f9949895322123f7c38fbe94c649a9d6e6c9cd0c3b41c96d694552f26b309 "
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 "
152
152
153
153
/*
154
154
** CAPI3REF: Run-Time Library Version Numbers
@@ -670,13 +670,17 @@ SQLITE_API int sqlite3_exec(
670
670
**
671
671
** SQLite uses one of these integer values as the second
672
672
** 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.
674
678
*/
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 */
680
684
681
685
/*
682
686
** CAPI3REF: Synchronization Type Flags
@@ -754,7 +758,14 @@ struct sqlite3_file {
754
758
** <li> [SQLITE_LOCK_PENDING], or
755
759
** <li> [SQLITE_LOCK_EXCLUSIVE].
756
760
** </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.
758
769
** The xCheckReservedLock() method checks whether any database connection,
759
770
** either in this process or in some other process, is holding a RESERVED,
760
771
** PENDING, or EXCLUSIVE lock on the file. It returns true
@@ -859,9 +870,8 @@ struct sqlite3_io_methods {
859
870
** opcode causes the xFileControl method to write the current state of
860
871
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
861
872
** [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].
865
875
**
866
876
** <li>[[SQLITE_FCNTL_SIZE_HINT]]
867
877
** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
@@ -1253,6 +1263,26 @@ typedef struct sqlite3_mutex sqlite3_mutex;
1253
1263
*/
1254
1264
typedef struct sqlite3_api_routines sqlite3_api_routines;
1255
1265
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
+
1256
1286
/*
1257
1287
** CAPI3REF: OS Interface Object
1258
1288
**
@@ -1431,7 +1461,7 @@ struct sqlite3_vfs {
1431
1461
sqlite3_vfs *pNext; /* Next registered VFS */
1432
1462
const char *zName; /* Name of this virtual file system */
1433
1463
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*,
1435
1465
int flags, int *pOutFlags);
1436
1466
int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
1437
1467
int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
@@ -2309,6 +2339,7 @@ struct sqlite3_mem_methods {
2309
2339
** <ul>
2310
2340
** <li> The [PRAGMA writable_schema=ON] statement.
2311
2341
** <li> The [PRAGMA journal_mode=OFF] statement.
2342
+ ** <li> The [PRAGMA schema_version=N] statement.
2312
2343
** <li> Writes to the [sqlite_dbpage] virtual table.
2313
2344
** <li> Direct writes to [shadow tables].
2314
2345
** </ul>
@@ -3424,6 +3455,9 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3424
3455
** <dd>The database is opened [shared cache] enabled, overriding
3425
3456
** the default shared cache setting provided by
3426
3457
** [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.
3427
3461
**
3428
3462
** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
3429
3463
** <dd>The database is opened [shared cache] disabled, overriding
@@ -3439,7 +3473,7 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3439
3473
** to return an extended result code.</dd>
3440
3474
**
3441
3475
** [[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>
3443
3477
** </dl>)^
3444
3478
**
3445
3479
** If the 3rd parameter to sqlite3_open_v2() is not one of the
@@ -3698,10 +3732,10 @@ SQLITE_API int sqlite3_open_v2(
3698
3732
**
3699
3733
** See the [URI filename] documentation for additional information.
3700
3734
*/
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);
3705
3739
3706
3740
/*
3707
3741
** CAPI3REF: Translate filenames
@@ -3730,9 +3764,9 @@ SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N);
3730
3764
** return value from [sqlite3_db_filename()], then the result is
3731
3765
** undefined and is likely a memory access violation.
3732
3766
*/
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 );
3736
3770
3737
3771
/*
3738
3772
** CAPI3REF: Database File Corresponding To A Journal
@@ -3798,14 +3832,14 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
3798
3832
** then the corresponding [sqlite3_module.xClose() method should also be
3799
3833
** invoked prior to calling sqlite3_free_filename(Y).
3800
3834
*/
3801
- SQLITE_API char * sqlite3_create_filename(
3835
+ SQLITE_API sqlite3_filename sqlite3_create_filename(
3802
3836
const char *zDatabase,
3803
3837
const char *zJournal,
3804
3838
const char *zWal,
3805
3839
int nParam,
3806
3840
const char **azParam
3807
3841
);
3808
- SQLITE_API void sqlite3_free_filename(char* );
3842
+ SQLITE_API void sqlite3_free_filename(sqlite3_filename );
3809
3843
3810
3844
/*
3811
3845
** CAPI3REF: Error Codes And Messages
@@ -5508,6 +5542,16 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
5508
5542
** then the conversion is performed. Otherwise no conversion occurs.
5509
5543
** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
5510
5544
**
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
+ **
5511
5555
** ^Within the [xUpdate] method of a [virtual table], the
5512
5556
** sqlite3_value_nochange(X) interface returns true if and only if
5513
5557
** the column corresponding to X is unchanged by the UPDATE operation
@@ -5572,6 +5616,7 @@ SQLITE_API int sqlite3_value_type(sqlite3_value*);
5572
5616
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
5573
5617
SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
5574
5618
SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
5619
+ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
5575
5620
5576
5621
/*
5577
5622
** CAPI3REF: Finding The Subtype Of SQL Values
@@ -5625,7 +5670,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
5625
5670
**
5626
5671
** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer
5627
5672
** when first called if N is less than or equal to zero or if a memory
5628
- ** allocate error occurs.
5673
+ ** allocation error occurs.
5629
5674
**
5630
5675
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
5631
5676
** determined by the N parameter on first successful call. Changing the
@@ -5830,9 +5875,10 @@ typedef void (*sqlite3_destructor_type)(void*);
5830
5875
** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
5831
5876
** ^SQLite takes the text result from the application from
5832
5877
** 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.
5836
5882
** ^If the 3rd parameter to the sqlite3_result_text* interfaces
5837
5883
** is non-negative, then as many bytes (not characters) of the text
5838
5884
** 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);
6328
6374
** <li> [sqlite3_filename_wal()]
6329
6375
** </ul>
6330
6376
*/
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);
6332
6378
6333
6379
/*
6334
6380
** CAPI3REF: Determine if a database is read-only
@@ -6465,7 +6511,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
6465
6511
** function C that is invoked prior to each autovacuum of the database
6466
6512
** file. ^The callback is passed a copy of the generic data pointer (P),
6467
6513
** 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,
6469
6515
** and the number of bytes per page, respectively. The callback should
6470
6516
** return the number of free pages that should be removed by the
6471
6517
** autovacuum. ^If the callback returns zero, then no autovacuum happens.
@@ -6586,6 +6632,11 @@ SQLITE_API void *sqlite3_update_hook(
6586
6632
** to the same database. Sharing is enabled if the argument is true
6587
6633
** and disabled if the argument is false.)^
6588
6634
**
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
+ **
6589
6640
** ^Cache sharing is enabled and disabled for an entire process.
6590
6641
** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
6591
6642
** In prior versions of SQLite,
@@ -6684,7 +6735,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
6684
6735
** ^The soft heap limit may not be greater than the hard heap limit.
6685
6736
** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N)
6686
6737
** 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.
6688
6739
** ^The soft heap limit is automatically enabled whenever the hard heap
6689
6740
** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and
6690
6741
** 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;
8979
9030
** if the application incorrectly accesses the destination [database connection]
8980
9031
** and so no error code is reported, but the operations may malfunction
8981
9032
** 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.
8983
9034
**
8984
9035
** If running in [shared cache mode], the application must
8985
9036
** guarantee that the shared cache used by the destination database
@@ -9407,7 +9458,7 @@ SQLITE_API int sqlite3_wal_checkpoint_v2(
9407
9458
*/
9408
9459
#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
9409
9460
#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 */
9411
9462
#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
9412
9463
9413
9464
/*
0 commit comments