@cryptotaxi247 / netdata-1 / commits / d17f9b620

Update sqlite version to 3.50.2 (#20601)

Stelios Fragkakis committed Jul 1, 2025 at 10:41 UTC d17f9b620331e6eabaaedd4b226177125f3827b3
2 files changed +171 -120
src/database/sqlite/vendored/sqlite3.c
+124 -75
@@ -1,6 +1,6 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 -** version 3.50.1. By combining all the individual C code files into this
3 +** version 3.50.2. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
@@ -18,7 +18,7 @@
18 ** separate file. This file contains only code for the core SQLite library.
19 **
20 ** The content in this amalgamation comes from Fossil check-in
21 -** b77dc5e0f596d2140d9ac682b2893ff65d3a with changes in files:
21 +** 2af157d77fb1304a74176eaee7fbc7c7e932 with changes in files:
22 **
23 **
24 */
@@ -473,9 +473,9 @@ extern "C" {
473 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
474 ** [sqlite_version()] and [sqlite_source_id()].
475 */
476 -#define SQLITE_VERSION "3.50.1"
477 -#define SQLITE_VERSION_NUMBER 3050001
478 -#define SQLITE_SOURCE_ID "2025-06-06 14:52:32 b77dc5e0f596d2140d9ac682b2893ff65d3a4140aa86067a3efebe29dc914c95"
476 +#define SQLITE_VERSION "3.50.2"
477 +#define SQLITE_VERSION_NUMBER 3050002
478 +#define SQLITE_SOURCE_ID "2025-06-28 14:00:48 2af157d77fb1304a74176eaee7fbc7c7e932d946bf25325e9c26c91db19e3079"
479
480 /*
481 ** CAPI3REF: Run-Time Library Version Numbers
@@ -4406,7 +4406,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
4406 **
4407 ** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
4408 ** database filename D with corresponding journal file J and WAL file W and
4409 -** with N URI parameters key/values pairs in the array P. The result from
4409 +** an array P of N URI Key/Value pairs. The result from
4410 ** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
4411 ** is safe to pass to routines like:
4412 ** <ul>
@@ -5087,7 +5087,7 @@ typedef struct sqlite3_context sqlite3_context;
5087 ** METHOD: sqlite3_stmt
5088 **
5089 ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
5090 -** literals may be replaced by a [parameter] that matches one of following
5090 +** literals may be replaced by a [parameter] that matches one of the following
5091 ** templates:
5092 **
5093 ** <ul>
@@ -5132,7 +5132,7 @@ typedef struct sqlite3_context sqlite3_context;
5132 **
5133 ** [[byte-order determination rules]] ^The byte-order of
5134 ** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
5135 -** found in first character, which is removed, or in the absence of a BOM
5135 +** found in the first character, which is removed, or in the absence of a BOM
5136 ** the byte order is the native byte order of the host
5137 ** machine for sqlite3_bind_text16() or the byte order specified in
5138 ** the 6th parameter for sqlite3_bind_text64().)^
@@ -5152,7 +5152,7 @@ typedef struct sqlite3_context sqlite3_context;
5152 ** or sqlite3_bind_text16() or sqlite3_bind_text64() then
5153 ** that parameter must be the byte offset
5154 ** where the NUL terminator would occur assuming the string were NUL
5155 -** terminated. If any NUL characters occurs at byte offsets less than
5155 +** terminated. If any NUL characters occur at byte offsets less than
5156 ** the value of the fourth parameter then the resulting string value will
5157 ** contain embedded NULs. The result of expressions involving strings
5158 ** with embedded NULs is undefined.
@@ -5364,7 +5364,7 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
5364 ** METHOD: sqlite3_stmt
5365 **
5366 ** ^These routines provide a means to determine the database, table, and
5367 -** table column that is the origin of a particular result column in
5367 +** table column that is the origin of a particular result column in a
5368 ** [SELECT] statement.
5369 ** ^The name of the database or table or column can be returned as
5370 ** either a UTF-8 or UTF-16 string. ^The _database_ routines return
@@ -5933,8 +5933,8 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5933 **
5934 ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
5935 ** all application-defined SQL functions that do not need to be
5936 -** used inside of triggers, view, CHECK constraints, or other elements of
5937 -** the database schema. This flags is especially recommended for SQL
5936 +** used inside of triggers, views, CHECK constraints, or other elements of
5937 +** the database schema. This flag is especially recommended for SQL
5938 ** functions that have side effects or reveal internal application state.
5939 ** Without this flag, an attacker might be able to modify the schema of
5940 ** a database file to include invocations of the function with parameters
@@ -5965,7 +5965,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5965 ** [user-defined window functions|available here].
5966 **
5967 ** ^(If the final parameter to sqlite3_create_function_v2() or
5968 -** sqlite3_create_window_function() is not NULL, then it is destructor for
5968 +** sqlite3_create_window_function() is not NULL, then it is the destructor for
5969 ** the application data pointer. The destructor is invoked when the function
5970 ** is deleted, either by being overloaded or when the database connection
5971 ** closes.)^ ^The destructor is also invoked if the call to
@@ -6365,7 +6365,7 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
6365 ** METHOD: sqlite3_value
6366 **
6367 ** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
6368 -** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
6368 +** object V and returns a pointer to that copy. ^The [sqlite3_value] returned
6369 ** is a [protected sqlite3_value] object even if the input is not.
6370 ** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
6371 ** memory allocation fails. ^If V is a [pointer value], then the result
@@ -6403,7 +6403,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
6403 ** allocation error occurs.
6404 **
6405 ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
6406 -** determined by the N parameter on first successful call. Changing the
6406 +** determined by the N parameter on the first successful call. Changing the
6407 ** value of N in any subsequent call to sqlite3_aggregate_context() within
6408 ** the same aggregate function instance will not resize the memory
6409 ** allocation.)^ Within the xFinal callback, it is customary to set
@@ -6565,7 +6565,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
6565 **
6566 ** Security Warning: These interfaces should not be exposed in scripting
6567 ** languages or in other circumstances where it might be possible for an
6568 -** an attacker to invoke them. Any agent that can invoke these interfaces
6568 +** attacker to invoke them. Any agent that can invoke these interfaces
6569 ** can probably also take control of the process.
6570 **
6571 ** Database connection client data is only available for SQLite
@@ -6679,7 +6679,7 @@ typedef void (*sqlite3_destructor_type)(void*);
6679 ** pointed to by the 2nd parameter are taken as the application-defined
6680 ** function result. If the 3rd parameter is non-negative, then it
6681 ** must be the byte offset into the string where the NUL terminator would
6682 -** appear if the string where NUL terminated. If any NUL characters occur
6682 +** appear if the string were NUL terminated. If any NUL characters occur
6683 ** in the string at a byte offset that is less than the value of the 3rd
6684 ** parameter, then the resulting string will contain embedded NULs and the
6685 ** result of expressions operating on strings with embedded NULs is undefined.
@@ -6737,7 +6737,7 @@ typedef void (*sqlite3_destructor_type)(void*);
6737 ** string and preferably a string literal. The sqlite3_result_pointer()
6738 ** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
6739 **
6740 -** If these routines are called from within the different thread
6740 +** If these routines are called from within a different thread
6741 ** than the one containing the application-defined function that received
6742 ** the [sqlite3_context] pointer, the results are undefined.
6743 */
@@ -7143,7 +7143,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
7143 ** METHOD: sqlite3
7144 **
7145 ** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
7146 -** for the N-th database on database connection D, or a NULL pointer of N is
7146 +** for the N-th database on database connection D, or a NULL pointer if N is
7147 ** out of range. An N value of 0 means the main database file. An N of 1 is
7148 ** the "temp" schema. Larger values of N correspond to various ATTACH-ed
7149 ** databases.
@@ -7238,7 +7238,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
7238 ** <dd>The SQLITE_TXN_READ state means that the database is currently
7239 ** in a read transaction. Content has been read from the database file
7240 ** but nothing in the database file has changed. The transaction state
7241 -** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
7241 +** will be advanced to SQLITE_TXN_WRITE if any changes occur and there are
7242 ** no other conflicting concurrent write transactions. The transaction
7243 ** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
7244 ** [COMMIT].</dd>
@@ -7247,7 +7247,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
7247 ** <dd>The SQLITE_TXN_WRITE state means that the database is currently
7248 ** in a write transaction. Content has been written to the database file
7249 ** but has not yet committed. The transaction state will change to
7250 -** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
7250 +** SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
7251 */
7252 #define SQLITE_TXN_NONE 0
7253 #define SQLITE_TXN_READ 1
@@ -7528,7 +7528,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
7528 ** CAPI3REF: Impose A Limit On Heap Size
7529 **
7530 ** These interfaces impose limits on the amount of heap memory that will be
7531 -** by all database connections within a single process.
7531 +** used by all database connections within a single process.
7532 **
7533 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
7534 ** soft limit on the amount of heap memory that may be allocated by SQLite.
@@ -7586,7 +7586,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
7586 ** </ul>)^
7587 **
7588 ** The circumstances under which SQLite will enforce the heap limits may
7589 -** changes in future releases of SQLite.
7589 +** change in future releases of SQLite.
7590 */
7591 SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
7592 SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
@@ -7701,8 +7701,8 @@ SQLITE_API int sqlite3_table_column_metadata(
7701 ** ^The entry point is zProc.
7702 ** ^(zProc may be 0, in which case SQLite will try to come up with an
7703 ** entry point name on its own. It first tries "sqlite3_extension_init".
7704 -** If that does not work, it constructs a name "sqlite3_X_init" where the
7705 -** X is consists of the lower-case equivalent of all ASCII alphabetic
7704 +** If that does not work, it constructs a name "sqlite3_X_init" where
7705 +** X consists of the lower-case equivalent of all ASCII alphabetic
7706 ** characters in the filename from the last "/" to the first following
7707 ** "." and omitting any initial "lib".)^
7708 ** ^The sqlite3_load_extension() interface returns
@@ -7773,7 +7773,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
7773 ** ^(Even though the function prototype shows that xEntryPoint() takes
7774 ** no arguments and returns void, SQLite invokes xEntryPoint() with three
7775 ** arguments and expects an integer result as if the signature of the
7776 -** entry point where as follows:
7776 +** entry point were as follows:
7777 **
7778 ** <blockquote><pre>
7779 ** &nbsp; int xEntryPoint(
@@ -7937,7 +7937,7 @@ struct sqlite3_module {
7937 ** virtual table and might not be checked again by the byte code.)^ ^(The
7938 ** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
7939 ** is left in its default setting of false, the constraint will always be
7940 -** checked separately in byte code. If the omit flag is change to true, then
7940 +** checked separately in byte code. If the omit flag is changed to true, then
7941 ** the constraint may or may not be checked in byte code. In other words,
7942 ** when the omit flag is true there is no guarantee that the constraint will
7943 ** not be checked again using byte code.)^
@@ -7963,7 +7963,7 @@ struct sqlite3_module {
7963 ** The xBestIndex method may optionally populate the idxFlags field with a
7964 ** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
7965 ** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
7966 -** output to show the idxNum has hex instead of as decimal. Another flag is
7966 +** output to show the idxNum as hex instead of as decimal. Another flag is
7967 ** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
7968 ** return at most one row.
7969 **
@@ -8104,7 +8104,7 @@ struct sqlite3_index_info {
8104 ** the implementation of the [virtual table module]. ^The fourth
8105 ** parameter is an arbitrary client data pointer that is passed through
8106 ** into the [xCreate] and [xConnect] methods of the virtual table module
8107 -** when a new virtual table is be being created or reinitialized.
8107 +** when a new virtual table is being created or reinitialized.
8108 **
8109 ** ^The sqlite3_create_module_v2() interface has a fifth parameter which
8110 ** is a pointer to a destructor for the pClientData. ^SQLite will
@@ -8269,7 +8269,7 @@ typedef struct sqlite3_blob sqlite3_blob;
8269 ** in *ppBlob. Otherwise an [error code] is returned and, unless the error
8270 ** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
8271 ** the API is not misused, it is always safe to call [sqlite3_blob_close()]
8272 -** on *ppBlob after this function it returns.
8272 +** on *ppBlob after this function returns.
8273 **
8274 ** This function fails with SQLITE_ERROR if any of the following are true:
8275 ** <ul>
@@ -8389,7 +8389,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
8389 **
8390 ** ^Returns the size in bytes of the BLOB accessible via the
8391 ** successfully opened [BLOB handle] in its only argument. ^The
8392 -** incremental blob I/O routines can only read or overwriting existing
8392 +** incremental blob I/O routines can only read or overwrite existing
8393 ** blob content; they cannot change the size of a blob.
8394 **
8395 ** This routine only works on a [BLOB handle] which has been created
@@ -8539,7 +8539,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
8539 ** ^The sqlite3_mutex_alloc() routine allocates a new
8540 ** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
8541 ** routine returns NULL if it is unable to allocate the requested
8542 -** mutex. The argument to sqlite3_mutex_alloc() must one of these
8542 +** mutex. The argument to sqlite3_mutex_alloc() must be one of these
8543 ** integer constants:
8544 **
8545 ** <ul>
@@ -8772,7 +8772,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
8772 ** CAPI3REF: Retrieve the mutex for a database connection
8773 ** METHOD: sqlite3
8774 **
8775 -** ^This interface returns a pointer the [sqlite3_mutex] object that
8775 +** ^This interface returns a pointer to the [sqlite3_mutex] object that
8776 ** serializes access to the [database connection] given in the argument
8777 ** when the [threading mode] is Serialized.
8778 ** ^If the [threading mode] is Single-thread or Multi-thread then this
@@ -8895,7 +8895,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8895 ** CAPI3REF: SQL Keyword Checking
8896 **
8897 ** These routines provide access to the set of SQL language keywords
8898 -** recognized by SQLite. Applications can uses these routines to determine
8898 +** recognized by SQLite. Applications can use these routines to determine
8899 ** whether or not a specific identifier needs to be escaped (for example,
8900 ** by enclosing in double-quotes) so as not to confuse the parser.
8901 **
@@ -9063,7 +9063,7 @@ SQLITE_API void sqlite3_str_reset(sqlite3_str*);
9063 ** content of the dynamic string under construction in X. The value
9064 ** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
9065 ** and might be freed or altered by any subsequent method on the same
9066 -** [sqlite3_str] object. Applications must not used the pointer returned
9066 +** [sqlite3_str] object. Applications must not use the pointer returned by
9067 ** [sqlite3_str_value(X)] after any subsequent method call on the same
9068 ** object. ^Applications may change the content of the string returned
9069 ** by [sqlite3_str_value(X)] as long as they do not write into any bytes
@@ -9149,7 +9149,7 @@ SQLITE_API int sqlite3_status64(
9149 ** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
9150 ** buffer and where forced to overflow to [sqlite3_malloc()]. The
9151 ** returned value includes allocations that overflowed because they
9152 -** where too large (they were larger than the "sz" parameter to
9152 +** were too large (they were larger than the "sz" parameter to
9153 ** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
9154 ** no space was left in the page cache.</dd>)^
9155 **
@@ -9233,28 +9233,29 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
9233 ** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
9234 ** <dd>This parameter returns the number of malloc attempts that were
9235 ** satisfied using lookaside memory. Only the high-water value is meaningful;
9236 -** the current value is always zero.)^
9236 +** the current value is always zero.</dd>)^
9237 **
9238 ** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
9239 ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
9240 -** <dd>This parameter returns the number malloc attempts that might have
9240 +** <dd>This parameter returns the number of malloc attempts that might have
9241 ** been satisfied using lookaside memory but failed due to the amount of
9242 ** memory requested being larger than the lookaside slot size.
9243 ** Only the high-water value is meaningful;
9244 -** the current value is always zero.)^
9244 +** the current value is always zero.</dd>)^
9245 **
9246 ** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
9247 ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
9248 -** <dd>This parameter returns the number malloc attempts that might have
9248 +** <dd>This parameter returns the number of malloc attempts that might have
9249 ** been satisfied using lookaside memory but failed due to all lookaside
9250 ** memory already being in use.
9251 ** Only the high-water value is meaningful;
9252 -** the current value is always zero.)^
9252 +** the current value is always zero.</dd>)^
9253 **
9254 ** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
9255 ** <dd>This parameter returns the approximate number of bytes of heap
9256 ** memory used by all pager caches associated with the database connection.)^
9257 ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
9258 +** </dd>
9259 **
9260 ** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
9261 ** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
@@ -9263,10 +9264,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
9264 ** memory used by that pager cache is divided evenly between the attached
9265 ** connections.)^ In other words, if none of the pager caches associated
9266 ** with the database connection are shared, this request returns the same
9266 -** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
9267 +** value as DBSTATUS_CACHE_USED. Or, if one or more of the pager caches are
9268 ** shared, the value returned by this call will be smaller than that returned
9269 ** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
9269 -** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
9270 +** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.</dd>
9271 **
9272 ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
9273 ** <dd>This parameter returns the approximate number of bytes of heap
@@ -9276,6 +9277,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
9277 ** schema memory is shared with other database connections due to
9278 ** [shared cache mode] being enabled.
9279 ** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
9280 +** </dd>
9281 **
9282 ** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
9283 ** <dd>This parameter returns the approximate number of bytes of heap
@@ -9312,7 +9314,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
9314 ** been written to disk in the middle of a transaction due to the page
9315 ** cache overflowing. Transactions are more efficient if they are written
9316 ** to disk all at once. When pages spill mid-transaction, that introduces
9315 -** additional overhead. This parameter can be used help identify
9317 +** additional overhead. This parameter can be used to help identify
9318 ** inefficiencies that can be resolved by increasing the cache size.
9319 ** </dd>
9320 **
@@ -9792,7 +9794,7 @@ typedef struct sqlite3_backup sqlite3_backup;
9794 ** external process or via a database connection other than the one being
9795 ** used by the backup operation, then the backup will be automatically
9796 ** restarted by the next call to sqlite3_backup_step(). ^If the source
9795 -** database is modified by the using the same database connection as is used
9797 +** database is modified by using the same database connection as is used
9798 ** by the backup operation, then the backup database is automatically
9799 ** updated at the same time.
9800 **
@@ -9809,7 +9811,7 @@ typedef struct sqlite3_backup sqlite3_backup;
9811 ** and may not be used following a call to sqlite3_backup_finish().
9812 **
9813 ** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
9812 -** sqlite3_backup_step() errors occurred, regardless or whether or not
9814 +** sqlite3_backup_step() errors occurred, regardless of whether or not
9815 ** sqlite3_backup_step() completed.
9816 ** ^If an out-of-memory condition or IO error occurred during any prior
9817 ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
@@ -10879,7 +10881,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
10881 ** METHOD: sqlite3
10882 **
10883 ** ^If a write-transaction is open on [database connection] D when the
10882 -** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
10884 +** [sqlite3_db_cacheflush(D)] interface is invoked, any dirty
10885 ** pages in the pager-cache that are not currently in use are written out
10886 ** to disk. A dirty page may be in use if a database cursor created by an
10887 ** active SQL statement is reading from it, or if it is page 1 of a database
@@ -15450,8 +15452,8 @@ typedef INT16_TYPE LogEst;
15452 ** assuming n is a signed integer type. UMXV(n) is similar for unsigned
15453 ** integer types.
15454 */
15453 -#define SMXV(n) ((((i64)1)<<(sizeof(n)-1))-1)
15454 -#define UMXV(n) ((((i64)1)<<(sizeof(n)))-1)
15455 +#define SMXV(n) ((((i64)1)<<(sizeof(n)*8-1))-1)
15456 +#define UMXV(n) ((((i64)1)<<(sizeof(n)*8))-1)
15457
15458 /*
15459 ** Round up a number to the next larger multiple of 8. This is used
@@ -19262,7 +19264,7 @@ struct AggInfo {
19264 ** from source tables rather than from accumulators */
19265 u8 useSortingIdx; /* In direct mode, reference the sorting index rather
19266 ** than the source table */
19265 - u16 nSortingColumn; /* Number of columns in the sorting index */
19267 + u32 nSortingColumn; /* Number of columns in the sorting index */
19268 int sortingIdx; /* Cursor number of the sorting index */
19269 int sortingIdxPTab; /* Cursor number of pseudo-table */
19270 int iFirstReg; /* First register in range for aCol[] and aFunc[] */
@@ -19271,8 +19273,8 @@ struct AggInfo {
19273 Table *pTab; /* Source table */
19274 Expr *pCExpr; /* The original expression */
19275 int iTable; /* Cursor number of the source table */
19274 - i16 iColumn; /* Column number within the source table */
19275 - i16 iSorterColumn; /* Column number in the sorting index */
19276 + int iColumn; /* Column number within the source table */
19277 + int iSorterColumn; /* Column number in the sorting index */
19278 } *aCol;
19279 int nColumn; /* Number of used entries in aCol[] */
19280 int nAccumulator; /* Number of columns that show through to the output.
@@ -54974,7 +54976,9 @@ bitvec_set_rehash:
54976 }else{
54977 memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash));
54978 memset(p->u.apSub, 0, sizeof(p->u.apSub));
54977 - p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR;
54979 + p->iDivisor = p->iSize/BITVEC_NPTR;
54980 + if( (p->iSize%BITVEC_NPTR)!=0 ) p->iDivisor++;
54981 + if( p->iDivisor<BITVEC_NBIT ) p->iDivisor = BITVEC_NBIT;
54982 rc = sqlite3BitvecSet(p, i);
54983 for(j=0; j<BITVEC_NINT; j++){
54984 if( aiValues[j] ) rc |= sqlite3BitvecSet(p, aiValues[j]);
@@ -69662,6 +69666,7 @@ SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *p
69666 if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal);
69667 }
69668 SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
69669 + pWal->iReCksum = 0;
69670 }
69671 return rc;
69672 }
@@ -69709,6 +69714,9 @@ SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){
69714 walCleanupHash(pWal);
69715 }
69716 SEH_EXCEPT( rc = SQLITE_IOERR_IN_PAGE; )
69717 + if( pWal->iReCksum>pWal->hdr.mxFrame ){
69718 + pWal->iReCksum = 0;
69719 + }
69720 }
69721
69722 return rc;
@@ -117354,7 +117362,9 @@ static void findOrCreateAggInfoColumn(
117362 ){
117363 struct AggInfo_col *pCol;
117364 int k;
117365 + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN];
117366
117367 + assert( mxTerm <= SMXV(i16) );
117368 assert( pAggInfo->iFirstReg==0 );
117369 pCol = pAggInfo->aCol;
117370 for(k=0; k<pAggInfo->nColumn; k++, pCol++){
@@ -117372,6 +117382,10 @@ static void findOrCreateAggInfoColumn(
117382 assert( pParse->db->mallocFailed );
117383 return;
117384 }
117385 + if( k>mxTerm ){
117386 + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm);
117387 + k = mxTerm;
117388 + }
117389 pCol = &pAggInfo->aCol[k];
117390 assert( ExprUseYTab(pExpr) );
117391 pCol->pTab = pExpr->y.pTab;
@@ -117405,6 +117419,7 @@ fix_up_expr:
117419 if( pExpr->op==TK_COLUMN ){
117420 pExpr->op = TK_AGG_COLUMN;
117421 }
117422 + assert( k <= SMXV(pExpr->iAgg) );
117423 pExpr->iAgg = (i16)k;
117424 }
117425
@@ -117489,13 +117504,19 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
117504 ** function that is already in the pAggInfo structure
117505 */
117506 struct AggInfo_func *pItem = pAggInfo->aFunc;
117507 + int mxTerm = pParse->db->aLimit[SQLITE_LIMIT_COLUMN];
117508 + assert( mxTerm <= SMXV(i16) );
117509 for(i=0; i<pAggInfo->nFunc; i++, pItem++){
117510 if( NEVER(pItem->pFExpr==pExpr) ) break;
117511 if( sqlite3ExprCompare(0, pItem->pFExpr, pExpr, -1)==0 ){
117512 break;
117513 }
117514 }
117498 - if( i>=pAggInfo->nFunc ){
117515 + if( i>mxTerm ){
117516 + sqlite3ErrorMsg(pParse, "more than %d aggregate terms", mxTerm);
117517 + i = mxTerm;
117518 + assert( i<pAggInfo->nFunc );
117519 + }else if( i>=pAggInfo->nFunc ){
117520 /* pExpr is original. Make a new entry in pAggInfo->aFunc[]
117521 */
117522 u8 enc = ENC(pParse->db);
@@ -117549,6 +117570,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
117570 */
117571 assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) );
117572 ExprSetVVAProperty(pExpr, EP_NoReduce);
117573 + assert( i <= SMXV(pExpr->iAgg) );
117574 pExpr->iAgg = (i16)i;
117575 pExpr->pAggInfo = pAggInfo;
117576 return WRC_Prune;
@@ -132007,7 +132029,7 @@ static void concatFuncCore(
132029 int nSep,
132030 const char *zSep
132031 ){
132010 - i64 j, k, n = 0;
132032 + i64 j, n = 0;
132033 int i;
132034 char *z;
132035 for(i=0; i<argc; i++){
@@ -132021,8 +132043,8 @@ static void concatFuncCore(
132043 }
132044 j = 0;
132045 for(i=0; i<argc; i++){
132024 - k = sqlite3_value_bytes(argv[i]);
132025 - if( k>0 ){
132046 + if( sqlite3_value_type(argv[i])!=SQLITE_NULL ){
132047 + int k = sqlite3_value_bytes(argv[i]);
132048 const char *v = (const char*)sqlite3_value_text(argv[i]);
132049 if( v!=0 ){
132050 if( j>0 && nSep>0 ){
@@ -163441,30 +163463,42 @@ static void exprAnalyzeOrTerm(
163463 ** 1. The SQLITE_Transitive optimization must be enabled
163464 ** 2. Must be either an == or an IS operator
163465 ** 3. Not originating in the ON clause of an OUTER JOIN
163444 -** 4. The affinities of A and B must be compatible
163445 -** 5a. Both operands use the same collating sequence OR
163446 -** 5b. The overall collating sequence is BINARY
163466 +** 4. The operator is not IS or else the query does not contain RIGHT JOIN
163467 +** 5. The affinities of A and B must be compatible
163468 +** 6a. Both operands use the same collating sequence OR
163469 +** 6b. The overall collating sequence is BINARY
163470 ** If this routine returns TRUE, that means that the RHS can be substituted
163471 ** for the LHS anyplace else in the WHERE clause where the LHS column occurs.
163472 ** This is an optimization. No harm comes from returning 0. But if 1 is
163473 ** returned when it should not be, then incorrect answers might result.
163474 */
163452 -static int termIsEquivalence(Parse *pParse, Expr *pExpr){
163475 +static int termIsEquivalence(Parse *pParse, Expr *pExpr, SrcList *pSrc){
163476 char aff1, aff2;
163477 CollSeq *pColl;
163455 - if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0;
163456 - if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0;
163457 - if( ExprHasProperty(pExpr, EP_OuterON) ) return 0;
163478 + if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0; /* (1) */
163479 + if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0; /* (2) */
163480 + if( ExprHasProperty(pExpr, EP_OuterON) ) return 0; /* (3) */
163481 + assert( pSrc!=0 );
163482 + if( pExpr->op==TK_IS
163483 + && pSrc->nSrc
163484 + && (pSrc->a[0].fg.jointype & JT_LTORJ)!=0
163485 + ){
163486 + return 0; /* (4) */
163487 + }
163488 aff1 = sqlite3ExprAffinity(pExpr->pLeft);
163489 aff2 = sqlite3ExprAffinity(pExpr->pRight);
163490 if( aff1!=aff2
163491 && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2))
163492 ){
163463 - return 0;
163493 + return 0; /* (5) */
163494 }
163495 pColl = sqlite3ExprCompareCollSeq(pParse, pExpr);
163466 - if( sqlite3IsBinary(pColl) ) return 1;
163467 - return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight);
163496 + if( !sqlite3IsBinary(pColl)
163497 + && !sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight)
163498 + ){
163499 + return 0; /* (6) */
163500 + }
163501 + return 1;
163502 }
163503
163504 /*
@@ -163729,8 +163763,8 @@ static void exprAnalyze(
163763 if( op==TK_IS ) pNew->wtFlags |= TERM_IS;
163764 pTerm = &pWC->a[idxTerm];
163765 pTerm->wtFlags |= TERM_COPIED;
163732 -
163733 - if( termIsEquivalence(pParse, pDup) ){
163766 + assert( pWInfo->pTabList!=0 );
163767 + if( termIsEquivalence(pParse, pDup, pWInfo->pTabList) ){
163768 pTerm->eOperator |= WO_EQUIV;
163769 eExtraOp = WO_EQUIV;
163770 }
@@ -184448,6 +184482,7 @@ SQLITE_API int sqlite3_setlk_timeout(sqlite3 *db, int ms, int flags){
184482 #endif
184483 if( ms<-1 ) return SQLITE_RANGE;
184484 #ifdef SQLITE_ENABLE_SETLK_TIMEOUT
184485 + sqlite3_mutex_enter(db->mutex);
184486 db->setlkTimeout = ms;
184487 db->setlkFlags = flags;
184488 sqlite3BtreeEnterAll(db);
@@ -184459,6 +184494,7 @@ SQLITE_API int sqlite3_setlk_timeout(sqlite3 *db, int ms, int flags){
184494 }
184495 }
184496 sqlite3BtreeLeaveAll(db);
184497 + sqlite3_mutex_leave(db->mutex);
184498 #endif
184499 #if !defined(SQLITE_ENABLE_API_ARMOR) && !defined(SQLITE_ENABLE_SETLK_TIMEOUT)
184500 UNUSED_PARAMETER(db);
@@ -257254,7 +257290,7 @@ static void fts5SourceIdFunc(
257290 ){
257291 assert( nArg==0 );
257292 UNUSED_PARAM2(nArg, apUnused);
257257 - sqlite3_result_text(pCtx, "fts5: 2025-06-06 14:52:32 b77dc5e0f596d2140d9ac682b2893ff65d3a4140aa86067a3efebe29dc914c95", -1, SQLITE_TRANSIENT);
257293 + sqlite3_result_text(pCtx, "fts5: 2025-06-28 14:00:48 2af157d77fb1304a74176eaee7fbc7c7e932d946bf25325e9c26c91db19e3079", -1, SQLITE_TRANSIENT);
257294 }
257295
257296 /*
@@ -258069,6 +258105,7 @@ static int fts5StorageDeleteFromIndex(
258105 for(iCol=1; rc==SQLITE_OK && iCol<=pConfig->nCol; iCol++){
258106 if( pConfig->abUnindexed[iCol-1]==0 ){
258107 sqlite3_value *pVal = 0;
258108 + sqlite3_value *pFree = 0;
258109 const char *pText = 0;
258110 int nText = 0;
258111 const char *pLoc = 0;
@@ -258085,11 +258122,22 @@ static int fts5StorageDeleteFromIndex(
258122 if( pConfig->bLocale && sqlite3Fts5IsLocaleValue(pConfig, pVal) ){
258123 rc = sqlite3Fts5DecodeLocaleValue(pVal, &pText, &nText, &pLoc, &nLoc);
258124 }else{
258088 - pText = (const char*)sqlite3_value_text(pVal);
258089 - nText = sqlite3_value_bytes(pVal);
258090 - if( pConfig->bLocale && pSeek ){
258091 - pLoc = (const char*)sqlite3_column_text(pSeek, iCol + pConfig->nCol);
258092 - nLoc = sqlite3_column_bytes(pSeek, iCol + pConfig->nCol);
258125 + if( sqlite3_value_type(pVal)!=SQLITE_TEXT ){
258126 + /* Make a copy of the value to work with. This is because the call
258127 + ** to sqlite3_value_text() below forces the type of the value to
258128 + ** SQLITE_TEXT, and we may need to use it again later. */
258129 + pFree = pVal = sqlite3_value_dup(pVal);
258130 + if( pVal==0 ){
258131 + rc = SQLITE_NOMEM;
258132 + }
258133 + }
258134 + if( rc==SQLITE_OK ){
258135 + pText = (const char*)sqlite3_value_text(pVal);
258136 + nText = sqlite3_value_bytes(pVal);
258137 + if( pConfig->bLocale && pSeek ){
258138 + pLoc = (const char*)sqlite3_column_text(pSeek, iCol+pConfig->nCol);
258139 + nLoc = sqlite3_column_bytes(pSeek, iCol + pConfig->nCol);
258140 + }
258141 }
258142 }
258143
@@ -258105,6 +258153,7 @@ static int fts5StorageDeleteFromIndex(
258153 }
258154 sqlite3Fts5ClearLocale(pConfig);
258155 }
258156 + sqlite3_value_free(pFree);
258157 }
258158 }
258159 if( rc==SQLITE_OK && p->nTotalRow<1 ){
src/database/sqlite/vendored/sqlite3.h
+47 -45
@@ -146,9 +146,9 @@ extern "C" {
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 -#define SQLITE_VERSION "3.50.1"
150 -#define SQLITE_VERSION_NUMBER 3050001
151 -#define SQLITE_SOURCE_ID "2025-06-06 14:52:32 b77dc5e0f596d2140d9ac682b2893ff65d3a4140aa86067a3efebe29dc914c95"
149 +#define SQLITE_VERSION "3.50.2"
150 +#define SQLITE_VERSION_NUMBER 3050002
151 +#define SQLITE_SOURCE_ID "2025-06-28 14:00:48 2af157d77fb1304a74176eaee7fbc7c7e932d946bf25325e9c26c91db19e3079"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
@@ -4079,7 +4079,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
4079 **
4080 ** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
4081 ** database filename D with corresponding journal file J and WAL file W and
4082 -** with N URI parameters key/values pairs in the array P. The result from
4082 +** an array P of N URI Key/Value pairs. The result from
4083 ** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
4084 ** is safe to pass to routines like:
4085 ** <ul>
@@ -4760,7 +4760,7 @@ typedef struct sqlite3_context sqlite3_context;
4760 ** METHOD: sqlite3_stmt
4761 **
4762 ** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
4763 -** literals may be replaced by a [parameter] that matches one of following
4763 +** literals may be replaced by a [parameter] that matches one of the following
4764 ** templates:
4765 **
4766 ** <ul>
@@ -4805,7 +4805,7 @@ typedef struct sqlite3_context sqlite3_context;
4805 **
4806 ** [[byte-order determination rules]] ^The byte-order of
4807 ** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
4808 -** found in first character, which is removed, or in the absence of a BOM
4808 +** found in the first character, which is removed, or in the absence of a BOM
4809 ** the byte order is the native byte order of the host
4810 ** machine for sqlite3_bind_text16() or the byte order specified in
4811 ** the 6th parameter for sqlite3_bind_text64().)^
@@ -4825,7 +4825,7 @@ typedef struct sqlite3_context sqlite3_context;
4825 ** or sqlite3_bind_text16() or sqlite3_bind_text64() then
4826 ** that parameter must be the byte offset
4827 ** where the NUL terminator would occur assuming the string were NUL
4828 -** terminated. If any NUL characters occurs at byte offsets less than
4828 +** terminated. If any NUL characters occur at byte offsets less than
4829 ** the value of the fourth parameter then the resulting string value will
4830 ** contain embedded NULs. The result of expressions involving strings
4831 ** with embedded NULs is undefined.
@@ -5037,7 +5037,7 @@ SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
5037 ** METHOD: sqlite3_stmt
5038 **
5039 ** ^These routines provide a means to determine the database, table, and
5040 -** table column that is the origin of a particular result column in
5040 +** table column that is the origin of a particular result column in a
5041 ** [SELECT] statement.
5042 ** ^The name of the database or table or column can be returned as
5043 ** either a UTF-8 or UTF-16 string. ^The _database_ routines return
@@ -5606,8 +5606,8 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5606 **
5607 ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
5608 ** all application-defined SQL functions that do not need to be
5609 -** used inside of triggers, view, CHECK constraints, or other elements of
5610 -** the database schema. This flags is especially recommended for SQL
5609 +** used inside of triggers, views, CHECK constraints, or other elements of
5610 +** the database schema. This flag is especially recommended for SQL
5611 ** functions that have side effects or reveal internal application state.
5612 ** Without this flag, an attacker might be able to modify the schema of
5613 ** a database file to include invocations of the function with parameters
@@ -5638,7 +5638,7 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5638 ** [user-defined window functions|available here].
5639 **
5640 ** ^(If the final parameter to sqlite3_create_function_v2() or
5641 -** sqlite3_create_window_function() is not NULL, then it is destructor for
5641 +** sqlite3_create_window_function() is not NULL, then it is the destructor for
5642 ** the application data pointer. The destructor is invoked when the function
5643 ** is deleted, either by being overloaded or when the database connection
5644 ** closes.)^ ^The destructor is also invoked if the call to
@@ -6038,7 +6038,7 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
6038 ** METHOD: sqlite3_value
6039 **
6040 ** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
6041 -** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
6041 +** object V and returns a pointer to that copy. ^The [sqlite3_value] returned
6042 ** is a [protected sqlite3_value] object even if the input is not.
6043 ** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
6044 ** memory allocation fails. ^If V is a [pointer value], then the result
@@ -6076,7 +6076,7 @@ SQLITE_API void sqlite3_value_free(sqlite3_value*);
6076 ** allocation error occurs.
6077 **
6078 ** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
6079 -** determined by the N parameter on first successful call. Changing the
6079 +** determined by the N parameter on the first successful call. Changing the
6080 ** value of N in any subsequent call to sqlite3_aggregate_context() within
6081 ** the same aggregate function instance will not resize the memory
6082 ** allocation.)^ Within the xFinal callback, it is customary to set
@@ -6238,7 +6238,7 @@ SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(voi
6238 **
6239 ** Security Warning: These interfaces should not be exposed in scripting
6240 ** languages or in other circumstances where it might be possible for an
6241 -** an attacker to invoke them. Any agent that can invoke these interfaces
6241 +** attacker to invoke them. Any agent that can invoke these interfaces
6242 ** can probably also take control of the process.
6243 **
6244 ** Database connection client data is only available for SQLite
@@ -6352,7 +6352,7 @@ typedef void (*sqlite3_destructor_type)(void*);
6352 ** pointed to by the 2nd parameter are taken as the application-defined
6353 ** function result. If the 3rd parameter is non-negative, then it
6354 ** must be the byte offset into the string where the NUL terminator would
6355 -** appear if the string where NUL terminated. If any NUL characters occur
6355 +** appear if the string were NUL terminated. If any NUL characters occur
6356 ** in the string at a byte offset that is less than the value of the 3rd
6357 ** parameter, then the resulting string will contain embedded NULs and the
6358 ** result of expressions operating on strings with embedded NULs is undefined.
@@ -6410,7 +6410,7 @@ typedef void (*sqlite3_destructor_type)(void*);
6410 ** string and preferably a string literal. The sqlite3_result_pointer()
6411 ** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
6412 **
6413 -** If these routines are called from within the different thread
6413 +** If these routines are called from within a different thread
6414 ** than the one containing the application-defined function that received
6415 ** the [sqlite3_context] pointer, the results are undefined.
6416 */
@@ -6816,7 +6816,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
6816 ** METHOD: sqlite3
6817 **
6818 ** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
6819 -** for the N-th database on database connection D, or a NULL pointer of N is
6819 +** for the N-th database on database connection D, or a NULL pointer if N is
6820 ** out of range. An N value of 0 means the main database file. An N of 1 is
6821 ** the "temp" schema. Larger values of N correspond to various ATTACH-ed
6822 ** databases.
@@ -6911,7 +6911,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
6911 ** <dd>The SQLITE_TXN_READ state means that the database is currently
6912 ** in a read transaction. Content has been read from the database file
6913 ** but nothing in the database file has changed. The transaction state
6914 -** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
6914 +** will be advanced to SQLITE_TXN_WRITE if any changes occur and there are
6915 ** no other conflicting concurrent write transactions. The transaction
6916 ** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
6917 ** [COMMIT].</dd>
@@ -6920,7 +6920,7 @@ SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
6920 ** <dd>The SQLITE_TXN_WRITE state means that the database is currently
6921 ** in a write transaction. Content has been written to the database file
6922 ** but has not yet committed. The transaction state will change to
6923 -** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
6923 +** SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
6924 */
6925 #define SQLITE_TXN_NONE 0
6926 #define SQLITE_TXN_READ 1
@@ -7201,7 +7201,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
7201 ** CAPI3REF: Impose A Limit On Heap Size
7202 **
7203 ** These interfaces impose limits on the amount of heap memory that will be
7204 -** by all database connections within a single process.
7204 +** used by all database connections within a single process.
7205 **
7206 ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
7207 ** soft limit on the amount of heap memory that may be allocated by SQLite.
@@ -7259,7 +7259,7 @@ SQLITE_API int sqlite3_db_release_memory(sqlite3*);
7259 ** </ul>)^
7260 **
7261 ** The circumstances under which SQLite will enforce the heap limits may
7262 -** changes in future releases of SQLite.
7262 +** change in future releases of SQLite.
7263 */
7264 SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
7265 SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
@@ -7374,8 +7374,8 @@ SQLITE_API int sqlite3_table_column_metadata(
7374 ** ^The entry point is zProc.
7375 ** ^(zProc may be 0, in which case SQLite will try to come up with an
7376 ** entry point name on its own. It first tries "sqlite3_extension_init".
7377 -** If that does not work, it constructs a name "sqlite3_X_init" where the
7378 -** X is consists of the lower-case equivalent of all ASCII alphabetic
7377 +** If that does not work, it constructs a name "sqlite3_X_init" where
7378 +** X consists of the lower-case equivalent of all ASCII alphabetic
7379 ** characters in the filename from the last "/" to the first following
7380 ** "." and omitting any initial "lib".)^
7381 ** ^The sqlite3_load_extension() interface returns
@@ -7446,7 +7446,7 @@ SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
7446 ** ^(Even though the function prototype shows that xEntryPoint() takes
7447 ** no arguments and returns void, SQLite invokes xEntryPoint() with three
7448 ** arguments and expects an integer result as if the signature of the
7449 -** entry point where as follows:
7449 +** entry point were as follows:
7450 **
7451 ** <blockquote><pre>
7452 ** &nbsp; int xEntryPoint(
@@ -7610,7 +7610,7 @@ struct sqlite3_module {
7610 ** virtual table and might not be checked again by the byte code.)^ ^(The
7611 ** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
7612 ** is left in its default setting of false, the constraint will always be
7613 -** checked separately in byte code. If the omit flag is change to true, then
7613 +** checked separately in byte code. If the omit flag is changed to true, then
7614 ** the constraint may or may not be checked in byte code. In other words,
7615 ** when the omit flag is true there is no guarantee that the constraint will
7616 ** not be checked again using byte code.)^
@@ -7636,7 +7636,7 @@ struct sqlite3_module {
7636 ** The xBestIndex method may optionally populate the idxFlags field with a
7637 ** mask of SQLITE_INDEX_SCAN_* flags. One such flag is
7638 ** [SQLITE_INDEX_SCAN_HEX], which if set causes the [EXPLAIN QUERY PLAN]
7639 -** output to show the idxNum has hex instead of as decimal. Another flag is
7639 +** output to show the idxNum as hex instead of as decimal. Another flag is
7640 ** SQLITE_INDEX_SCAN_UNIQUE, which if set indicates that the query plan will
7641 ** return at most one row.
7642 **
@@ -7777,7 +7777,7 @@ struct sqlite3_index_info {
7777 ** the implementation of the [virtual table module]. ^The fourth
7778 ** parameter is an arbitrary client data pointer that is passed through
7779 ** into the [xCreate] and [xConnect] methods of the virtual table module
7780 -** when a new virtual table is be being created or reinitialized.
7780 +** when a new virtual table is being created or reinitialized.
7781 **
7782 ** ^The sqlite3_create_module_v2() interface has a fifth parameter which
7783 ** is a pointer to a destructor for the pClientData. ^SQLite will
@@ -7942,7 +7942,7 @@ typedef struct sqlite3_blob sqlite3_blob;
7942 ** in *ppBlob. Otherwise an [error code] is returned and, unless the error
7943 ** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
7944 ** the API is not misused, it is always safe to call [sqlite3_blob_close()]
7945 -** on *ppBlob after this function it returns.
7945 +** on *ppBlob after this function returns.
7946 **
7947 ** This function fails with SQLITE_ERROR if any of the following are true:
7948 ** <ul>
@@ -8062,7 +8062,7 @@ SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
8062 **
8063 ** ^Returns the size in bytes of the BLOB accessible via the
8064 ** successfully opened [BLOB handle] in its only argument. ^The
8065 -** incremental blob I/O routines can only read or overwriting existing
8065 +** incremental blob I/O routines can only read or overwrite existing
8066 ** blob content; they cannot change the size of a blob.
8067 **
8068 ** This routine only works on a [BLOB handle] which has been created
@@ -8212,7 +8212,7 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
8212 ** ^The sqlite3_mutex_alloc() routine allocates a new
8213 ** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
8214 ** routine returns NULL if it is unable to allocate the requested
8215 -** mutex. The argument to sqlite3_mutex_alloc() must one of these
8215 +** mutex. The argument to sqlite3_mutex_alloc() must be one of these
8216 ** integer constants:
8217 **
8218 ** <ul>
@@ -8445,7 +8445,7 @@ SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
8445 ** CAPI3REF: Retrieve the mutex for a database connection
8446 ** METHOD: sqlite3
8447 **
8448 -** ^This interface returns a pointer the [sqlite3_mutex] object that
8448 +** ^This interface returns a pointer to the [sqlite3_mutex] object that
8449 ** serializes access to the [database connection] given in the argument
8450 ** when the [threading mode] is Serialized.
8451 ** ^If the [threading mode] is Single-thread or Multi-thread then this
@@ -8568,7 +8568,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8568 ** CAPI3REF: SQL Keyword Checking
8569 **
8570 ** These routines provide access to the set of SQL language keywords
8571 -** recognized by SQLite. Applications can uses these routines to determine
8571 +** recognized by SQLite. Applications can use these routines to determine
8572 ** whether or not a specific identifier needs to be escaped (for example,
8573 ** by enclosing in double-quotes) so as not to confuse the parser.
8574 **
@@ -8736,7 +8736,7 @@ SQLITE_API void sqlite3_str_reset(sqlite3_str*);
8736 ** content of the dynamic string under construction in X. The value
8737 ** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
8738 ** and might be freed or altered by any subsequent method on the same
8739 -** [sqlite3_str] object. Applications must not used the pointer returned
8739 +** [sqlite3_str] object. Applications must not use the pointer returned by
8740 ** [sqlite3_str_value(X)] after any subsequent method call on the same
8741 ** object. ^Applications may change the content of the string returned
8742 ** by [sqlite3_str_value(X)] as long as they do not write into any bytes
@@ -8822,7 +8822,7 @@ SQLITE_API int sqlite3_status64(
8822 ** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
8823 ** buffer and where forced to overflow to [sqlite3_malloc()]. The
8824 ** returned value includes allocations that overflowed because they
8825 -** where too large (they were larger than the "sz" parameter to
8825 +** were too large (they were larger than the "sz" parameter to
8826 ** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
8827 ** no space was left in the page cache.</dd>)^
8828 **
@@ -8906,28 +8906,29 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
8906 ** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
8907 ** <dd>This parameter returns the number of malloc attempts that were
8908 ** satisfied using lookaside memory. Only the high-water value is meaningful;
8909 -** the current value is always zero.)^
8909 +** the current value is always zero.</dd>)^
8910 **
8911 ** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
8912 ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
8913 -** <dd>This parameter returns the number malloc attempts that might have
8913 +** <dd>This parameter returns the number of malloc attempts that might have
8914 ** been satisfied using lookaside memory but failed due to the amount of
8915 ** memory requested being larger than the lookaside slot size.
8916 ** Only the high-water value is meaningful;
8917 -** the current value is always zero.)^
8917 +** the current value is always zero.</dd>)^
8918 **
8919 ** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
8920 ** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
8921 -** <dd>This parameter returns the number malloc attempts that might have
8921 +** <dd>This parameter returns the number of malloc attempts that might have
8922 ** been satisfied using lookaside memory but failed due to all lookaside
8923 ** memory already being in use.
8924 ** Only the high-water value is meaningful;
8925 -** the current value is always zero.)^
8925 +** the current value is always zero.</dd>)^
8926 **
8927 ** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
8928 ** <dd>This parameter returns the approximate number of bytes of heap
8929 ** memory used by all pager caches associated with the database connection.)^
8930 ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
8931 +** </dd>
8932 **
8933 ** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
8934 ** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
@@ -8936,10 +8937,10 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
8937 ** memory used by that pager cache is divided evenly between the attached
8938 ** connections.)^ In other words, if none of the pager caches associated
8939 ** with the database connection are shared, this request returns the same
8939 -** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
8940 +** value as DBSTATUS_CACHE_USED. Or, if one or more of the pager caches are
8941 ** shared, the value returned by this call will be smaller than that returned
8942 ** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
8942 -** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
8943 +** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.</dd>
8944 **
8945 ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
8946 ** <dd>This parameter returns the approximate number of bytes of heap
@@ -8949,6 +8950,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
8950 ** schema memory is shared with other database connections due to
8951 ** [shared cache mode] being enabled.
8952 ** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
8953 +** </dd>
8954 **
8955 ** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
8956 ** <dd>This parameter returns the approximate number of bytes of heap
@@ -8985,7 +8987,7 @@ SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int r
8987 ** been written to disk in the middle of a transaction due to the page
8988 ** cache overflowing. Transactions are more efficient if they are written
8989 ** to disk all at once. When pages spill mid-transaction, that introduces
8988 -** additional overhead. This parameter can be used help identify
8990 +** additional overhead. This parameter can be used to help identify
8991 ** inefficiencies that can be resolved by increasing the cache size.
8992 ** </dd>
8993 **
@@ -9465,7 +9467,7 @@ typedef struct sqlite3_backup sqlite3_backup;
9467 ** external process or via a database connection other than the one being
9468 ** used by the backup operation, then the backup will be automatically
9469 ** restarted by the next call to sqlite3_backup_step(). ^If the source
9468 -** database is modified by the using the same database connection as is used
9470 +** database is modified by using the same database connection as is used
9471 ** by the backup operation, then the backup database is automatically
9472 ** updated at the same time.
9473 **
@@ -9482,7 +9484,7 @@ typedef struct sqlite3_backup sqlite3_backup;
9484 ** and may not be used following a call to sqlite3_backup_finish().
9485 **
9486 ** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
9485 -** sqlite3_backup_step() errors occurred, regardless or whether or not
9487 +** sqlite3_backup_step() errors occurred, regardless of whether or not
9488 ** sqlite3_backup_step() completed.
9489 ** ^If an out-of-memory condition or IO error occurred during any prior
9490 ** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
@@ -10552,7 +10554,7 @@ SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
10554 ** METHOD: sqlite3
10555 **
10556 ** ^If a write-transaction is open on [database connection] D when the
10555 -** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
10557 +** [sqlite3_db_cacheflush(D)] interface is invoked, any dirty
10558 ** pages in the pager-cache that are not currently in use are written out
10559 ** to disk. A dirty page may be in use if a database cursor created by an
10560 ** active SQL statement is reading from it, or if it is page 1 of a database