Fossil SCM

Merge the latest SQLite enhancements from upstream, for testing.

drh 2025-06-30 17:00 trunk
Commit bcbf150dc26ed3a67252e069eeaa7e42802a93e1f6cfc08d8b43d6547ad96005
2 files changed +220 -75 +43 -43
+220 -75
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
1616
** if you want a wrapper to interface SQLite with your choice of programming
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21
-** 5508b56fd24016c13981ec280ecdd833007c with changes in files:
21
+** 0083d5169a46104a25355bdd9d5a2f4027b0 with changes in files:
2222
**
2323
**
2424
*/
2525
#ifndef SQLITE_AMALGAMATION
2626
#define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465465
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466466
** [sqlite_version()] and [sqlite_source_id()].
467467
*/
468468
#define SQLITE_VERSION "3.51.0"
469469
#define SQLITE_VERSION_NUMBER 3051000
470
-#define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8"
470
+#define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296"
471471
472472
/*
473473
** CAPI3REF: Run-Time Library Version Numbers
474474
** KEYWORDS: sqlite3_version sqlite3_sourceid
475475
**
@@ -9375,48 +9375,48 @@
93759375
** careful use of indices.</dd>
93769376
**
93779377
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
93789378
** <dd>^This is the number of sort operations that have occurred.
93799379
** A non-zero value in this counter may indicate an opportunity to
9380
-** improvement performance through careful use of indices.</dd>
9380
+** improve performance through careful use of indices.</dd>
93819381
**
93829382
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
93839383
** <dd>^This is the number of rows inserted into transient indices that
93849384
** were created automatically in order to help joins run faster.
93859385
** A non-zero value in this counter may indicate an opportunity to
9386
-** improvement performance by adding permanent indices that do not
9386
+** improve performance by adding permanent indices that do not
93879387
** need to be reinitialized each time the statement is run.</dd>
93889388
**
93899389
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
93909390
** <dd>^This is the number of virtual machine operations executed
93919391
** by the prepared statement if that number is less than or equal
93929392
** to 2147483647. The number of virtual machine operations can be
93939393
** used as a proxy for the total work done by the prepared statement.
93949394
** If the number of virtual machine operations exceeds 2147483647
9395
-** then the value returned by this statement status code is undefined.
9395
+** then the value returned by this statement status code is undefined.</dd>
93969396
**
93979397
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
93989398
** <dd>^This is the number of times that the prepare statement has been
93999399
** automatically regenerated due to schema changes or changes to
9400
-** [bound parameters] that might affect the query plan.
9400
+** [bound parameters] that might affect the query plan.</dd>
94019401
**
94029402
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
94039403
** <dd>^This is the number of times that the prepared statement has
94049404
** been run. A single "run" for the purposes of this counter is one
94059405
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
94069406
** The counter is incremented on the first [sqlite3_step()] call of each
9407
-** cycle.
9407
+** cycle.</dd>
94089408
**
94099409
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
94109410
** [[SQLITE_STMTSTATUS_FILTER HIT]]
94119411
** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
94129412
** SQLITE_STMTSTATUS_FILTER_MISS</dt>
94139413
** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
94149414
** step was bypassed because a Bloom filter returned not-found. The
94159415
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
94169416
** times that the Bloom filter returned a find, and thus the join step
9417
-** had to be processed as normal.
9417
+** had to be processed as normal.</dd>
94189418
**
94199419
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
94209420
** <dd>^This is the approximate number of bytes of heap memory
94219421
** used to store the prepared statement. ^This value is not actually
94229422
** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -9517,31 +9517,31 @@
95179517
** [[the xCreate() page cache methods]]
95189518
** ^SQLite invokes the xCreate() method to construct a new cache instance.
95199519
** SQLite will typically create one cache instance for each open database file,
95209520
** though this is not guaranteed. ^The
95219521
** first parameter, szPage, is the size in bytes of the pages that must
9522
-** be allocated by the cache. ^szPage will always a power of two. ^The
9522
+** be allocated by the cache. ^szPage will always be a power of two. ^The
95239523
** second parameter szExtra is a number of bytes of extra storage
9524
-** associated with each page cache entry. ^The szExtra parameter will
9524
+** associated with each page cache entry. ^The szExtra parameter will be
95259525
** a number less than 250. SQLite will use the
95269526
** extra szExtra bytes on each page to store metadata about the underlying
95279527
** database page on disk. The value passed into szExtra depends
95289528
** on the SQLite version, the target platform, and how SQLite was compiled.
95299529
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
95309530
** created will be used to cache database pages of a file stored on disk, or
95319531
** false if it is used for an in-memory database. The cache implementation
9532
-** does not have to do anything special based with the value of bPurgeable;
9532
+** does not have to do anything special based upon the value of bPurgeable;
95339533
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
95349534
** never invoke xUnpin() except to deliberately delete a page.
95359535
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
95369536
** false will always have the "discard" flag set to true.
9537
-** ^Hence, a cache created with bPurgeable false will
9537
+** ^Hence, a cache created with bPurgeable set to false will
95389538
** never contain any unpinned pages.
95399539
**
95409540
** [[the xCachesize() page cache method]]
95419541
** ^(The xCachesize() method may be called at any time by SQLite to set the
9542
-** suggested maximum cache-size (number of pages stored by) the cache
9542
+** suggested maximum cache-size (number of pages stored) for the cache
95439543
** instance passed as the first argument. This is the value configured using
95449544
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
95459545
** parameter, the implementation is not required to do anything with this
95469546
** value; it is advisory only.
95479547
**
@@ -9564,16 +9564,16 @@
95649564
**
95659565
** If the requested page is already in the page cache, then the page cache
95669566
** implementation must return a pointer to the page buffer with its content
95679567
** intact. If the requested page is not already in the cache, then the
95689568
** cache implementation should use the value of the createFlag
9569
-** parameter to help it determined what action to take:
9569
+** parameter to help it determine what action to take:
95709570
**
95719571
** <table border=1 width=85% align=center>
95729572
** <tr><th> createFlag <th> Behavior when page is not already in cache
95739573
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9574
-** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
9574
+** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
95759575
** Otherwise return NULL.
95769576
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
95779577
** NULL if allocating a new page is effectively impossible.
95789578
** </table>
95799579
**
@@ -9586,11 +9586,11 @@
95869586
** [[the xUnpin() page cache method]]
95879587
** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
95889588
** as its second argument. If the third parameter, discard, is non-zero,
95899589
** then the page must be evicted from the cache.
95909590
** ^If the discard parameter is
9591
-** zero, then the page may be discarded or retained at the discretion of
9591
+** zero, then the page may be discarded or retained at the discretion of the
95929592
** page cache implementation. ^The page cache implementation
95939593
** may choose to evict unpinned pages at any time.
95949594
**
95959595
** The cache must not perform any reference counting. A single
95969596
** call to xUnpin() unpins the page regardless of the number of prior calls
@@ -9604,11 +9604,11 @@
96049604
** to be pinned.
96059605
**
96069606
** When SQLite calls the xTruncate() method, the cache must discard all
96079607
** existing cache entries with page numbers (keys) greater than or equal
96089608
** to the value of the iLimit parameter passed to xTruncate(). If any
9609
-** of these pages are pinned, they are implicitly unpinned, meaning that
9609
+** of these pages are pinned, they become implicitly unpinned, meaning that
96109610
** they can be safely discarded.
96119611
**
96129612
** [[the xDestroy() page cache method]]
96139613
** ^The xDestroy() method is used to delete a cache allocated by xCreate().
96149614
** All resources associated with the specified cache should be freed. ^After
@@ -9903,11 +9903,11 @@
99039903
** identity of the database connection (the blocking connection) that
99049904
** has locked the required resource is stored internally. ^After an
99059905
** application receives an SQLITE_LOCKED error, it may call the
99069906
** sqlite3_unlock_notify() method with the blocked connection handle as
99079907
** the first argument to register for a callback that will be invoked
9908
-** when the blocking connections current transaction is concluded. ^The
9908
+** when the blocking connection's current transaction is concluded. ^The
99099909
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
99109910
** call that concludes the blocking connection's transaction.
99119911
**
99129912
** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
99139913
** there is a chance that the blocking connection will have already
@@ -9923,11 +9923,11 @@
99239923
** ^(There may be at most one unlock-notify callback registered by a
99249924
** blocked connection. If sqlite3_unlock_notify() is called when the
99259925
** blocked connection already has a registered unlock-notify callback,
99269926
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
99279927
** called with a NULL pointer as its second argument, then any existing
9928
-** unlock-notify callback is canceled. ^The blocked connections
9928
+** unlock-notify callback is canceled. ^The blocked connection's
99299929
** unlock-notify callback may also be canceled by closing the blocked
99309930
** connection using [sqlite3_close()].
99319931
**
99329932
** The unlock-notify callback is not reentrant. If an application invokes
99339933
** any sqlite3_xxx API functions from within an unlock-notify callback, a
@@ -10321,11 +10321,11 @@
1032110321
** where X is an integer. If X is zero, then the [virtual table] whose
1032210322
** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
1032310323
** support constraints. In this configuration (which is the default) if
1032410324
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
1032510325
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10326
-** specified as part of the users SQL statement, regardless of the actual
10326
+** specified as part of the user's SQL statement, regardless of the actual
1032710327
** ON CONFLICT mode specified.
1032810328
**
1032910329
** If X is non-zero, then the virtual table implementation guarantees
1033010330
** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
1033110331
** any modifications to internal or persistent data structures have been made.
@@ -10355,11 +10355,11 @@
1035510355
** </dd>
1035610356
**
1035710357
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
1035810358
** <dd>Calls of the form
1035910359
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10360
-** the [xConnect] or [xCreate] methods of a [virtual table] implementation
10360
+** [xConnect] or [xCreate] methods of a [virtual table] implementation
1036110361
** identify that virtual table as being safe to use from within triggers
1036210362
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
1036310363
** virtual table can do no serious harm even if it is controlled by a
1036410364
** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
1036510365
** flag unless absolutely necessary.
@@ -10523,21 +10523,21 @@
1052310523
** <tr><td>2<td>no<td>yes<td>yes
1052410524
** <tr><td>3<td>yes<td>yes<td>yes
1052510525
** </table>
1052610526
**
1052710527
** ^For the purposes of comparing virtual table output values to see if the
10528
-** values are same value for sorting purposes, two NULL values are considered
10528
+** values are the same value for sorting purposes, two NULL values are considered
1052910529
** to be the same. In other words, the comparison operator is "IS"
1053010530
** (or "IS NOT DISTINCT FROM") and not "==".
1053110531
**
1053210532
** If a virtual table implementation is unable to meet the requirements
1053310533
** specified above, then it must not set the "orderByConsumed" flag in the
1053410534
** [sqlite3_index_info] object or an incorrect answer may result.
1053510535
**
1053610536
** ^A virtual table implementation is always free to return rows in any order
1053710537
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10538
-** the "orderByConsumed" flag is unset, the query planner will add extra
10538
+** "orderByConsumed" flag is unset, the query planner will add extra
1053910539
** [bytecode] to ensure that the final results returned by the SQL query are
1054010540
** ordered correctly. The use of the "orderByConsumed" flag and the
1054110541
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
1054210542
** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
1054310543
** flag might help queries against a virtual table to run faster. Being
@@ -10630,11 +10630,11 @@
1063010630
**
1063110631
** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
1063210632
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
1063310633
** xFilter method which invokes these routines, and specifically
1063410634
** a parameter that was previously selected for all-at-once IN constraint
10635
-** processing use the [sqlite3_vtab_in()] interface in the
10635
+** processing using the [sqlite3_vtab_in()] interface in the
1063610636
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
1063710637
** an xFilter argument that was selected for all-at-once IN constraint
1063810638
** processing, then these routines return [SQLITE_ERROR].)^
1063910639
**
1064010640
** ^(Use these routines to access all values on the right-hand side
@@ -10685,11 +10685,11 @@
1068510685
** right-hand operand is not known, then *V is set to a NULL pointer.
1068610686
** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
1068710687
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
1068810688
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
1068910689
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10690
-** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
10690
+** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
1069110691
** something goes wrong.
1069210692
**
1069310693
** The sqlite3_vtab_rhs_value() interface is usually only successful if
1069410694
** the right-hand operand of a constraint is a literal value in the original
1069510695
** SQL statement. If the right-hand operand is an expression or a reference
@@ -10713,12 +10713,12 @@
1071310713
/*
1071410714
** CAPI3REF: Conflict resolution modes
1071510715
** KEYWORDS: {conflict resolution mode}
1071610716
**
1071710717
** These constants are returned by [sqlite3_vtab_on_conflict()] to
10718
-** inform a [virtual table] implementation what the [ON CONFLICT] mode
10719
-** is for the SQL statement being evaluated.
10718
+** inform a [virtual table] implementation of the [ON CONFLICT] mode
10719
+** for the SQL statement being evaluated.
1072010720
**
1072110721
** Note that the [SQLITE_IGNORE] constant is also used as a potential
1072210722
** return value from the [sqlite3_set_authorizer()] callback and that
1072310723
** [SQLITE_ABORT] is also a [result code].
1072410724
*/
@@ -10754,43 +10754,43 @@
1075410754
** to the total number of rows examined by all iterations of the X-th loop.</dd>
1075510755
**
1075610756
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
1075710757
** <dd>^The "double" variable pointed to by the V parameter will be set to the
1075810758
** query planner's estimate for the average number of rows output from each
10759
-** iteration of the X-th loop. If the query planner's estimates was accurate,
10759
+** iteration of the X-th loop. If the query planner's estimate was accurate,
1076010760
** then this value will approximate the quotient NVISIT/NLOOP and the
1076110761
** product of this value for all prior loops with the same SELECTID will
10762
-** be the NLOOP value for the current loop.
10762
+** be the NLOOP value for the current loop.</dd>
1076310763
**
1076410764
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
1076510765
** <dd>^The "const char *" variable pointed to by the V parameter will be set
1076610766
** to a zero-terminated UTF-8 string containing the name of the index or table
10767
-** used for the X-th loop.
10767
+** used for the X-th loop.</dd>
1076810768
**
1076910769
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
1077010770
** <dd>^The "const char *" variable pointed to by the V parameter will be set
1077110771
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10772
-** description for the X-th loop.
10772
+** description for the X-th loop.</dd>
1077310773
**
1077410774
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
1077510775
** <dd>^The "int" variable pointed to by the V parameter will be set to the
1077610776
** id for the X-th query plan element. The id value is unique within the
1077710777
** statement. The select-id is the same value as is output in the first
10778
-** column of an [EXPLAIN QUERY PLAN] query.
10778
+** column of an [EXPLAIN QUERY PLAN] query.</dd>
1077910779
**
1078010780
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
1078110781
** <dd>The "int" variable pointed to by the V parameter will be set to the
10782
-** the id of the parent of the current query element, if applicable, or
10782
+** id of the parent of the current query element, if applicable, or
1078310783
** to zero if the query element has no parent. This is the same value as
10784
-** returned in the second column of an [EXPLAIN QUERY PLAN] query.
10784
+** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
1078510785
**
1078610786
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
1078710787
** <dd>The sqlite3_int64 output value is set to the number of cycles,
1078810788
** according to the processor time-stamp counter, that elapsed while the
1078910789
** query element was being processed. This value is not available for
1079010790
** all query elements - if it is unavailable the output variable is
10791
-** set to -1.
10791
+** set to -1.</dd>
1079210792
** </dl>
1079310793
*/
1079410794
#define SQLITE_SCANSTAT_NLOOP 0
1079510795
#define SQLITE_SCANSTAT_NVISIT 1
1079610796
#define SQLITE_SCANSTAT_EST 2
@@ -10827,12 +10827,12 @@
1082710827
** the EXPLAIN QUERY PLAN output) are available. Invoking API
1082810828
** sqlite3_stmt_scanstatus() is equivalent to calling
1082910829
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
1083010830
**
1083110831
** Parameter "idx" identifies the specific query element to retrieve statistics
10832
-** for. Query elements are numbered starting from zero. A value of -1 may be
10833
-** to query for statistics regarding the entire query. ^If idx is out of range
10832
+** for. Query elements are numbered starting from zero. A value of -1 may
10833
+** retrieve statistics for the entire query. ^If idx is out of range
1083410834
** - less than -1 or greater than or equal to the total number of query
1083510835
** elements used to implement the statement - a non-zero value is returned and
1083610836
** the variable that pOut points to is unchanged.
1083710837
**
1083810838
** See also: [sqlite3_stmt_scanstatus_reset()]
@@ -10985,12 +10985,12 @@
1098510985
** operation; or 1 for inserts, updates, or deletes invoked by top-level
1098610986
** triggers; or 2 for changes resulting from triggers called by top-level
1098710987
** triggers; and so forth.
1098810988
**
1098910989
** When the [sqlite3_blob_write()] API is used to update a blob column,
10990
-** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10991
-** in this case the new values are not available. In this case, when a
10990
+** the pre-update hook is invoked with SQLITE_DELETE, because
10991
+** the new values are not yet available. In this case, when a
1099210992
** callback made with op==SQLITE_DELETE is actually a write using the
1099310993
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
1099410994
** the index of the column being written. In other cases, where the
1099510995
** pre-update hook is being invoked for some other reason, including a
1099610996
** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
@@ -11239,20 +11239,20 @@
1123911239
** is written into *P.
1124011240
**
1124111241
** For an ordinary on-disk database file, the serialization is just a
1124211242
** copy of the disk file. For an in-memory database or a "TEMP" database,
1124311243
** the serialization is the same sequence of bytes which would be written
11244
-** to disk if that database where backed up to disk.
11244
+** to disk if that database were backed up to disk.
1124511245
**
1124611246
** The usual case is that sqlite3_serialize() copies the serialization of
1124711247
** the database into memory obtained from [sqlite3_malloc64()] and returns
1124811248
** a pointer to that memory. The caller is responsible for freeing the
1124911249
** returned value to avoid a memory leak. However, if the F argument
1125011250
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
1125111251
** are made, and the sqlite3_serialize() function will return a pointer
1125211252
** to the contiguous memory representation of the database that SQLite
11253
-** is currently using for that database, or NULL if the no such contiguous
11253
+** is currently using for that database, or NULL if no such contiguous
1125411254
** memory representation of the database exists. A contiguous memory
1125511255
** representation of the database will usually only exist if there has
1125611256
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
1125711257
** values of D and S.
1125811258
** The size of the database is written into *P even if the
@@ -11319,11 +11319,11 @@
1131911319
**
1132011320
** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
1132111321
** database is currently in a read transaction or is involved in a backup
1132211322
** operation.
1132311323
**
11324
-** It is not possible to deserialized into the TEMP database. If the
11324
+** It is not possible to deserialize into the TEMP database. If the
1132511325
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
1132611326
** function returns SQLITE_ERROR.
1132711327
**
1132811328
** The deserialized database should not be in [WAL mode]. If the database
1132911329
** is in WAL mode, then any attempt to use the database file will result
@@ -11341,19 +11341,19 @@
1134111341
*/
1134211342
SQLITE_API int sqlite3_deserialize(
1134311343
sqlite3 *db, /* The database connection */
1134411344
const char *zSchema, /* Which DB to reopen with the deserialization */
1134511345
unsigned char *pData, /* The serialized database content */
11346
- sqlite3_int64 szDb, /* Number bytes in the deserialization */
11346
+ sqlite3_int64 szDb, /* Number of bytes in the deserialization */
1134711347
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
1134811348
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
1134911349
);
1135011350
1135111351
/*
1135211352
** CAPI3REF: Flags for sqlite3_deserialize()
1135311353
**
11354
-** The following are allowed values for 6th argument (the F argument) to
11354
+** The following are allowed values for the 6th argument (the F argument) to
1135511355
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
1135611356
**
1135711357
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
1135811358
** in the P argument is held in memory obtained from [sqlite3_malloc64()]
1135911359
** and that SQLite should take ownership of this memory and automatically
@@ -112888,10 +112888,85 @@
112888112888
pExpr = pExpr->op==TK_AND ? pLeft : pRight;
112889112889
}
112890112890
}
112891112891
return pExpr;
112892112892
}
112893
+
112894
+/*
112895
+** Return true if it might be advantageous to compute the right operand
112896
+** of expression pExpr first, before the left operand.
112897
+**
112898
+** Normally the left operand is computed before the right operand. But if
112899
+** the left operand contains a subquery and the right does not, then it
112900
+** might be more efficient to compute the right operand first.
112901
+*/
112902
+static int exprEvalRhsFirst(Expr *pExpr){
112903
+ if( ExprHasProperty(pExpr->pLeft, EP_Subquery)
112904
+ && !ExprHasProperty(pExpr->pRight, EP_Subquery)
112905
+ ){
112906
+ return 1;
112907
+ }else{
112908
+ return 0;
112909
+ }
112910
+}
112911
+
112912
+/*
112913
+** Compute the two operands of a binary operator.
112914
+**
112915
+** If either operand contains a subquery, then the code strives to
112916
+** compute the operand containing the subquery second. If the other
112917
+** operand evalutes to NULL, then a jump is made. The address of the
112918
+** IsNull operand that does this jump is returned. The caller can use
112919
+** this to optimize the computation so as to avoid doing the potentially
112920
+** expensive subquery.
112921
+**
112922
+** If no optimization opportunities exist, return 0.
112923
+*/
112924
+static int exprComputeOperands(
112925
+ Parse *pParse, /* Parsing context */
112926
+ Expr *pExpr, /* The comparison expression */
112927
+ int *pR1, /* OUT: Register holding the left operand */
112928
+ int *pR2, /* OUT: Register holding the right operand */
112929
+ int *pFree1, /* OUT: Temp register to free if not zero */
112930
+ int *pFree2 /* OUT: Another temp register to free if not zero */
112931
+){
112932
+ int addrIsNull;
112933
+ int r1, r2;
112934
+ Vdbe *v = pParse->pVdbe;
112935
+
112936
+ assert( v!=0 );
112937
+ /*
112938
+ ** If the left operand contains a (possibly expensive) subquery and the
112939
+ ** right operand does not and the right operation might be NULL,
112940
+ ** then compute the right operand first and do an IsNull jump if the
112941
+ ** right operand evalutes to NULL.
112942
+ */
112943
+ if( exprEvalRhsFirst(pExpr) && sqlite3ExprCanBeNull(pExpr->pRight) ){
112944
+ r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2);
112945
+ addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r2); VdbeCoverage(v);
112946
+ }else{
112947
+ addrIsNull = 0;
112948
+ }
112949
+ r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, pFree1);
112950
+ if( addrIsNull==0 ){
112951
+ /*
112952
+ ** If the right operand contains a subquery and the left operand does not
112953
+ ** and the left operand might be NULL, then check the left operand do
112954
+ ** an IsNull check on the left operand before computing the right
112955
+ ** operand.
112956
+ */
112957
+ if( ExprHasProperty(pExpr->pRight, EP_Subquery)
112958
+ && sqlite3ExprCanBeNull(pExpr->pLeft)
112959
+ ){
112960
+ addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r1); VdbeCoverage(v);
112961
+ }
112962
+ r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2);
112963
+ }
112964
+ *pR1 = r1;
112965
+ *pR2 = r2;
112966
+ return addrIsNull;
112967
+}
112893112968
112894112969
/*
112895112970
** pExpr is a TK_FUNCTION node. Try to determine whether or not the
112896112971
** function is a constant function. A function is constant if all of
112897112972
** the following are true:
@@ -115477,15 +115552,21 @@
115477115552
case TK_GT:
115478115553
case TK_GE:
115479115554
case TK_NE:
115480115555
case TK_EQ: {
115481115556
Expr *pLeft = pExpr->pLeft;
115557
+ int addrIsNull = 0;
115482115558
if( sqlite3ExprIsVector(pLeft) ){
115483115559
codeVectorCompare(pParse, pExpr, target, op, p5);
115484115560
}else{
115485
- r1 = sqlite3ExprCodeTemp(pParse, pLeft, &regFree1);
115486
- r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
115561
+ if( ExprHasProperty(pExpr, EP_Subquery) && p5!=SQLITE_NULLEQ ){
115562
+ addrIsNull = exprComputeOperands(pParse, pExpr,
115563
+ &r1, &r2, &regFree1, &regFree2);
115564
+ }else{
115565
+ r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
115566
+ r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
115567
+ }
115487115568
sqlite3VdbeAddOp2(v, OP_Integer, 1, inReg);
115488115569
codeCompare(pParse, pLeft, pExpr->pRight, op, r1, r2,
115489115570
sqlite3VdbeCurrentAddr(v)+2, p5,
115490115571
ExprHasProperty(pExpr,EP_Commuted));
115491115572
assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
@@ -115496,13 +115577,19 @@
115496115577
assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);
115497115578
if( p5==SQLITE_NULLEQ ){
115498115579
sqlite3VdbeAddOp2(v, OP_Integer, 0, inReg);
115499115580
}else{
115500115581
sqlite3VdbeAddOp3(v, OP_ZeroOrNull, r1, inReg, r2);
115582
+ if( addrIsNull ){
115583
+ sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
115584
+ sqlite3VdbeJumpHere(v, addrIsNull);
115585
+ sqlite3VdbeAddOp2(v, OP_Null, 0, inReg);
115586
+ }
115501115587
}
115502115588
testcase( regFree1==0 );
115503115589
testcase( regFree2==0 );
115590
+
115504115591
}
115505115592
break;
115506115593
}
115507115594
case TK_AND:
115508115595
case TK_OR:
@@ -115514,10 +115601,11 @@
115514115601
case TK_BITOR:
115515115602
case TK_SLASH:
115516115603
case TK_LSHIFT:
115517115604
case TK_RSHIFT:
115518115605
case TK_CONCAT: {
115606
+ int addrIsNull;
115519115607
assert( TK_AND==OP_And ); testcase( op==TK_AND );
115520115608
assert( TK_OR==OP_Or ); testcase( op==TK_OR );
115521115609
assert( TK_PLUS==OP_Add ); testcase( op==TK_PLUS );
115522115610
assert( TK_MINUS==OP_Subtract ); testcase( op==TK_MINUS );
115523115611
assert( TK_REM==OP_Remainder ); testcase( op==TK_REM );
@@ -115525,15 +115613,26 @@
115525115613
assert( TK_BITOR==OP_BitOr ); testcase( op==TK_BITOR );
115526115614
assert( TK_SLASH==OP_Divide ); testcase( op==TK_SLASH );
115527115615
assert( TK_LSHIFT==OP_ShiftLeft ); testcase( op==TK_LSHIFT );
115528115616
assert( TK_RSHIFT==OP_ShiftRight ); testcase( op==TK_RSHIFT );
115529115617
assert( TK_CONCAT==OP_Concat ); testcase( op==TK_CONCAT );
115530
- r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
115531
- r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
115618
+ if( ExprHasProperty(pExpr, EP_Subquery) ){
115619
+ addrIsNull = exprComputeOperands(pParse, pExpr,
115620
+ &r1, &r2, &regFree1, &regFree2);
115621
+ }else{
115622
+ r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
115623
+ r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
115624
+ addrIsNull = 0;
115625
+ }
115532115626
sqlite3VdbeAddOp3(v, op, r2, r1, target);
115533115627
testcase( regFree1==0 );
115534115628
testcase( regFree2==0 );
115629
+ if( addrIsNull ){
115630
+ sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
115631
+ sqlite3VdbeJumpHere(v, addrIsNull);
115632
+ sqlite3VdbeAddOp2(v, OP_Null, 0, target);
115633
+ }
115535115634
break;
115536115635
}
115537115636
case TK_UMINUS: {
115538115637
Expr *pLeft = pExpr->pLeft;
115539115638
assert( pLeft );
@@ -116378,21 +116477,31 @@
116378116477
case TK_AND:
116379116478
case TK_OR: {
116380116479
Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
116381116480
if( pAlt!=pExpr ){
116382116481
sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull);
116383
- }else if( op==TK_AND ){
116384
- int d2 = sqlite3VdbeMakeLabel(pParse);
116385
- testcase( jumpIfNull==0 );
116386
- sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,
116387
- jumpIfNull^SQLITE_JUMPIFNULL);
116388
- sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
116389
- sqlite3VdbeResolveLabel(v, d2);
116390116482
}else{
116391
- testcase( jumpIfNull==0 );
116392
- sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
116393
- sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
116483
+ Expr *pFirst, *pSecond;
116484
+ if( exprEvalRhsFirst(pExpr) ){
116485
+ pFirst = pExpr->pRight;
116486
+ pSecond = pExpr->pLeft;
116487
+ }else{
116488
+ pFirst = pExpr->pLeft;
116489
+ pSecond = pExpr->pRight;
116490
+ }
116491
+ if( op==TK_AND ){
116492
+ int d2 = sqlite3VdbeMakeLabel(pParse);
116493
+ testcase( jumpIfNull==0 );
116494
+ sqlite3ExprIfFalse(pParse, pFirst, d2,
116495
+ jumpIfNull^SQLITE_JUMPIFNULL);
116496
+ sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull);
116497
+ sqlite3VdbeResolveLabel(v, d2);
116498
+ }else{
116499
+ testcase( jumpIfNull==0 );
116500
+ sqlite3ExprIfTrue(pParse, pFirst, dest, jumpIfNull);
116501
+ sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull);
116502
+ }
116394116503
}
116395116504
break;
116396116505
}
116397116506
case TK_NOT: {
116398116507
testcase( jumpIfNull==0 );
@@ -116427,14 +116536,20 @@
116427116536
case TK_LE:
116428116537
case TK_GT:
116429116538
case TK_GE:
116430116539
case TK_NE:
116431116540
case TK_EQ: {
116541
+ int addrIsNull;
116432116542
if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
116433
- testcase( jumpIfNull==0 );
116434
- r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116435
- r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
116543
+ if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){
116544
+ addrIsNull = exprComputeOperands(pParse, pExpr,
116545
+ &r1, &r2, &regFree1, &regFree2);
116546
+ }else{
116547
+ r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116548
+ r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
116549
+ addrIsNull = 0;
116550
+ }
116436116551
codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
116437116552
r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted));
116438116553
assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
116439116554
assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
116440116555
assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);
@@ -116445,10 +116560,17 @@
116445116560
assert(TK_NE==OP_Ne); testcase(op==OP_Ne);
116446116561
VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);
116447116562
VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);
116448116563
testcase( regFree1==0 );
116449116564
testcase( regFree2==0 );
116565
+ if( addrIsNull ){
116566
+ if( jumpIfNull ){
116567
+ sqlite3VdbeChangeP2(v, addrIsNull, dest);
116568
+ }else{
116569
+ sqlite3VdbeJumpHere(v, addrIsNull);
116570
+ }
116571
+ }
116450116572
break;
116451116573
}
116452116574
case TK_ISNULL:
116453116575
case TK_NOTNULL: {
116454116576
assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL );
@@ -116552,21 +116674,31 @@
116552116674
case TK_AND:
116553116675
case TK_OR: {
116554116676
Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
116555116677
if( pAlt!=pExpr ){
116556116678
sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull);
116557
- }else if( pExpr->op==TK_AND ){
116558
- testcase( jumpIfNull==0 );
116559
- sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
116560
- sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
116561116679
}else{
116562
- int d2 = sqlite3VdbeMakeLabel(pParse);
116563
- testcase( jumpIfNull==0 );
116564
- sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2,
116565
- jumpIfNull^SQLITE_JUMPIFNULL);
116566
- sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
116567
- sqlite3VdbeResolveLabel(v, d2);
116680
+ Expr *pFirst, *pSecond;
116681
+ if( exprEvalRhsFirst(pExpr) ){
116682
+ pFirst = pExpr->pRight;
116683
+ pSecond = pExpr->pLeft;
116684
+ }else{
116685
+ pFirst = pExpr->pLeft;
116686
+ pSecond = pExpr->pRight;
116687
+ }
116688
+ if( pExpr->op==TK_AND ){
116689
+ testcase( jumpIfNull==0 );
116690
+ sqlite3ExprIfFalse(pParse, pFirst, dest, jumpIfNull);
116691
+ sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull);
116692
+ }else{
116693
+ int d2 = sqlite3VdbeMakeLabel(pParse);
116694
+ testcase( jumpIfNull==0 );
116695
+ sqlite3ExprIfTrue(pParse, pFirst, d2,
116696
+ jumpIfNull^SQLITE_JUMPIFNULL);
116697
+ sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull);
116698
+ sqlite3VdbeResolveLabel(v, d2);
116699
+ }
116568116700
}
116569116701
break;
116570116702
}
116571116703
case TK_NOT: {
116572116704
testcase( jumpIfNull==0 );
@@ -116604,14 +116736,20 @@
116604116736
case TK_LE:
116605116737
case TK_GT:
116606116738
case TK_GE:
116607116739
case TK_NE:
116608116740
case TK_EQ: {
116741
+ int addrIsNull;
116609116742
if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
116610
- testcase( jumpIfNull==0 );
116611
- r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116612
- r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
116743
+ if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){
116744
+ addrIsNull = exprComputeOperands(pParse, pExpr,
116745
+ &r1, &r2, &regFree1, &regFree2);
116746
+ }else{
116747
+ r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116748
+ r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
116749
+ addrIsNull = 0;
116750
+ }
116613116751
codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
116614116752
r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted));
116615116753
assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
116616116754
assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
116617116755
assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);
@@ -116622,10 +116760,17 @@
116622116760
assert(TK_NE==OP_Ne); testcase(op==OP_Ne);
116623116761
VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);
116624116762
VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);
116625116763
testcase( regFree1==0 );
116626116764
testcase( regFree2==0 );
116765
+ if( addrIsNull ){
116766
+ if( jumpIfNull ){
116767
+ sqlite3VdbeChangeP2(v, addrIsNull, dest);
116768
+ }else{
116769
+ sqlite3VdbeJumpHere(v, addrIsNull);
116770
+ }
116771
+ }
116627116772
break;
116628116773
}
116629116774
case TK_ISNULL:
116630116775
case TK_NOTNULL: {
116631116776
r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
@@ -257503,11 +257648,11 @@
257503257648
int nArg, /* Number of args */
257504257649
sqlite3_value **apUnused /* Function arguments */
257505257650
){
257506257651
assert( nArg==0 );
257507257652
UNUSED_PARAM2(nArg, apUnused);
257508
- sqlite3_result_text(pCtx, "fts5: 2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8", -1, SQLITE_TRANSIENT);
257653
+ sqlite3_result_text(pCtx, "fts5: 2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296", -1, SQLITE_TRANSIENT);
257509257654
}
257510257655
257511257656
/*
257512257657
** Implementation of fts5_locale(LOCALE, TEXT) function.
257513257658
**
257514257659
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
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 ** 5508b56fd24016c13981ec280ecdd833007c with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466 ** [sqlite_version()] and [sqlite_source_id()].
467 */
468 #define SQLITE_VERSION "3.51.0"
469 #define SQLITE_VERSION_NUMBER 3051000
470 #define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -9375,48 +9375,48 @@
9375 ** careful use of indices.</dd>
9376 **
9377 ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
9378 ** <dd>^This is the number of sort operations that have occurred.
9379 ** A non-zero value in this counter may indicate an opportunity to
9380 ** improvement performance through careful use of indices.</dd>
9381 **
9382 ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
9383 ** <dd>^This is the number of rows inserted into transient indices that
9384 ** were created automatically in order to help joins run faster.
9385 ** A non-zero value in this counter may indicate an opportunity to
9386 ** improvement performance by adding permanent indices that do not
9387 ** need to be reinitialized each time the statement is run.</dd>
9388 **
9389 ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
9390 ** <dd>^This is the number of virtual machine operations executed
9391 ** by the prepared statement if that number is less than or equal
9392 ** to 2147483647. The number of virtual machine operations can be
9393 ** used as a proxy for the total work done by the prepared statement.
9394 ** If the number of virtual machine operations exceeds 2147483647
9395 ** then the value returned by this statement status code is undefined.
9396 **
9397 ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
9398 ** <dd>^This is the number of times that the prepare statement has been
9399 ** automatically regenerated due to schema changes or changes to
9400 ** [bound parameters] that might affect the query plan.
9401 **
9402 ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
9403 ** <dd>^This is the number of times that the prepared statement has
9404 ** been run. A single "run" for the purposes of this counter is one
9405 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
9406 ** The counter is incremented on the first [sqlite3_step()] call of each
9407 ** cycle.
9408 **
9409 ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
9410 ** [[SQLITE_STMTSTATUS_FILTER HIT]]
9411 ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
9412 ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
9413 ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
9414 ** step was bypassed because a Bloom filter returned not-found. The
9415 ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
9416 ** times that the Bloom filter returned a find, and thus the join step
9417 ** had to be processed as normal.
9418 **
9419 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
9420 ** <dd>^This is the approximate number of bytes of heap memory
9421 ** used to store the prepared statement. ^This value is not actually
9422 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -9517,31 +9517,31 @@
9517 ** [[the xCreate() page cache methods]]
9518 ** ^SQLite invokes the xCreate() method to construct a new cache instance.
9519 ** SQLite will typically create one cache instance for each open database file,
9520 ** though this is not guaranteed. ^The
9521 ** first parameter, szPage, is the size in bytes of the pages that must
9522 ** be allocated by the cache. ^szPage will always a power of two. ^The
9523 ** second parameter szExtra is a number of bytes of extra storage
9524 ** associated with each page cache entry. ^The szExtra parameter will
9525 ** a number less than 250. SQLite will use the
9526 ** extra szExtra bytes on each page to store metadata about the underlying
9527 ** database page on disk. The value passed into szExtra depends
9528 ** on the SQLite version, the target platform, and how SQLite was compiled.
9529 ** ^The third argument to xCreate(), bPurgeable, is true if the cache being
9530 ** created will be used to cache database pages of a file stored on disk, or
9531 ** false if it is used for an in-memory database. The cache implementation
9532 ** does not have to do anything special based with the value of bPurgeable;
9533 ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
9534 ** never invoke xUnpin() except to deliberately delete a page.
9535 ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
9536 ** false will always have the "discard" flag set to true.
9537 ** ^Hence, a cache created with bPurgeable false will
9538 ** never contain any unpinned pages.
9539 **
9540 ** [[the xCachesize() page cache method]]
9541 ** ^(The xCachesize() method may be called at any time by SQLite to set the
9542 ** suggested maximum cache-size (number of pages stored by) the cache
9543 ** instance passed as the first argument. This is the value configured using
9544 ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
9545 ** parameter, the implementation is not required to do anything with this
9546 ** value; it is advisory only.
9547 **
@@ -9564,16 +9564,16 @@
9564 **
9565 ** If the requested page is already in the page cache, then the page cache
9566 ** implementation must return a pointer to the page buffer with its content
9567 ** intact. If the requested page is not already in the cache, then the
9568 ** cache implementation should use the value of the createFlag
9569 ** parameter to help it determined what action to take:
9570 **
9571 ** <table border=1 width=85% align=center>
9572 ** <tr><th> createFlag <th> Behavior when page is not already in cache
9573 ** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9574 ** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
9575 ** Otherwise return NULL.
9576 ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
9577 ** NULL if allocating a new page is effectively impossible.
9578 ** </table>
9579 **
@@ -9586,11 +9586,11 @@
9586 ** [[the xUnpin() page cache method]]
9587 ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
9588 ** as its second argument. If the third parameter, discard, is non-zero,
9589 ** then the page must be evicted from the cache.
9590 ** ^If the discard parameter is
9591 ** zero, then the page may be discarded or retained at the discretion of
9592 ** page cache implementation. ^The page cache implementation
9593 ** may choose to evict unpinned pages at any time.
9594 **
9595 ** The cache must not perform any reference counting. A single
9596 ** call to xUnpin() unpins the page regardless of the number of prior calls
@@ -9604,11 +9604,11 @@
9604 ** to be pinned.
9605 **
9606 ** When SQLite calls the xTruncate() method, the cache must discard all
9607 ** existing cache entries with page numbers (keys) greater than or equal
9608 ** to the value of the iLimit parameter passed to xTruncate(). If any
9609 ** of these pages are pinned, they are implicitly unpinned, meaning that
9610 ** they can be safely discarded.
9611 **
9612 ** [[the xDestroy() page cache method]]
9613 ** ^The xDestroy() method is used to delete a cache allocated by xCreate().
9614 ** All resources associated with the specified cache should be freed. ^After
@@ -9903,11 +9903,11 @@
9903 ** identity of the database connection (the blocking connection) that
9904 ** has locked the required resource is stored internally. ^After an
9905 ** application receives an SQLITE_LOCKED error, it may call the
9906 ** sqlite3_unlock_notify() method with the blocked connection handle as
9907 ** the first argument to register for a callback that will be invoked
9908 ** when the blocking connections current transaction is concluded. ^The
9909 ** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
9910 ** call that concludes the blocking connection's transaction.
9911 **
9912 ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
9913 ** there is a chance that the blocking connection will have already
@@ -9923,11 +9923,11 @@
9923 ** ^(There may be at most one unlock-notify callback registered by a
9924 ** blocked connection. If sqlite3_unlock_notify() is called when the
9925 ** blocked connection already has a registered unlock-notify callback,
9926 ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
9927 ** called with a NULL pointer as its second argument, then any existing
9928 ** unlock-notify callback is canceled. ^The blocked connections
9929 ** unlock-notify callback may also be canceled by closing the blocked
9930 ** connection using [sqlite3_close()].
9931 **
9932 ** The unlock-notify callback is not reentrant. If an application invokes
9933 ** any sqlite3_xxx API functions from within an unlock-notify callback, a
@@ -10321,11 +10321,11 @@
10321 ** where X is an integer. If X is zero, then the [virtual table] whose
10322 ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
10323 ** support constraints. In this configuration (which is the default) if
10324 ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
10325 ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10326 ** specified as part of the users SQL statement, regardless of the actual
10327 ** ON CONFLICT mode specified.
10328 **
10329 ** If X is non-zero, then the virtual table implementation guarantees
10330 ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
10331 ** any modifications to internal or persistent data structures have been made.
@@ -10355,11 +10355,11 @@
10355 ** </dd>
10356 **
10357 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
10358 ** <dd>Calls of the form
10359 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10360 ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
10361 ** identify that virtual table as being safe to use from within triggers
10362 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
10363 ** virtual table can do no serious harm even if it is controlled by a
10364 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
10365 ** flag unless absolutely necessary.
@@ -10523,21 +10523,21 @@
10523 ** <tr><td>2<td>no<td>yes<td>yes
10524 ** <tr><td>3<td>yes<td>yes<td>yes
10525 ** </table>
10526 **
10527 ** ^For the purposes of comparing virtual table output values to see if the
10528 ** values are same value for sorting purposes, two NULL values are considered
10529 ** to be the same. In other words, the comparison operator is "IS"
10530 ** (or "IS NOT DISTINCT FROM") and not "==".
10531 **
10532 ** If a virtual table implementation is unable to meet the requirements
10533 ** specified above, then it must not set the "orderByConsumed" flag in the
10534 ** [sqlite3_index_info] object or an incorrect answer may result.
10535 **
10536 ** ^A virtual table implementation is always free to return rows in any order
10537 ** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10538 ** the "orderByConsumed" flag is unset, the query planner will add extra
10539 ** [bytecode] to ensure that the final results returned by the SQL query are
10540 ** ordered correctly. The use of the "orderByConsumed" flag and the
10541 ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
10542 ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
10543 ** flag might help queries against a virtual table to run faster. Being
@@ -10630,11 +10630,11 @@
10630 **
10631 ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
10632 ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
10633 ** xFilter method which invokes these routines, and specifically
10634 ** a parameter that was previously selected for all-at-once IN constraint
10635 ** processing use the [sqlite3_vtab_in()] interface in the
10636 ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
10637 ** an xFilter argument that was selected for all-at-once IN constraint
10638 ** processing, then these routines return [SQLITE_ERROR].)^
10639 **
10640 ** ^(Use these routines to access all values on the right-hand side
@@ -10685,11 +10685,11 @@
10685 ** right-hand operand is not known, then *V is set to a NULL pointer.
10686 ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
10687 ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
10688 ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
10689 ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10690 ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
10691 ** something goes wrong.
10692 **
10693 ** The sqlite3_vtab_rhs_value() interface is usually only successful if
10694 ** the right-hand operand of a constraint is a literal value in the original
10695 ** SQL statement. If the right-hand operand is an expression or a reference
@@ -10713,12 +10713,12 @@
10713 /*
10714 ** CAPI3REF: Conflict resolution modes
10715 ** KEYWORDS: {conflict resolution mode}
10716 **
10717 ** These constants are returned by [sqlite3_vtab_on_conflict()] to
10718 ** inform a [virtual table] implementation what the [ON CONFLICT] mode
10719 ** is for the SQL statement being evaluated.
10720 **
10721 ** Note that the [SQLITE_IGNORE] constant is also used as a potential
10722 ** return value from the [sqlite3_set_authorizer()] callback and that
10723 ** [SQLITE_ABORT] is also a [result code].
10724 */
@@ -10754,43 +10754,43 @@
10754 ** to the total number of rows examined by all iterations of the X-th loop.</dd>
10755 **
10756 ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
10757 ** <dd>^The "double" variable pointed to by the V parameter will be set to the
10758 ** query planner's estimate for the average number of rows output from each
10759 ** iteration of the X-th loop. If the query planner's estimates was accurate,
10760 ** then this value will approximate the quotient NVISIT/NLOOP and the
10761 ** product of this value for all prior loops with the same SELECTID will
10762 ** be the NLOOP value for the current loop.
10763 **
10764 ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
10765 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10766 ** to a zero-terminated UTF-8 string containing the name of the index or table
10767 ** used for the X-th loop.
10768 **
10769 ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
10770 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10771 ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10772 ** description for the X-th loop.
10773 **
10774 ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
10775 ** <dd>^The "int" variable pointed to by the V parameter will be set to the
10776 ** id for the X-th query plan element. The id value is unique within the
10777 ** statement. The select-id is the same value as is output in the first
10778 ** column of an [EXPLAIN QUERY PLAN] query.
10779 **
10780 ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
10781 ** <dd>The "int" variable pointed to by the V parameter will be set to the
10782 ** the id of the parent of the current query element, if applicable, or
10783 ** to zero if the query element has no parent. This is the same value as
10784 ** returned in the second column of an [EXPLAIN QUERY PLAN] query.
10785 **
10786 ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
10787 ** <dd>The sqlite3_int64 output value is set to the number of cycles,
10788 ** according to the processor time-stamp counter, that elapsed while the
10789 ** query element was being processed. This value is not available for
10790 ** all query elements - if it is unavailable the output variable is
10791 ** set to -1.
10792 ** </dl>
10793 */
10794 #define SQLITE_SCANSTAT_NLOOP 0
10795 #define SQLITE_SCANSTAT_NVISIT 1
10796 #define SQLITE_SCANSTAT_EST 2
@@ -10827,12 +10827,12 @@
10827 ** the EXPLAIN QUERY PLAN output) are available. Invoking API
10828 ** sqlite3_stmt_scanstatus() is equivalent to calling
10829 ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
10830 **
10831 ** Parameter "idx" identifies the specific query element to retrieve statistics
10832 ** for. Query elements are numbered starting from zero. A value of -1 may be
10833 ** to query for statistics regarding the entire query. ^If idx is out of range
10834 ** - less than -1 or greater than or equal to the total number of query
10835 ** elements used to implement the statement - a non-zero value is returned and
10836 ** the variable that pOut points to is unchanged.
10837 **
10838 ** See also: [sqlite3_stmt_scanstatus_reset()]
@@ -10985,12 +10985,12 @@
10985 ** operation; or 1 for inserts, updates, or deletes invoked by top-level
10986 ** triggers; or 2 for changes resulting from triggers called by top-level
10987 ** triggers; and so forth.
10988 **
10989 ** When the [sqlite3_blob_write()] API is used to update a blob column,
10990 ** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10991 ** in this case the new values are not available. In this case, when a
10992 ** callback made with op==SQLITE_DELETE is actually a write using the
10993 ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10994 ** the index of the column being written. In other cases, where the
10995 ** pre-update hook is being invoked for some other reason, including a
10996 ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
@@ -11239,20 +11239,20 @@
11239 ** is written into *P.
11240 **
11241 ** For an ordinary on-disk database file, the serialization is just a
11242 ** copy of the disk file. For an in-memory database or a "TEMP" database,
11243 ** the serialization is the same sequence of bytes which would be written
11244 ** to disk if that database where backed up to disk.
11245 **
11246 ** The usual case is that sqlite3_serialize() copies the serialization of
11247 ** the database into memory obtained from [sqlite3_malloc64()] and returns
11248 ** a pointer to that memory. The caller is responsible for freeing the
11249 ** returned value to avoid a memory leak. However, if the F argument
11250 ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
11251 ** are made, and the sqlite3_serialize() function will return a pointer
11252 ** to the contiguous memory representation of the database that SQLite
11253 ** is currently using for that database, or NULL if the no such contiguous
11254 ** memory representation of the database exists. A contiguous memory
11255 ** representation of the database will usually only exist if there has
11256 ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
11257 ** values of D and S.
11258 ** The size of the database is written into *P even if the
@@ -11319,11 +11319,11 @@
11319 **
11320 ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
11321 ** database is currently in a read transaction or is involved in a backup
11322 ** operation.
11323 **
11324 ** It is not possible to deserialized into the TEMP database. If the
11325 ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
11326 ** function returns SQLITE_ERROR.
11327 **
11328 ** The deserialized database should not be in [WAL mode]. If the database
11329 ** is in WAL mode, then any attempt to use the database file will result
@@ -11341,19 +11341,19 @@
11341 */
11342 SQLITE_API int sqlite3_deserialize(
11343 sqlite3 *db, /* The database connection */
11344 const char *zSchema, /* Which DB to reopen with the deserialization */
11345 unsigned char *pData, /* The serialized database content */
11346 sqlite3_int64 szDb, /* Number bytes in the deserialization */
11347 sqlite3_int64 szBuf, /* Total size of buffer pData[] */
11348 unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
11349 );
11350
11351 /*
11352 ** CAPI3REF: Flags for sqlite3_deserialize()
11353 **
11354 ** The following are allowed values for 6th argument (the F argument) to
11355 ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
11356 **
11357 ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
11358 ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
11359 ** and that SQLite should take ownership of this memory and automatically
@@ -112888,10 +112888,85 @@
112888 pExpr = pExpr->op==TK_AND ? pLeft : pRight;
112889 }
112890 }
112891 return pExpr;
112892 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112893
112894 /*
112895 ** pExpr is a TK_FUNCTION node. Try to determine whether or not the
112896 ** function is a constant function. A function is constant if all of
112897 ** the following are true:
@@ -115477,15 +115552,21 @@
115477 case TK_GT:
115478 case TK_GE:
115479 case TK_NE:
115480 case TK_EQ: {
115481 Expr *pLeft = pExpr->pLeft;
 
115482 if( sqlite3ExprIsVector(pLeft) ){
115483 codeVectorCompare(pParse, pExpr, target, op, p5);
115484 }else{
115485 r1 = sqlite3ExprCodeTemp(pParse, pLeft, &regFree1);
115486 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
 
 
 
 
 
115487 sqlite3VdbeAddOp2(v, OP_Integer, 1, inReg);
115488 codeCompare(pParse, pLeft, pExpr->pRight, op, r1, r2,
115489 sqlite3VdbeCurrentAddr(v)+2, p5,
115490 ExprHasProperty(pExpr,EP_Commuted));
115491 assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
@@ -115496,13 +115577,19 @@
115496 assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);
115497 if( p5==SQLITE_NULLEQ ){
115498 sqlite3VdbeAddOp2(v, OP_Integer, 0, inReg);
115499 }else{
115500 sqlite3VdbeAddOp3(v, OP_ZeroOrNull, r1, inReg, r2);
 
 
 
 
 
115501 }
115502 testcase( regFree1==0 );
115503 testcase( regFree2==0 );
 
115504 }
115505 break;
115506 }
115507 case TK_AND:
115508 case TK_OR:
@@ -115514,10 +115601,11 @@
115514 case TK_BITOR:
115515 case TK_SLASH:
115516 case TK_LSHIFT:
115517 case TK_RSHIFT:
115518 case TK_CONCAT: {
 
115519 assert( TK_AND==OP_And ); testcase( op==TK_AND );
115520 assert( TK_OR==OP_Or ); testcase( op==TK_OR );
115521 assert( TK_PLUS==OP_Add ); testcase( op==TK_PLUS );
115522 assert( TK_MINUS==OP_Subtract ); testcase( op==TK_MINUS );
115523 assert( TK_REM==OP_Remainder ); testcase( op==TK_REM );
@@ -115525,15 +115613,26 @@
115525 assert( TK_BITOR==OP_BitOr ); testcase( op==TK_BITOR );
115526 assert( TK_SLASH==OP_Divide ); testcase( op==TK_SLASH );
115527 assert( TK_LSHIFT==OP_ShiftLeft ); testcase( op==TK_LSHIFT );
115528 assert( TK_RSHIFT==OP_ShiftRight ); testcase( op==TK_RSHIFT );
115529 assert( TK_CONCAT==OP_Concat ); testcase( op==TK_CONCAT );
115530 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
115531 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
 
 
 
 
 
 
115532 sqlite3VdbeAddOp3(v, op, r2, r1, target);
115533 testcase( regFree1==0 );
115534 testcase( regFree2==0 );
 
 
 
 
 
115535 break;
115536 }
115537 case TK_UMINUS: {
115538 Expr *pLeft = pExpr->pLeft;
115539 assert( pLeft );
@@ -116378,21 +116477,31 @@
116378 case TK_AND:
116379 case TK_OR: {
116380 Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
116381 if( pAlt!=pExpr ){
116382 sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull);
116383 }else if( op==TK_AND ){
116384 int d2 = sqlite3VdbeMakeLabel(pParse);
116385 testcase( jumpIfNull==0 );
116386 sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,
116387 jumpIfNull^SQLITE_JUMPIFNULL);
116388 sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
116389 sqlite3VdbeResolveLabel(v, d2);
116390 }else{
116391 testcase( jumpIfNull==0 );
116392 sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
116393 sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116394 }
116395 break;
116396 }
116397 case TK_NOT: {
116398 testcase( jumpIfNull==0 );
@@ -116427,14 +116536,20 @@
116427 case TK_LE:
116428 case TK_GT:
116429 case TK_GE:
116430 case TK_NE:
116431 case TK_EQ: {
 
116432 if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
116433 testcase( jumpIfNull==0 );
116434 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116435 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
 
 
 
 
 
116436 codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
116437 r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted));
116438 assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
116439 assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
116440 assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);
@@ -116445,10 +116560,17 @@
116445 assert(TK_NE==OP_Ne); testcase(op==OP_Ne);
116446 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);
116447 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);
116448 testcase( regFree1==0 );
116449 testcase( regFree2==0 );
 
 
 
 
 
 
 
116450 break;
116451 }
116452 case TK_ISNULL:
116453 case TK_NOTNULL: {
116454 assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL );
@@ -116552,21 +116674,31 @@
116552 case TK_AND:
116553 case TK_OR: {
116554 Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
116555 if( pAlt!=pExpr ){
116556 sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull);
116557 }else if( pExpr->op==TK_AND ){
116558 testcase( jumpIfNull==0 );
116559 sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
116560 sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
116561 }else{
116562 int d2 = sqlite3VdbeMakeLabel(pParse);
116563 testcase( jumpIfNull==0 );
116564 sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2,
116565 jumpIfNull^SQLITE_JUMPIFNULL);
116566 sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
116567 sqlite3VdbeResolveLabel(v, d2);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116568 }
116569 break;
116570 }
116571 case TK_NOT: {
116572 testcase( jumpIfNull==0 );
@@ -116604,14 +116736,20 @@
116604 case TK_LE:
116605 case TK_GT:
116606 case TK_GE:
116607 case TK_NE:
116608 case TK_EQ: {
 
116609 if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
116610 testcase( jumpIfNull==0 );
116611 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116612 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
 
 
 
 
 
116613 codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
116614 r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted));
116615 assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
116616 assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
116617 assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);
@@ -116622,10 +116760,17 @@
116622 assert(TK_NE==OP_Ne); testcase(op==OP_Ne);
116623 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);
116624 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);
116625 testcase( regFree1==0 );
116626 testcase( regFree2==0 );
 
 
 
 
 
 
 
116627 break;
116628 }
116629 case TK_ISNULL:
116630 case TK_NOTNULL: {
116631 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
@@ -257503,11 +257648,11 @@
257503 int nArg, /* Number of args */
257504 sqlite3_value **apUnused /* Function arguments */
257505 ){
257506 assert( nArg==0 );
257507 UNUSED_PARAM2(nArg, apUnused);
257508 sqlite3_result_text(pCtx, "fts5: 2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8", -1, SQLITE_TRANSIENT);
257509 }
257510
257511 /*
257512 ** Implementation of fts5_locale(LOCALE, TEXT) function.
257513 **
257514
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -16,11 +16,11 @@
16 ** if you want a wrapper to interface SQLite with your choice of programming
17 ** language. The code for the "sqlite3" command-line shell is also in a
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 ** 0083d5169a46104a25355bdd9d5a2f4027b0 with changes in files:
22 **
23 **
24 */
25 #ifndef SQLITE_AMALGAMATION
26 #define SQLITE_CORE 1
@@ -465,11 +465,11 @@
465 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
466 ** [sqlite_version()] and [sqlite_source_id()].
467 */
468 #define SQLITE_VERSION "3.51.0"
469 #define SQLITE_VERSION_NUMBER 3051000
470 #define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296"
471
472 /*
473 ** CAPI3REF: Run-Time Library Version Numbers
474 ** KEYWORDS: sqlite3_version sqlite3_sourceid
475 **
@@ -9375,48 +9375,48 @@
9375 ** careful use of indices.</dd>
9376 **
9377 ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
9378 ** <dd>^This is the number of sort operations that have occurred.
9379 ** A non-zero value in this counter may indicate an opportunity to
9380 ** improve performance through careful use of indices.</dd>
9381 **
9382 ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
9383 ** <dd>^This is the number of rows inserted into transient indices that
9384 ** were created automatically in order to help joins run faster.
9385 ** A non-zero value in this counter may indicate an opportunity to
9386 ** improve performance by adding permanent indices that do not
9387 ** need to be reinitialized each time the statement is run.</dd>
9388 **
9389 ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
9390 ** <dd>^This is the number of virtual machine operations executed
9391 ** by the prepared statement if that number is less than or equal
9392 ** to 2147483647. The number of virtual machine operations can be
9393 ** used as a proxy for the total work done by the prepared statement.
9394 ** If the number of virtual machine operations exceeds 2147483647
9395 ** then the value returned by this statement status code is undefined.</dd>
9396 **
9397 ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
9398 ** <dd>^This is the number of times that the prepare statement has been
9399 ** automatically regenerated due to schema changes or changes to
9400 ** [bound parameters] that might affect the query plan.</dd>
9401 **
9402 ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
9403 ** <dd>^This is the number of times that the prepared statement has
9404 ** been run. A single "run" for the purposes of this counter is one
9405 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
9406 ** The counter is incremented on the first [sqlite3_step()] call of each
9407 ** cycle.</dd>
9408 **
9409 ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
9410 ** [[SQLITE_STMTSTATUS_FILTER HIT]]
9411 ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
9412 ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
9413 ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
9414 ** step was bypassed because a Bloom filter returned not-found. The
9415 ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
9416 ** times that the Bloom filter returned a find, and thus the join step
9417 ** had to be processed as normal.</dd>
9418 **
9419 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
9420 ** <dd>^This is the approximate number of bytes of heap memory
9421 ** used to store the prepared statement. ^This value is not actually
9422 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -9517,31 +9517,31 @@
9517 ** [[the xCreate() page cache methods]]
9518 ** ^SQLite invokes the xCreate() method to construct a new cache instance.
9519 ** SQLite will typically create one cache instance for each open database file,
9520 ** though this is not guaranteed. ^The
9521 ** first parameter, szPage, is the size in bytes of the pages that must
9522 ** be allocated by the cache. ^szPage will always be a power of two. ^The
9523 ** second parameter szExtra is a number of bytes of extra storage
9524 ** associated with each page cache entry. ^The szExtra parameter will be
9525 ** a number less than 250. SQLite will use the
9526 ** extra szExtra bytes on each page to store metadata about the underlying
9527 ** database page on disk. The value passed into szExtra depends
9528 ** on the SQLite version, the target platform, and how SQLite was compiled.
9529 ** ^The third argument to xCreate(), bPurgeable, is true if the cache being
9530 ** created will be used to cache database pages of a file stored on disk, or
9531 ** false if it is used for an in-memory database. The cache implementation
9532 ** does not have to do anything special based upon the value of bPurgeable;
9533 ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
9534 ** never invoke xUnpin() except to deliberately delete a page.
9535 ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
9536 ** false will always have the "discard" flag set to true.
9537 ** ^Hence, a cache created with bPurgeable set to false will
9538 ** never contain any unpinned pages.
9539 **
9540 ** [[the xCachesize() page cache method]]
9541 ** ^(The xCachesize() method may be called at any time by SQLite to set the
9542 ** suggested maximum cache-size (number of pages stored) for the cache
9543 ** instance passed as the first argument. This is the value configured using
9544 ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
9545 ** parameter, the implementation is not required to do anything with this
9546 ** value; it is advisory only.
9547 **
@@ -9564,16 +9564,16 @@
9564 **
9565 ** If the requested page is already in the page cache, then the page cache
9566 ** implementation must return a pointer to the page buffer with its content
9567 ** intact. If the requested page is not already in the cache, then the
9568 ** cache implementation should use the value of the createFlag
9569 ** parameter to help it determine what action to take:
9570 **
9571 ** <table border=1 width=85% align=center>
9572 ** <tr><th> createFlag <th> Behavior when page is not already in cache
9573 ** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9574 ** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
9575 ** Otherwise return NULL.
9576 ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
9577 ** NULL if allocating a new page is effectively impossible.
9578 ** </table>
9579 **
@@ -9586,11 +9586,11 @@
9586 ** [[the xUnpin() page cache method]]
9587 ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
9588 ** as its second argument. If the third parameter, discard, is non-zero,
9589 ** then the page must be evicted from the cache.
9590 ** ^If the discard parameter is
9591 ** zero, then the page may be discarded or retained at the discretion of the
9592 ** page cache implementation. ^The page cache implementation
9593 ** may choose to evict unpinned pages at any time.
9594 **
9595 ** The cache must not perform any reference counting. A single
9596 ** call to xUnpin() unpins the page regardless of the number of prior calls
@@ -9604,11 +9604,11 @@
9604 ** to be pinned.
9605 **
9606 ** When SQLite calls the xTruncate() method, the cache must discard all
9607 ** existing cache entries with page numbers (keys) greater than or equal
9608 ** to the value of the iLimit parameter passed to xTruncate(). If any
9609 ** of these pages are pinned, they become implicitly unpinned, meaning that
9610 ** they can be safely discarded.
9611 **
9612 ** [[the xDestroy() page cache method]]
9613 ** ^The xDestroy() method is used to delete a cache allocated by xCreate().
9614 ** All resources associated with the specified cache should be freed. ^After
@@ -9903,11 +9903,11 @@
9903 ** identity of the database connection (the blocking connection) that
9904 ** has locked the required resource is stored internally. ^After an
9905 ** application receives an SQLITE_LOCKED error, it may call the
9906 ** sqlite3_unlock_notify() method with the blocked connection handle as
9907 ** the first argument to register for a callback that will be invoked
9908 ** when the blocking connection's current transaction is concluded. ^The
9909 ** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
9910 ** call that concludes the blocking connection's transaction.
9911 **
9912 ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
9913 ** there is a chance that the blocking connection will have already
@@ -9923,11 +9923,11 @@
9923 ** ^(There may be at most one unlock-notify callback registered by a
9924 ** blocked connection. If sqlite3_unlock_notify() is called when the
9925 ** blocked connection already has a registered unlock-notify callback,
9926 ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
9927 ** called with a NULL pointer as its second argument, then any existing
9928 ** unlock-notify callback is canceled. ^The blocked connection's
9929 ** unlock-notify callback may also be canceled by closing the blocked
9930 ** connection using [sqlite3_close()].
9931 **
9932 ** The unlock-notify callback is not reentrant. If an application invokes
9933 ** any sqlite3_xxx API functions from within an unlock-notify callback, a
@@ -10321,11 +10321,11 @@
10321 ** where X is an integer. If X is zero, then the [virtual table] whose
10322 ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
10323 ** support constraints. In this configuration (which is the default) if
10324 ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
10325 ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10326 ** specified as part of the user's SQL statement, regardless of the actual
10327 ** ON CONFLICT mode specified.
10328 **
10329 ** If X is non-zero, then the virtual table implementation guarantees
10330 ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
10331 ** any modifications to internal or persistent data structures have been made.
@@ -10355,11 +10355,11 @@
10355 ** </dd>
10356 **
10357 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
10358 ** <dd>Calls of the form
10359 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10360 ** [xConnect] or [xCreate] methods of a [virtual table] implementation
10361 ** identify that virtual table as being safe to use from within triggers
10362 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
10363 ** virtual table can do no serious harm even if it is controlled by a
10364 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
10365 ** flag unless absolutely necessary.
@@ -10523,21 +10523,21 @@
10523 ** <tr><td>2<td>no<td>yes<td>yes
10524 ** <tr><td>3<td>yes<td>yes<td>yes
10525 ** </table>
10526 **
10527 ** ^For the purposes of comparing virtual table output values to see if the
10528 ** values are the same value for sorting purposes, two NULL values are considered
10529 ** to be the same. In other words, the comparison operator is "IS"
10530 ** (or "IS NOT DISTINCT FROM") and not "==".
10531 **
10532 ** If a virtual table implementation is unable to meet the requirements
10533 ** specified above, then it must not set the "orderByConsumed" flag in the
10534 ** [sqlite3_index_info] object or an incorrect answer may result.
10535 **
10536 ** ^A virtual table implementation is always free to return rows in any order
10537 ** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10538 ** "orderByConsumed" flag is unset, the query planner will add extra
10539 ** [bytecode] to ensure that the final results returned by the SQL query are
10540 ** ordered correctly. The use of the "orderByConsumed" flag and the
10541 ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
10542 ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
10543 ** flag might help queries against a virtual table to run faster. Being
@@ -10630,11 +10630,11 @@
10630 **
10631 ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
10632 ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
10633 ** xFilter method which invokes these routines, and specifically
10634 ** a parameter that was previously selected for all-at-once IN constraint
10635 ** processing using the [sqlite3_vtab_in()] interface in the
10636 ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
10637 ** an xFilter argument that was selected for all-at-once IN constraint
10638 ** processing, then these routines return [SQLITE_ERROR].)^
10639 **
10640 ** ^(Use these routines to access all values on the right-hand side
@@ -10685,11 +10685,11 @@
10685 ** right-hand operand is not known, then *V is set to a NULL pointer.
10686 ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
10687 ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
10688 ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
10689 ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10690 ** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
10691 ** something goes wrong.
10692 **
10693 ** The sqlite3_vtab_rhs_value() interface is usually only successful if
10694 ** the right-hand operand of a constraint is a literal value in the original
10695 ** SQL statement. If the right-hand operand is an expression or a reference
@@ -10713,12 +10713,12 @@
10713 /*
10714 ** CAPI3REF: Conflict resolution modes
10715 ** KEYWORDS: {conflict resolution mode}
10716 **
10717 ** These constants are returned by [sqlite3_vtab_on_conflict()] to
10718 ** inform a [virtual table] implementation of the [ON CONFLICT] mode
10719 ** for the SQL statement being evaluated.
10720 **
10721 ** Note that the [SQLITE_IGNORE] constant is also used as a potential
10722 ** return value from the [sqlite3_set_authorizer()] callback and that
10723 ** [SQLITE_ABORT] is also a [result code].
10724 */
@@ -10754,43 +10754,43 @@
10754 ** to the total number of rows examined by all iterations of the X-th loop.</dd>
10755 **
10756 ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
10757 ** <dd>^The "double" variable pointed to by the V parameter will be set to the
10758 ** query planner's estimate for the average number of rows output from each
10759 ** iteration of the X-th loop. If the query planner's estimate was accurate,
10760 ** then this value will approximate the quotient NVISIT/NLOOP and the
10761 ** product of this value for all prior loops with the same SELECTID will
10762 ** be the NLOOP value for the current loop.</dd>
10763 **
10764 ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
10765 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10766 ** to a zero-terminated UTF-8 string containing the name of the index or table
10767 ** used for the X-th loop.</dd>
10768 **
10769 ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
10770 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10771 ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10772 ** description for the X-th loop.</dd>
10773 **
10774 ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
10775 ** <dd>^The "int" variable pointed to by the V parameter will be set to the
10776 ** id for the X-th query plan element. The id value is unique within the
10777 ** statement. The select-id is the same value as is output in the first
10778 ** column of an [EXPLAIN QUERY PLAN] query.</dd>
10779 **
10780 ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
10781 ** <dd>The "int" variable pointed to by the V parameter will be set to the
10782 ** id of the parent of the current query element, if applicable, or
10783 ** to zero if the query element has no parent. This is the same value as
10784 ** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
10785 **
10786 ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
10787 ** <dd>The sqlite3_int64 output value is set to the number of cycles,
10788 ** according to the processor time-stamp counter, that elapsed while the
10789 ** query element was being processed. This value is not available for
10790 ** all query elements - if it is unavailable the output variable is
10791 ** set to -1.</dd>
10792 ** </dl>
10793 */
10794 #define SQLITE_SCANSTAT_NLOOP 0
10795 #define SQLITE_SCANSTAT_NVISIT 1
10796 #define SQLITE_SCANSTAT_EST 2
@@ -10827,12 +10827,12 @@
10827 ** the EXPLAIN QUERY PLAN output) are available. Invoking API
10828 ** sqlite3_stmt_scanstatus() is equivalent to calling
10829 ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
10830 **
10831 ** Parameter "idx" identifies the specific query element to retrieve statistics
10832 ** for. Query elements are numbered starting from zero. A value of -1 may
10833 ** retrieve statistics for the entire query. ^If idx is out of range
10834 ** - less than -1 or greater than or equal to the total number of query
10835 ** elements used to implement the statement - a non-zero value is returned and
10836 ** the variable that pOut points to is unchanged.
10837 **
10838 ** See also: [sqlite3_stmt_scanstatus_reset()]
@@ -10985,12 +10985,12 @@
10985 ** operation; or 1 for inserts, updates, or deletes invoked by top-level
10986 ** triggers; or 2 for changes resulting from triggers called by top-level
10987 ** triggers; and so forth.
10988 **
10989 ** When the [sqlite3_blob_write()] API is used to update a blob column,
10990 ** the pre-update hook is invoked with SQLITE_DELETE, because
10991 ** the new values are not yet available. In this case, when a
10992 ** callback made with op==SQLITE_DELETE is actually a write using the
10993 ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10994 ** the index of the column being written. In other cases, where the
10995 ** pre-update hook is being invoked for some other reason, including a
10996 ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
@@ -11239,20 +11239,20 @@
11239 ** is written into *P.
11240 **
11241 ** For an ordinary on-disk database file, the serialization is just a
11242 ** copy of the disk file. For an in-memory database or a "TEMP" database,
11243 ** the serialization is the same sequence of bytes which would be written
11244 ** to disk if that database were backed up to disk.
11245 **
11246 ** The usual case is that sqlite3_serialize() copies the serialization of
11247 ** the database into memory obtained from [sqlite3_malloc64()] and returns
11248 ** a pointer to that memory. The caller is responsible for freeing the
11249 ** returned value to avoid a memory leak. However, if the F argument
11250 ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
11251 ** are made, and the sqlite3_serialize() function will return a pointer
11252 ** to the contiguous memory representation of the database that SQLite
11253 ** is currently using for that database, or NULL if no such contiguous
11254 ** memory representation of the database exists. A contiguous memory
11255 ** representation of the database will usually only exist if there has
11256 ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
11257 ** values of D and S.
11258 ** The size of the database is written into *P even if the
@@ -11319,11 +11319,11 @@
11319 **
11320 ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
11321 ** database is currently in a read transaction or is involved in a backup
11322 ** operation.
11323 **
11324 ** It is not possible to deserialize into the TEMP database. If the
11325 ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
11326 ** function returns SQLITE_ERROR.
11327 **
11328 ** The deserialized database should not be in [WAL mode]. If the database
11329 ** is in WAL mode, then any attempt to use the database file will result
@@ -11341,19 +11341,19 @@
11341 */
11342 SQLITE_API int sqlite3_deserialize(
11343 sqlite3 *db, /* The database connection */
11344 const char *zSchema, /* Which DB to reopen with the deserialization */
11345 unsigned char *pData, /* The serialized database content */
11346 sqlite3_int64 szDb, /* Number of bytes in the deserialization */
11347 sqlite3_int64 szBuf, /* Total size of buffer pData[] */
11348 unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
11349 );
11350
11351 /*
11352 ** CAPI3REF: Flags for sqlite3_deserialize()
11353 **
11354 ** The following are allowed values for the 6th argument (the F argument) to
11355 ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
11356 **
11357 ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
11358 ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
11359 ** and that SQLite should take ownership of this memory and automatically
@@ -112888,10 +112888,85 @@
112888 pExpr = pExpr->op==TK_AND ? pLeft : pRight;
112889 }
112890 }
112891 return pExpr;
112892 }
112893
112894 /*
112895 ** Return true if it might be advantageous to compute the right operand
112896 ** of expression pExpr first, before the left operand.
112897 **
112898 ** Normally the left operand is computed before the right operand. But if
112899 ** the left operand contains a subquery and the right does not, then it
112900 ** might be more efficient to compute the right operand first.
112901 */
112902 static int exprEvalRhsFirst(Expr *pExpr){
112903 if( ExprHasProperty(pExpr->pLeft, EP_Subquery)
112904 && !ExprHasProperty(pExpr->pRight, EP_Subquery)
112905 ){
112906 return 1;
112907 }else{
112908 return 0;
112909 }
112910 }
112911
112912 /*
112913 ** Compute the two operands of a binary operator.
112914 **
112915 ** If either operand contains a subquery, then the code strives to
112916 ** compute the operand containing the subquery second. If the other
112917 ** operand evalutes to NULL, then a jump is made. The address of the
112918 ** IsNull operand that does this jump is returned. The caller can use
112919 ** this to optimize the computation so as to avoid doing the potentially
112920 ** expensive subquery.
112921 **
112922 ** If no optimization opportunities exist, return 0.
112923 */
112924 static int exprComputeOperands(
112925 Parse *pParse, /* Parsing context */
112926 Expr *pExpr, /* The comparison expression */
112927 int *pR1, /* OUT: Register holding the left operand */
112928 int *pR2, /* OUT: Register holding the right operand */
112929 int *pFree1, /* OUT: Temp register to free if not zero */
112930 int *pFree2 /* OUT: Another temp register to free if not zero */
112931 ){
112932 int addrIsNull;
112933 int r1, r2;
112934 Vdbe *v = pParse->pVdbe;
112935
112936 assert( v!=0 );
112937 /*
112938 ** If the left operand contains a (possibly expensive) subquery and the
112939 ** right operand does not and the right operation might be NULL,
112940 ** then compute the right operand first and do an IsNull jump if the
112941 ** right operand evalutes to NULL.
112942 */
112943 if( exprEvalRhsFirst(pExpr) && sqlite3ExprCanBeNull(pExpr->pRight) ){
112944 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2);
112945 addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r2); VdbeCoverage(v);
112946 }else{
112947 addrIsNull = 0;
112948 }
112949 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, pFree1);
112950 if( addrIsNull==0 ){
112951 /*
112952 ** If the right operand contains a subquery and the left operand does not
112953 ** and the left operand might be NULL, then check the left operand do
112954 ** an IsNull check on the left operand before computing the right
112955 ** operand.
112956 */
112957 if( ExprHasProperty(pExpr->pRight, EP_Subquery)
112958 && sqlite3ExprCanBeNull(pExpr->pLeft)
112959 ){
112960 addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, r1); VdbeCoverage(v);
112961 }
112962 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, pFree2);
112963 }
112964 *pR1 = r1;
112965 *pR2 = r2;
112966 return addrIsNull;
112967 }
112968
112969 /*
112970 ** pExpr is a TK_FUNCTION node. Try to determine whether or not the
112971 ** function is a constant function. A function is constant if all of
112972 ** the following are true:
@@ -115477,15 +115552,21 @@
115552 case TK_GT:
115553 case TK_GE:
115554 case TK_NE:
115555 case TK_EQ: {
115556 Expr *pLeft = pExpr->pLeft;
115557 int addrIsNull = 0;
115558 if( sqlite3ExprIsVector(pLeft) ){
115559 codeVectorCompare(pParse, pExpr, target, op, p5);
115560 }else{
115561 if( ExprHasProperty(pExpr, EP_Subquery) && p5!=SQLITE_NULLEQ ){
115562 addrIsNull = exprComputeOperands(pParse, pExpr,
115563 &r1, &r2, &regFree1, &regFree2);
115564 }else{
115565 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
115566 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
115567 }
115568 sqlite3VdbeAddOp2(v, OP_Integer, 1, inReg);
115569 codeCompare(pParse, pLeft, pExpr->pRight, op, r1, r2,
115570 sqlite3VdbeCurrentAddr(v)+2, p5,
115571 ExprHasProperty(pExpr,EP_Commuted));
115572 assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
@@ -115496,13 +115577,19 @@
115577 assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne);
115578 if( p5==SQLITE_NULLEQ ){
115579 sqlite3VdbeAddOp2(v, OP_Integer, 0, inReg);
115580 }else{
115581 sqlite3VdbeAddOp3(v, OP_ZeroOrNull, r1, inReg, r2);
115582 if( addrIsNull ){
115583 sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
115584 sqlite3VdbeJumpHere(v, addrIsNull);
115585 sqlite3VdbeAddOp2(v, OP_Null, 0, inReg);
115586 }
115587 }
115588 testcase( regFree1==0 );
115589 testcase( regFree2==0 );
115590
115591 }
115592 break;
115593 }
115594 case TK_AND:
115595 case TK_OR:
@@ -115514,10 +115601,11 @@
115601 case TK_BITOR:
115602 case TK_SLASH:
115603 case TK_LSHIFT:
115604 case TK_RSHIFT:
115605 case TK_CONCAT: {
115606 int addrIsNull;
115607 assert( TK_AND==OP_And ); testcase( op==TK_AND );
115608 assert( TK_OR==OP_Or ); testcase( op==TK_OR );
115609 assert( TK_PLUS==OP_Add ); testcase( op==TK_PLUS );
115610 assert( TK_MINUS==OP_Subtract ); testcase( op==TK_MINUS );
115611 assert( TK_REM==OP_Remainder ); testcase( op==TK_REM );
@@ -115525,15 +115613,26 @@
115613 assert( TK_BITOR==OP_BitOr ); testcase( op==TK_BITOR );
115614 assert( TK_SLASH==OP_Divide ); testcase( op==TK_SLASH );
115615 assert( TK_LSHIFT==OP_ShiftLeft ); testcase( op==TK_LSHIFT );
115616 assert( TK_RSHIFT==OP_ShiftRight ); testcase( op==TK_RSHIFT );
115617 assert( TK_CONCAT==OP_Concat ); testcase( op==TK_CONCAT );
115618 if( ExprHasProperty(pExpr, EP_Subquery) ){
115619 addrIsNull = exprComputeOperands(pParse, pExpr,
115620 &r1, &r2, &regFree1, &regFree2);
115621 }else{
115622 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
115623 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
115624 addrIsNull = 0;
115625 }
115626 sqlite3VdbeAddOp3(v, op, r2, r1, target);
115627 testcase( regFree1==0 );
115628 testcase( regFree2==0 );
115629 if( addrIsNull ){
115630 sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3VdbeCurrentAddr(v)+2);
115631 sqlite3VdbeJumpHere(v, addrIsNull);
115632 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
115633 }
115634 break;
115635 }
115636 case TK_UMINUS: {
115637 Expr *pLeft = pExpr->pLeft;
115638 assert( pLeft );
@@ -116378,21 +116477,31 @@
116477 case TK_AND:
116478 case TK_OR: {
116479 Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
116480 if( pAlt!=pExpr ){
116481 sqlite3ExprIfTrue(pParse, pAlt, dest, jumpIfNull);
 
 
 
 
 
 
 
116482 }else{
116483 Expr *pFirst, *pSecond;
116484 if( exprEvalRhsFirst(pExpr) ){
116485 pFirst = pExpr->pRight;
116486 pSecond = pExpr->pLeft;
116487 }else{
116488 pFirst = pExpr->pLeft;
116489 pSecond = pExpr->pRight;
116490 }
116491 if( op==TK_AND ){
116492 int d2 = sqlite3VdbeMakeLabel(pParse);
116493 testcase( jumpIfNull==0 );
116494 sqlite3ExprIfFalse(pParse, pFirst, d2,
116495 jumpIfNull^SQLITE_JUMPIFNULL);
116496 sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull);
116497 sqlite3VdbeResolveLabel(v, d2);
116498 }else{
116499 testcase( jumpIfNull==0 );
116500 sqlite3ExprIfTrue(pParse, pFirst, dest, jumpIfNull);
116501 sqlite3ExprIfTrue(pParse, pSecond, dest, jumpIfNull);
116502 }
116503 }
116504 break;
116505 }
116506 case TK_NOT: {
116507 testcase( jumpIfNull==0 );
@@ -116427,14 +116536,20 @@
116536 case TK_LE:
116537 case TK_GT:
116538 case TK_GE:
116539 case TK_NE:
116540 case TK_EQ: {
116541 int addrIsNull;
116542 if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
116543 if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){
116544 addrIsNull = exprComputeOperands(pParse, pExpr,
116545 &r1, &r2, &regFree1, &regFree2);
116546 }else{
116547 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116548 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
116549 addrIsNull = 0;
116550 }
116551 codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
116552 r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted));
116553 assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
116554 assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
116555 assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);
@@ -116445,10 +116560,17 @@
116560 assert(TK_NE==OP_Ne); testcase(op==OP_Ne);
116561 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);
116562 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);
116563 testcase( regFree1==0 );
116564 testcase( regFree2==0 );
116565 if( addrIsNull ){
116566 if( jumpIfNull ){
116567 sqlite3VdbeChangeP2(v, addrIsNull, dest);
116568 }else{
116569 sqlite3VdbeJumpHere(v, addrIsNull);
116570 }
116571 }
116572 break;
116573 }
116574 case TK_ISNULL:
116575 case TK_NOTNULL: {
116576 assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL );
@@ -116552,21 +116674,31 @@
116674 case TK_AND:
116675 case TK_OR: {
116676 Expr *pAlt = sqlite3ExprSimplifiedAndOr(pExpr);
116677 if( pAlt!=pExpr ){
116678 sqlite3ExprIfFalse(pParse, pAlt, dest, jumpIfNull);
 
 
 
 
116679 }else{
116680 Expr *pFirst, *pSecond;
116681 if( exprEvalRhsFirst(pExpr) ){
116682 pFirst = pExpr->pRight;
116683 pSecond = pExpr->pLeft;
116684 }else{
116685 pFirst = pExpr->pLeft;
116686 pSecond = pExpr->pRight;
116687 }
116688 if( pExpr->op==TK_AND ){
116689 testcase( jumpIfNull==0 );
116690 sqlite3ExprIfFalse(pParse, pFirst, dest, jumpIfNull);
116691 sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull);
116692 }else{
116693 int d2 = sqlite3VdbeMakeLabel(pParse);
116694 testcase( jumpIfNull==0 );
116695 sqlite3ExprIfTrue(pParse, pFirst, d2,
116696 jumpIfNull^SQLITE_JUMPIFNULL);
116697 sqlite3ExprIfFalse(pParse, pSecond, dest, jumpIfNull);
116698 sqlite3VdbeResolveLabel(v, d2);
116699 }
116700 }
116701 break;
116702 }
116703 case TK_NOT: {
116704 testcase( jumpIfNull==0 );
@@ -116604,14 +116736,20 @@
116736 case TK_LE:
116737 case TK_GT:
116738 case TK_GE:
116739 case TK_NE:
116740 case TK_EQ: {
116741 int addrIsNull;
116742 if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr;
116743 if( ExprHasProperty(pExpr, EP_Subquery) && jumpIfNull!=SQLITE_NULLEQ ){
116744 addrIsNull = exprComputeOperands(pParse, pExpr,
116745 &r1, &r2, &regFree1, &regFree2);
116746 }else{
116747 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
116748 r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
116749 addrIsNull = 0;
116750 }
116751 codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
116752 r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted));
116753 assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt);
116754 assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le);
116755 assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt);
@@ -116622,10 +116760,17 @@
116760 assert(TK_NE==OP_Ne); testcase(op==OP_Ne);
116761 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull!=SQLITE_NULLEQ);
116762 VdbeCoverageIf(v, op==OP_Ne && jumpIfNull==SQLITE_NULLEQ);
116763 testcase( regFree1==0 );
116764 testcase( regFree2==0 );
116765 if( addrIsNull ){
116766 if( jumpIfNull ){
116767 sqlite3VdbeChangeP2(v, addrIsNull, dest);
116768 }else{
116769 sqlite3VdbeJumpHere(v, addrIsNull);
116770 }
116771 }
116772 break;
116773 }
116774 case TK_ISNULL:
116775 case TK_NOTNULL: {
116776 r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
@@ -257503,11 +257648,11 @@
257648 int nArg, /* Number of args */
257649 sqlite3_value **apUnused /* Function arguments */
257650 ){
257651 assert( nArg==0 );
257652 UNUSED_PARAM2(nArg, apUnused);
257653 sqlite3_result_text(pCtx, "fts5: 2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296", -1, SQLITE_TRANSIENT);
257654 }
257655
257656 /*
257657 ** Implementation of fts5_locale(LOCALE, TEXT) function.
257658 **
257659
+43 -43
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149149
#define SQLITE_VERSION "3.51.0"
150150
#define SQLITE_VERSION_NUMBER 3051000
151
-#define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8"
151
+#define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -9056,48 +9056,48 @@
90569056
** careful use of indices.</dd>
90579057
**
90589058
** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
90599059
** <dd>^This is the number of sort operations that have occurred.
90609060
** A non-zero value in this counter may indicate an opportunity to
9061
-** improvement performance through careful use of indices.</dd>
9061
+** improve performance through careful use of indices.</dd>
90629062
**
90639063
** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
90649064
** <dd>^This is the number of rows inserted into transient indices that
90659065
** were created automatically in order to help joins run faster.
90669066
** A non-zero value in this counter may indicate an opportunity to
9067
-** improvement performance by adding permanent indices that do not
9067
+** improve performance by adding permanent indices that do not
90689068
** need to be reinitialized each time the statement is run.</dd>
90699069
**
90709070
** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
90719071
** <dd>^This is the number of virtual machine operations executed
90729072
** by the prepared statement if that number is less than or equal
90739073
** to 2147483647. The number of virtual machine operations can be
90749074
** used as a proxy for the total work done by the prepared statement.
90759075
** If the number of virtual machine operations exceeds 2147483647
9076
-** then the value returned by this statement status code is undefined.
9076
+** then the value returned by this statement status code is undefined.</dd>
90779077
**
90789078
** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
90799079
** <dd>^This is the number of times that the prepare statement has been
90809080
** automatically regenerated due to schema changes or changes to
9081
-** [bound parameters] that might affect the query plan.
9081
+** [bound parameters] that might affect the query plan.</dd>
90829082
**
90839083
** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
90849084
** <dd>^This is the number of times that the prepared statement has
90859085
** been run. A single "run" for the purposes of this counter is one
90869086
** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
90879087
** The counter is incremented on the first [sqlite3_step()] call of each
9088
-** cycle.
9088
+** cycle.</dd>
90899089
**
90909090
** [[SQLITE_STMTSTATUS_FILTER_MISS]]
90919091
** [[SQLITE_STMTSTATUS_FILTER HIT]]
90929092
** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
90939093
** SQLITE_STMTSTATUS_FILTER_MISS</dt>
90949094
** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
90959095
** step was bypassed because a Bloom filter returned not-found. The
90969096
** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
90979097
** times that the Bloom filter returned a find, and thus the join step
9098
-** had to be processed as normal.
9098
+** had to be processed as normal.</dd>
90999099
**
91009100
** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
91019101
** <dd>^This is the approximate number of bytes of heap memory
91029102
** used to store the prepared statement. ^This value is not actually
91039103
** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -9198,31 +9198,31 @@
91989198
** [[the xCreate() page cache methods]]
91999199
** ^SQLite invokes the xCreate() method to construct a new cache instance.
92009200
** SQLite will typically create one cache instance for each open database file,
92019201
** though this is not guaranteed. ^The
92029202
** first parameter, szPage, is the size in bytes of the pages that must
9203
-** be allocated by the cache. ^szPage will always a power of two. ^The
9203
+** be allocated by the cache. ^szPage will always be a power of two. ^The
92049204
** second parameter szExtra is a number of bytes of extra storage
9205
-** associated with each page cache entry. ^The szExtra parameter will
9205
+** associated with each page cache entry. ^The szExtra parameter will be
92069206
** a number less than 250. SQLite will use the
92079207
** extra szExtra bytes on each page to store metadata about the underlying
92089208
** database page on disk. The value passed into szExtra depends
92099209
** on the SQLite version, the target platform, and how SQLite was compiled.
92109210
** ^The third argument to xCreate(), bPurgeable, is true if the cache being
92119211
** created will be used to cache database pages of a file stored on disk, or
92129212
** false if it is used for an in-memory database. The cache implementation
9213
-** does not have to do anything special based with the value of bPurgeable;
9213
+** does not have to do anything special based upon the value of bPurgeable;
92149214
** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
92159215
** never invoke xUnpin() except to deliberately delete a page.
92169216
** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
92179217
** false will always have the "discard" flag set to true.
9218
-** ^Hence, a cache created with bPurgeable false will
9218
+** ^Hence, a cache created with bPurgeable set to false will
92199219
** never contain any unpinned pages.
92209220
**
92219221
** [[the xCachesize() page cache method]]
92229222
** ^(The xCachesize() method may be called at any time by SQLite to set the
9223
-** suggested maximum cache-size (number of pages stored by) the cache
9223
+** suggested maximum cache-size (number of pages stored) for the cache
92249224
** instance passed as the first argument. This is the value configured using
92259225
** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
92269226
** parameter, the implementation is not required to do anything with this
92279227
** value; it is advisory only.
92289228
**
@@ -9245,16 +9245,16 @@
92459245
**
92469246
** If the requested page is already in the page cache, then the page cache
92479247
** implementation must return a pointer to the page buffer with its content
92489248
** intact. If the requested page is not already in the cache, then the
92499249
** cache implementation should use the value of the createFlag
9250
-** parameter to help it determined what action to take:
9250
+** parameter to help it determine what action to take:
92519251
**
92529252
** <table border=1 width=85% align=center>
92539253
** <tr><th> createFlag <th> Behavior when page is not already in cache
92549254
** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9255
-** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
9255
+** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
92569256
** Otherwise return NULL.
92579257
** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
92589258
** NULL if allocating a new page is effectively impossible.
92599259
** </table>
92609260
**
@@ -9267,11 +9267,11 @@
92679267
** [[the xUnpin() page cache method]]
92689268
** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
92699269
** as its second argument. If the third parameter, discard, is non-zero,
92709270
** then the page must be evicted from the cache.
92719271
** ^If the discard parameter is
9272
-** zero, then the page may be discarded or retained at the discretion of
9272
+** zero, then the page may be discarded or retained at the discretion of the
92739273
** page cache implementation. ^The page cache implementation
92749274
** may choose to evict unpinned pages at any time.
92759275
**
92769276
** The cache must not perform any reference counting. A single
92779277
** call to xUnpin() unpins the page regardless of the number of prior calls
@@ -9285,11 +9285,11 @@
92859285
** to be pinned.
92869286
**
92879287
** When SQLite calls the xTruncate() method, the cache must discard all
92889288
** existing cache entries with page numbers (keys) greater than or equal
92899289
** to the value of the iLimit parameter passed to xTruncate(). If any
9290
-** of these pages are pinned, they are implicitly unpinned, meaning that
9290
+** of these pages are pinned, they become implicitly unpinned, meaning that
92919291
** they can be safely discarded.
92929292
**
92939293
** [[the xDestroy() page cache method]]
92949294
** ^The xDestroy() method is used to delete a cache allocated by xCreate().
92959295
** All resources associated with the specified cache should be freed. ^After
@@ -9584,11 +9584,11 @@
95849584
** identity of the database connection (the blocking connection) that
95859585
** has locked the required resource is stored internally. ^After an
95869586
** application receives an SQLITE_LOCKED error, it may call the
95879587
** sqlite3_unlock_notify() method with the blocked connection handle as
95889588
** the first argument to register for a callback that will be invoked
9589
-** when the blocking connections current transaction is concluded. ^The
9589
+** when the blocking connection's current transaction is concluded. ^The
95909590
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
95919591
** call that concludes the blocking connection's transaction.
95929592
**
95939593
** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
95949594
** there is a chance that the blocking connection will have already
@@ -9604,11 +9604,11 @@
96049604
** ^(There may be at most one unlock-notify callback registered by a
96059605
** blocked connection. If sqlite3_unlock_notify() is called when the
96069606
** blocked connection already has a registered unlock-notify callback,
96079607
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
96089608
** called with a NULL pointer as its second argument, then any existing
9609
-** unlock-notify callback is canceled. ^The blocked connections
9609
+** unlock-notify callback is canceled. ^The blocked connection's
96109610
** unlock-notify callback may also be canceled by closing the blocked
96119611
** connection using [sqlite3_close()].
96129612
**
96139613
** The unlock-notify callback is not reentrant. If an application invokes
96149614
** any sqlite3_xxx API functions from within an unlock-notify callback, a
@@ -10002,11 +10002,11 @@
1000210002
** where X is an integer. If X is zero, then the [virtual table] whose
1000310003
** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
1000410004
** support constraints. In this configuration (which is the default) if
1000510005
** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
1000610006
** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10007
-** specified as part of the users SQL statement, regardless of the actual
10007
+** specified as part of the user's SQL statement, regardless of the actual
1000810008
** ON CONFLICT mode specified.
1000910009
**
1001010010
** If X is non-zero, then the virtual table implementation guarantees
1001110011
** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
1001210012
** any modifications to internal or persistent data structures have been made.
@@ -10036,11 +10036,11 @@
1003610036
** </dd>
1003710037
**
1003810038
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
1003910039
** <dd>Calls of the form
1004010040
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10041
-** the [xConnect] or [xCreate] methods of a [virtual table] implementation
10041
+** [xConnect] or [xCreate] methods of a [virtual table] implementation
1004210042
** identify that virtual table as being safe to use from within triggers
1004310043
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
1004410044
** virtual table can do no serious harm even if it is controlled by a
1004510045
** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
1004610046
** flag unless absolutely necessary.
@@ -10204,21 +10204,21 @@
1020410204
** <tr><td>2<td>no<td>yes<td>yes
1020510205
** <tr><td>3<td>yes<td>yes<td>yes
1020610206
** </table>
1020710207
**
1020810208
** ^For the purposes of comparing virtual table output values to see if the
10209
-** values are same value for sorting purposes, two NULL values are considered
10209
+** values are the same value for sorting purposes, two NULL values are considered
1021010210
** to be the same. In other words, the comparison operator is "IS"
1021110211
** (or "IS NOT DISTINCT FROM") and not "==".
1021210212
**
1021310213
** If a virtual table implementation is unable to meet the requirements
1021410214
** specified above, then it must not set the "orderByConsumed" flag in the
1021510215
** [sqlite3_index_info] object or an incorrect answer may result.
1021610216
**
1021710217
** ^A virtual table implementation is always free to return rows in any order
1021810218
** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10219
-** the "orderByConsumed" flag is unset, the query planner will add extra
10219
+** "orderByConsumed" flag is unset, the query planner will add extra
1022010220
** [bytecode] to ensure that the final results returned by the SQL query are
1022110221
** ordered correctly. The use of the "orderByConsumed" flag and the
1022210222
** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
1022310223
** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
1022410224
** flag might help queries against a virtual table to run faster. Being
@@ -10311,11 +10311,11 @@
1031110311
**
1031210312
** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
1031310313
** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
1031410314
** xFilter method which invokes these routines, and specifically
1031510315
** a parameter that was previously selected for all-at-once IN constraint
10316
-** processing use the [sqlite3_vtab_in()] interface in the
10316
+** processing using the [sqlite3_vtab_in()] interface in the
1031710317
** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
1031810318
** an xFilter argument that was selected for all-at-once IN constraint
1031910319
** processing, then these routines return [SQLITE_ERROR].)^
1032010320
**
1032110321
** ^(Use these routines to access all values on the right-hand side
@@ -10366,11 +10366,11 @@
1036610366
** right-hand operand is not known, then *V is set to a NULL pointer.
1036710367
** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
1036810368
** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
1036910369
** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
1037010370
** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10371
-** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
10371
+** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
1037210372
** something goes wrong.
1037310373
**
1037410374
** The sqlite3_vtab_rhs_value() interface is usually only successful if
1037510375
** the right-hand operand of a constraint is a literal value in the original
1037610376
** SQL statement. If the right-hand operand is an expression or a reference
@@ -10394,12 +10394,12 @@
1039410394
/*
1039510395
** CAPI3REF: Conflict resolution modes
1039610396
** KEYWORDS: {conflict resolution mode}
1039710397
**
1039810398
** These constants are returned by [sqlite3_vtab_on_conflict()] to
10399
-** inform a [virtual table] implementation what the [ON CONFLICT] mode
10400
-** is for the SQL statement being evaluated.
10399
+** inform a [virtual table] implementation of the [ON CONFLICT] mode
10400
+** for the SQL statement being evaluated.
1040110401
**
1040210402
** Note that the [SQLITE_IGNORE] constant is also used as a potential
1040310403
** return value from the [sqlite3_set_authorizer()] callback and that
1040410404
** [SQLITE_ABORT] is also a [result code].
1040510405
*/
@@ -10435,43 +10435,43 @@
1043510435
** to the total number of rows examined by all iterations of the X-th loop.</dd>
1043610436
**
1043710437
** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
1043810438
** <dd>^The "double" variable pointed to by the V parameter will be set to the
1043910439
** query planner's estimate for the average number of rows output from each
10440
-** iteration of the X-th loop. If the query planner's estimates was accurate,
10440
+** iteration of the X-th loop. If the query planner's estimate was accurate,
1044110441
** then this value will approximate the quotient NVISIT/NLOOP and the
1044210442
** product of this value for all prior loops with the same SELECTID will
10443
-** be the NLOOP value for the current loop.
10443
+** be the NLOOP value for the current loop.</dd>
1044410444
**
1044510445
** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
1044610446
** <dd>^The "const char *" variable pointed to by the V parameter will be set
1044710447
** to a zero-terminated UTF-8 string containing the name of the index or table
10448
-** used for the X-th loop.
10448
+** used for the X-th loop.</dd>
1044910449
**
1045010450
** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
1045110451
** <dd>^The "const char *" variable pointed to by the V parameter will be set
1045210452
** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10453
-** description for the X-th loop.
10453
+** description for the X-th loop.</dd>
1045410454
**
1045510455
** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
1045610456
** <dd>^The "int" variable pointed to by the V parameter will be set to the
1045710457
** id for the X-th query plan element. The id value is unique within the
1045810458
** statement. The select-id is the same value as is output in the first
10459
-** column of an [EXPLAIN QUERY PLAN] query.
10459
+** column of an [EXPLAIN QUERY PLAN] query.</dd>
1046010460
**
1046110461
** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
1046210462
** <dd>The "int" variable pointed to by the V parameter will be set to the
10463
-** the id of the parent of the current query element, if applicable, or
10463
+** id of the parent of the current query element, if applicable, or
1046410464
** to zero if the query element has no parent. This is the same value as
10465
-** returned in the second column of an [EXPLAIN QUERY PLAN] query.
10465
+** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
1046610466
**
1046710467
** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
1046810468
** <dd>The sqlite3_int64 output value is set to the number of cycles,
1046910469
** according to the processor time-stamp counter, that elapsed while the
1047010470
** query element was being processed. This value is not available for
1047110471
** all query elements - if it is unavailable the output variable is
10472
-** set to -1.
10472
+** set to -1.</dd>
1047310473
** </dl>
1047410474
*/
1047510475
#define SQLITE_SCANSTAT_NLOOP 0
1047610476
#define SQLITE_SCANSTAT_NVISIT 1
1047710477
#define SQLITE_SCANSTAT_EST 2
@@ -10508,12 +10508,12 @@
1050810508
** the EXPLAIN QUERY PLAN output) are available. Invoking API
1050910509
** sqlite3_stmt_scanstatus() is equivalent to calling
1051010510
** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
1051110511
**
1051210512
** Parameter "idx" identifies the specific query element to retrieve statistics
10513
-** for. Query elements are numbered starting from zero. A value of -1 may be
10514
-** to query for statistics regarding the entire query. ^If idx is out of range
10513
+** for. Query elements are numbered starting from zero. A value of -1 may
10514
+** retrieve statistics for the entire query. ^If idx is out of range
1051510515
** - less than -1 or greater than or equal to the total number of query
1051610516
** elements used to implement the statement - a non-zero value is returned and
1051710517
** the variable that pOut points to is unchanged.
1051810518
**
1051910519
** See also: [sqlite3_stmt_scanstatus_reset()]
@@ -10666,12 +10666,12 @@
1066610666
** operation; or 1 for inserts, updates, or deletes invoked by top-level
1066710667
** triggers; or 2 for changes resulting from triggers called by top-level
1066810668
** triggers; and so forth.
1066910669
**
1067010670
** When the [sqlite3_blob_write()] API is used to update a blob column,
10671
-** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10672
-** in this case the new values are not available. In this case, when a
10671
+** the pre-update hook is invoked with SQLITE_DELETE, because
10672
+** the new values are not yet available. In this case, when a
1067310673
** callback made with op==SQLITE_DELETE is actually a write using the
1067410674
** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
1067510675
** the index of the column being written. In other cases, where the
1067610676
** pre-update hook is being invoked for some other reason, including a
1067710677
** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
@@ -10920,20 +10920,20 @@
1092010920
** is written into *P.
1092110921
**
1092210922
** For an ordinary on-disk database file, the serialization is just a
1092310923
** copy of the disk file. For an in-memory database or a "TEMP" database,
1092410924
** the serialization is the same sequence of bytes which would be written
10925
-** to disk if that database where backed up to disk.
10925
+** to disk if that database were backed up to disk.
1092610926
**
1092710927
** The usual case is that sqlite3_serialize() copies the serialization of
1092810928
** the database into memory obtained from [sqlite3_malloc64()] and returns
1092910929
** a pointer to that memory. The caller is responsible for freeing the
1093010930
** returned value to avoid a memory leak. However, if the F argument
1093110931
** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
1093210932
** are made, and the sqlite3_serialize() function will return a pointer
1093310933
** to the contiguous memory representation of the database that SQLite
10934
-** is currently using for that database, or NULL if the no such contiguous
10934
+** is currently using for that database, or NULL if no such contiguous
1093510935
** memory representation of the database exists. A contiguous memory
1093610936
** representation of the database will usually only exist if there has
1093710937
** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
1093810938
** values of D and S.
1093910939
** The size of the database is written into *P even if the
@@ -11000,11 +11000,11 @@
1100011000
**
1100111001
** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
1100211002
** database is currently in a read transaction or is involved in a backup
1100311003
** operation.
1100411004
**
11005
-** It is not possible to deserialized into the TEMP database. If the
11005
+** It is not possible to deserialize into the TEMP database. If the
1100611006
** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
1100711007
** function returns SQLITE_ERROR.
1100811008
**
1100911009
** The deserialized database should not be in [WAL mode]. If the database
1101011010
** is in WAL mode, then any attempt to use the database file will result
@@ -11022,19 +11022,19 @@
1102211022
*/
1102311023
SQLITE_API int sqlite3_deserialize(
1102411024
sqlite3 *db, /* The database connection */
1102511025
const char *zSchema, /* Which DB to reopen with the deserialization */
1102611026
unsigned char *pData, /* The serialized database content */
11027
- sqlite3_int64 szDb, /* Number bytes in the deserialization */
11027
+ sqlite3_int64 szDb, /* Number of bytes in the deserialization */
1102811028
sqlite3_int64 szBuf, /* Total size of buffer pData[] */
1102911029
unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
1103011030
);
1103111031
1103211032
/*
1103311033
** CAPI3REF: Flags for sqlite3_deserialize()
1103411034
**
11035
-** The following are allowed values for 6th argument (the F argument) to
11035
+** The following are allowed values for the 6th argument (the F argument) to
1103611036
** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
1103711037
**
1103811038
** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
1103911039
** in the P argument is held in memory obtained from [sqlite3_malloc64()]
1104011040
** and that SQLite should take ownership of this memory and automatically
1104111041
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.51.0"
150 #define SQLITE_VERSION_NUMBER 3051000
151 #define SQLITE_SOURCE_ID "2025-06-27 19:02:21 5508b56fd24016c13981ec280ecdd833007c9d8dd595edb295b984c2b487b5c8"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -9056,48 +9056,48 @@
9056 ** careful use of indices.</dd>
9057 **
9058 ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
9059 ** <dd>^This is the number of sort operations that have occurred.
9060 ** A non-zero value in this counter may indicate an opportunity to
9061 ** improvement performance through careful use of indices.</dd>
9062 **
9063 ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
9064 ** <dd>^This is the number of rows inserted into transient indices that
9065 ** were created automatically in order to help joins run faster.
9066 ** A non-zero value in this counter may indicate an opportunity to
9067 ** improvement performance by adding permanent indices that do not
9068 ** need to be reinitialized each time the statement is run.</dd>
9069 **
9070 ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
9071 ** <dd>^This is the number of virtual machine operations executed
9072 ** by the prepared statement if that number is less than or equal
9073 ** to 2147483647. The number of virtual machine operations can be
9074 ** used as a proxy for the total work done by the prepared statement.
9075 ** If the number of virtual machine operations exceeds 2147483647
9076 ** then the value returned by this statement status code is undefined.
9077 **
9078 ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
9079 ** <dd>^This is the number of times that the prepare statement has been
9080 ** automatically regenerated due to schema changes or changes to
9081 ** [bound parameters] that might affect the query plan.
9082 **
9083 ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
9084 ** <dd>^This is the number of times that the prepared statement has
9085 ** been run. A single "run" for the purposes of this counter is one
9086 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
9087 ** The counter is incremented on the first [sqlite3_step()] call of each
9088 ** cycle.
9089 **
9090 ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
9091 ** [[SQLITE_STMTSTATUS_FILTER HIT]]
9092 ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
9093 ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
9094 ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
9095 ** step was bypassed because a Bloom filter returned not-found. The
9096 ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
9097 ** times that the Bloom filter returned a find, and thus the join step
9098 ** had to be processed as normal.
9099 **
9100 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
9101 ** <dd>^This is the approximate number of bytes of heap memory
9102 ** used to store the prepared statement. ^This value is not actually
9103 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -9198,31 +9198,31 @@
9198 ** [[the xCreate() page cache methods]]
9199 ** ^SQLite invokes the xCreate() method to construct a new cache instance.
9200 ** SQLite will typically create one cache instance for each open database file,
9201 ** though this is not guaranteed. ^The
9202 ** first parameter, szPage, is the size in bytes of the pages that must
9203 ** be allocated by the cache. ^szPage will always a power of two. ^The
9204 ** second parameter szExtra is a number of bytes of extra storage
9205 ** associated with each page cache entry. ^The szExtra parameter will
9206 ** a number less than 250. SQLite will use the
9207 ** extra szExtra bytes on each page to store metadata about the underlying
9208 ** database page on disk. The value passed into szExtra depends
9209 ** on the SQLite version, the target platform, and how SQLite was compiled.
9210 ** ^The third argument to xCreate(), bPurgeable, is true if the cache being
9211 ** created will be used to cache database pages of a file stored on disk, or
9212 ** false if it is used for an in-memory database. The cache implementation
9213 ** does not have to do anything special based with the value of bPurgeable;
9214 ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
9215 ** never invoke xUnpin() except to deliberately delete a page.
9216 ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
9217 ** false will always have the "discard" flag set to true.
9218 ** ^Hence, a cache created with bPurgeable false will
9219 ** never contain any unpinned pages.
9220 **
9221 ** [[the xCachesize() page cache method]]
9222 ** ^(The xCachesize() method may be called at any time by SQLite to set the
9223 ** suggested maximum cache-size (number of pages stored by) the cache
9224 ** instance passed as the first argument. This is the value configured using
9225 ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
9226 ** parameter, the implementation is not required to do anything with this
9227 ** value; it is advisory only.
9228 **
@@ -9245,16 +9245,16 @@
9245 **
9246 ** If the requested page is already in the page cache, then the page cache
9247 ** implementation must return a pointer to the page buffer with its content
9248 ** intact. If the requested page is not already in the cache, then the
9249 ** cache implementation should use the value of the createFlag
9250 ** parameter to help it determined what action to take:
9251 **
9252 ** <table border=1 width=85% align=center>
9253 ** <tr><th> createFlag <th> Behavior when page is not already in cache
9254 ** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9255 ** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
9256 ** Otherwise return NULL.
9257 ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
9258 ** NULL if allocating a new page is effectively impossible.
9259 ** </table>
9260 **
@@ -9267,11 +9267,11 @@
9267 ** [[the xUnpin() page cache method]]
9268 ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
9269 ** as its second argument. If the third parameter, discard, is non-zero,
9270 ** then the page must be evicted from the cache.
9271 ** ^If the discard parameter is
9272 ** zero, then the page may be discarded or retained at the discretion of
9273 ** page cache implementation. ^The page cache implementation
9274 ** may choose to evict unpinned pages at any time.
9275 **
9276 ** The cache must not perform any reference counting. A single
9277 ** call to xUnpin() unpins the page regardless of the number of prior calls
@@ -9285,11 +9285,11 @@
9285 ** to be pinned.
9286 **
9287 ** When SQLite calls the xTruncate() method, the cache must discard all
9288 ** existing cache entries with page numbers (keys) greater than or equal
9289 ** to the value of the iLimit parameter passed to xTruncate(). If any
9290 ** of these pages are pinned, they are implicitly unpinned, meaning that
9291 ** they can be safely discarded.
9292 **
9293 ** [[the xDestroy() page cache method]]
9294 ** ^The xDestroy() method is used to delete a cache allocated by xCreate().
9295 ** All resources associated with the specified cache should be freed. ^After
@@ -9584,11 +9584,11 @@
9584 ** identity of the database connection (the blocking connection) that
9585 ** has locked the required resource is stored internally. ^After an
9586 ** application receives an SQLITE_LOCKED error, it may call the
9587 ** sqlite3_unlock_notify() method with the blocked connection handle as
9588 ** the first argument to register for a callback that will be invoked
9589 ** when the blocking connections current transaction is concluded. ^The
9590 ** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
9591 ** call that concludes the blocking connection's transaction.
9592 **
9593 ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
9594 ** there is a chance that the blocking connection will have already
@@ -9604,11 +9604,11 @@
9604 ** ^(There may be at most one unlock-notify callback registered by a
9605 ** blocked connection. If sqlite3_unlock_notify() is called when the
9606 ** blocked connection already has a registered unlock-notify callback,
9607 ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
9608 ** called with a NULL pointer as its second argument, then any existing
9609 ** unlock-notify callback is canceled. ^The blocked connections
9610 ** unlock-notify callback may also be canceled by closing the blocked
9611 ** connection using [sqlite3_close()].
9612 **
9613 ** The unlock-notify callback is not reentrant. If an application invokes
9614 ** any sqlite3_xxx API functions from within an unlock-notify callback, a
@@ -10002,11 +10002,11 @@
10002 ** where X is an integer. If X is zero, then the [virtual table] whose
10003 ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
10004 ** support constraints. In this configuration (which is the default) if
10005 ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
10006 ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10007 ** specified as part of the users SQL statement, regardless of the actual
10008 ** ON CONFLICT mode specified.
10009 **
10010 ** If X is non-zero, then the virtual table implementation guarantees
10011 ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
10012 ** any modifications to internal or persistent data structures have been made.
@@ -10036,11 +10036,11 @@
10036 ** </dd>
10037 **
10038 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
10039 ** <dd>Calls of the form
10040 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10041 ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
10042 ** identify that virtual table as being safe to use from within triggers
10043 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
10044 ** virtual table can do no serious harm even if it is controlled by a
10045 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
10046 ** flag unless absolutely necessary.
@@ -10204,21 +10204,21 @@
10204 ** <tr><td>2<td>no<td>yes<td>yes
10205 ** <tr><td>3<td>yes<td>yes<td>yes
10206 ** </table>
10207 **
10208 ** ^For the purposes of comparing virtual table output values to see if the
10209 ** values are same value for sorting purposes, two NULL values are considered
10210 ** to be the same. In other words, the comparison operator is "IS"
10211 ** (or "IS NOT DISTINCT FROM") and not "==".
10212 **
10213 ** If a virtual table implementation is unable to meet the requirements
10214 ** specified above, then it must not set the "orderByConsumed" flag in the
10215 ** [sqlite3_index_info] object or an incorrect answer may result.
10216 **
10217 ** ^A virtual table implementation is always free to return rows in any order
10218 ** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10219 ** the "orderByConsumed" flag is unset, the query planner will add extra
10220 ** [bytecode] to ensure that the final results returned by the SQL query are
10221 ** ordered correctly. The use of the "orderByConsumed" flag and the
10222 ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
10223 ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
10224 ** flag might help queries against a virtual table to run faster. Being
@@ -10311,11 +10311,11 @@
10311 **
10312 ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
10313 ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
10314 ** xFilter method which invokes these routines, and specifically
10315 ** a parameter that was previously selected for all-at-once IN constraint
10316 ** processing use the [sqlite3_vtab_in()] interface in the
10317 ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
10318 ** an xFilter argument that was selected for all-at-once IN constraint
10319 ** processing, then these routines return [SQLITE_ERROR].)^
10320 **
10321 ** ^(Use these routines to access all values on the right-hand side
@@ -10366,11 +10366,11 @@
10366 ** right-hand operand is not known, then *V is set to a NULL pointer.
10367 ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
10368 ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
10369 ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
10370 ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10371 ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
10372 ** something goes wrong.
10373 **
10374 ** The sqlite3_vtab_rhs_value() interface is usually only successful if
10375 ** the right-hand operand of a constraint is a literal value in the original
10376 ** SQL statement. If the right-hand operand is an expression or a reference
@@ -10394,12 +10394,12 @@
10394 /*
10395 ** CAPI3REF: Conflict resolution modes
10396 ** KEYWORDS: {conflict resolution mode}
10397 **
10398 ** These constants are returned by [sqlite3_vtab_on_conflict()] to
10399 ** inform a [virtual table] implementation what the [ON CONFLICT] mode
10400 ** is for the SQL statement being evaluated.
10401 **
10402 ** Note that the [SQLITE_IGNORE] constant is also used as a potential
10403 ** return value from the [sqlite3_set_authorizer()] callback and that
10404 ** [SQLITE_ABORT] is also a [result code].
10405 */
@@ -10435,43 +10435,43 @@
10435 ** to the total number of rows examined by all iterations of the X-th loop.</dd>
10436 **
10437 ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
10438 ** <dd>^The "double" variable pointed to by the V parameter will be set to the
10439 ** query planner's estimate for the average number of rows output from each
10440 ** iteration of the X-th loop. If the query planner's estimates was accurate,
10441 ** then this value will approximate the quotient NVISIT/NLOOP and the
10442 ** product of this value for all prior loops with the same SELECTID will
10443 ** be the NLOOP value for the current loop.
10444 **
10445 ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
10446 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10447 ** to a zero-terminated UTF-8 string containing the name of the index or table
10448 ** used for the X-th loop.
10449 **
10450 ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
10451 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10452 ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10453 ** description for the X-th loop.
10454 **
10455 ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
10456 ** <dd>^The "int" variable pointed to by the V parameter will be set to the
10457 ** id for the X-th query plan element. The id value is unique within the
10458 ** statement. The select-id is the same value as is output in the first
10459 ** column of an [EXPLAIN QUERY PLAN] query.
10460 **
10461 ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
10462 ** <dd>The "int" variable pointed to by the V parameter will be set to the
10463 ** the id of the parent of the current query element, if applicable, or
10464 ** to zero if the query element has no parent. This is the same value as
10465 ** returned in the second column of an [EXPLAIN QUERY PLAN] query.
10466 **
10467 ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
10468 ** <dd>The sqlite3_int64 output value is set to the number of cycles,
10469 ** according to the processor time-stamp counter, that elapsed while the
10470 ** query element was being processed. This value is not available for
10471 ** all query elements - if it is unavailable the output variable is
10472 ** set to -1.
10473 ** </dl>
10474 */
10475 #define SQLITE_SCANSTAT_NLOOP 0
10476 #define SQLITE_SCANSTAT_NVISIT 1
10477 #define SQLITE_SCANSTAT_EST 2
@@ -10508,12 +10508,12 @@
10508 ** the EXPLAIN QUERY PLAN output) are available. Invoking API
10509 ** sqlite3_stmt_scanstatus() is equivalent to calling
10510 ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
10511 **
10512 ** Parameter "idx" identifies the specific query element to retrieve statistics
10513 ** for. Query elements are numbered starting from zero. A value of -1 may be
10514 ** to query for statistics regarding the entire query. ^If idx is out of range
10515 ** - less than -1 or greater than or equal to the total number of query
10516 ** elements used to implement the statement - a non-zero value is returned and
10517 ** the variable that pOut points to is unchanged.
10518 **
10519 ** See also: [sqlite3_stmt_scanstatus_reset()]
@@ -10666,12 +10666,12 @@
10666 ** operation; or 1 for inserts, updates, or deletes invoked by top-level
10667 ** triggers; or 2 for changes resulting from triggers called by top-level
10668 ** triggers; and so forth.
10669 **
10670 ** When the [sqlite3_blob_write()] API is used to update a blob column,
10671 ** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10672 ** in this case the new values are not available. In this case, when a
10673 ** callback made with op==SQLITE_DELETE is actually a write using the
10674 ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10675 ** the index of the column being written. In other cases, where the
10676 ** pre-update hook is being invoked for some other reason, including a
10677 ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
@@ -10920,20 +10920,20 @@
10920 ** is written into *P.
10921 **
10922 ** For an ordinary on-disk database file, the serialization is just a
10923 ** copy of the disk file. For an in-memory database or a "TEMP" database,
10924 ** the serialization is the same sequence of bytes which would be written
10925 ** to disk if that database where backed up to disk.
10926 **
10927 ** The usual case is that sqlite3_serialize() copies the serialization of
10928 ** the database into memory obtained from [sqlite3_malloc64()] and returns
10929 ** a pointer to that memory. The caller is responsible for freeing the
10930 ** returned value to avoid a memory leak. However, if the F argument
10931 ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
10932 ** are made, and the sqlite3_serialize() function will return a pointer
10933 ** to the contiguous memory representation of the database that SQLite
10934 ** is currently using for that database, or NULL if the no such contiguous
10935 ** memory representation of the database exists. A contiguous memory
10936 ** representation of the database will usually only exist if there has
10937 ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
10938 ** values of D and S.
10939 ** The size of the database is written into *P even if the
@@ -11000,11 +11000,11 @@
11000 **
11001 ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
11002 ** database is currently in a read transaction or is involved in a backup
11003 ** operation.
11004 **
11005 ** It is not possible to deserialized into the TEMP database. If the
11006 ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
11007 ** function returns SQLITE_ERROR.
11008 **
11009 ** The deserialized database should not be in [WAL mode]. If the database
11010 ** is in WAL mode, then any attempt to use the database file will result
@@ -11022,19 +11022,19 @@
11022 */
11023 SQLITE_API int sqlite3_deserialize(
11024 sqlite3 *db, /* The database connection */
11025 const char *zSchema, /* Which DB to reopen with the deserialization */
11026 unsigned char *pData, /* The serialized database content */
11027 sqlite3_int64 szDb, /* Number bytes in the deserialization */
11028 sqlite3_int64 szBuf, /* Total size of buffer pData[] */
11029 unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
11030 );
11031
11032 /*
11033 ** CAPI3REF: Flags for sqlite3_deserialize()
11034 **
11035 ** The following are allowed values for 6th argument (the F argument) to
11036 ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
11037 **
11038 ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
11039 ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
11040 ** and that SQLite should take ownership of this memory and automatically
11041
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -146,11 +146,11 @@
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.51.0"
150 #define SQLITE_VERSION_NUMBER 3051000
151 #define SQLITE_SOURCE_ID "2025-06-30 16:41:40 0083d5169a46104a25355bdd9d5a2f4027b049191ebda571dd228477ec217296"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -9056,48 +9056,48 @@
9056 ** careful use of indices.</dd>
9057 **
9058 ** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
9059 ** <dd>^This is the number of sort operations that have occurred.
9060 ** A non-zero value in this counter may indicate an opportunity to
9061 ** improve performance through careful use of indices.</dd>
9062 **
9063 ** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
9064 ** <dd>^This is the number of rows inserted into transient indices that
9065 ** were created automatically in order to help joins run faster.
9066 ** A non-zero value in this counter may indicate an opportunity to
9067 ** improve performance by adding permanent indices that do not
9068 ** need to be reinitialized each time the statement is run.</dd>
9069 **
9070 ** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
9071 ** <dd>^This is the number of virtual machine operations executed
9072 ** by the prepared statement if that number is less than or equal
9073 ** to 2147483647. The number of virtual machine operations can be
9074 ** used as a proxy for the total work done by the prepared statement.
9075 ** If the number of virtual machine operations exceeds 2147483647
9076 ** then the value returned by this statement status code is undefined.</dd>
9077 **
9078 ** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
9079 ** <dd>^This is the number of times that the prepare statement has been
9080 ** automatically regenerated due to schema changes or changes to
9081 ** [bound parameters] that might affect the query plan.</dd>
9082 **
9083 ** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
9084 ** <dd>^This is the number of times that the prepared statement has
9085 ** been run. A single "run" for the purposes of this counter is one
9086 ** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
9087 ** The counter is incremented on the first [sqlite3_step()] call of each
9088 ** cycle.</dd>
9089 **
9090 ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
9091 ** [[SQLITE_STMTSTATUS_FILTER HIT]]
9092 ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
9093 ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
9094 ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
9095 ** step was bypassed because a Bloom filter returned not-found. The
9096 ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
9097 ** times that the Bloom filter returned a find, and thus the join step
9098 ** had to be processed as normal.</dd>
9099 **
9100 ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
9101 ** <dd>^This is the approximate number of bytes of heap memory
9102 ** used to store the prepared statement. ^This value is not actually
9103 ** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
@@ -9198,31 +9198,31 @@
9198 ** [[the xCreate() page cache methods]]
9199 ** ^SQLite invokes the xCreate() method to construct a new cache instance.
9200 ** SQLite will typically create one cache instance for each open database file,
9201 ** though this is not guaranteed. ^The
9202 ** first parameter, szPage, is the size in bytes of the pages that must
9203 ** be allocated by the cache. ^szPage will always be a power of two. ^The
9204 ** second parameter szExtra is a number of bytes of extra storage
9205 ** associated with each page cache entry. ^The szExtra parameter will be
9206 ** a number less than 250. SQLite will use the
9207 ** extra szExtra bytes on each page to store metadata about the underlying
9208 ** database page on disk. The value passed into szExtra depends
9209 ** on the SQLite version, the target platform, and how SQLite was compiled.
9210 ** ^The third argument to xCreate(), bPurgeable, is true if the cache being
9211 ** created will be used to cache database pages of a file stored on disk, or
9212 ** false if it is used for an in-memory database. The cache implementation
9213 ** does not have to do anything special based upon the value of bPurgeable;
9214 ** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
9215 ** never invoke xUnpin() except to deliberately delete a page.
9216 ** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
9217 ** false will always have the "discard" flag set to true.
9218 ** ^Hence, a cache created with bPurgeable set to false will
9219 ** never contain any unpinned pages.
9220 **
9221 ** [[the xCachesize() page cache method]]
9222 ** ^(The xCachesize() method may be called at any time by SQLite to set the
9223 ** suggested maximum cache-size (number of pages stored) for the cache
9224 ** instance passed as the first argument. This is the value configured using
9225 ** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
9226 ** parameter, the implementation is not required to do anything with this
9227 ** value; it is advisory only.
9228 **
@@ -9245,16 +9245,16 @@
9245 **
9246 ** If the requested page is already in the page cache, then the page cache
9247 ** implementation must return a pointer to the page buffer with its content
9248 ** intact. If the requested page is not already in the cache, then the
9249 ** cache implementation should use the value of the createFlag
9250 ** parameter to help it determine what action to take:
9251 **
9252 ** <table border=1 width=85% align=center>
9253 ** <tr><th> createFlag <th> Behavior when page is not already in cache
9254 ** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
9255 ** <tr><td> 1 <td> Allocate a new page if it is easy and convenient to do so.
9256 ** Otherwise return NULL.
9257 ** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
9258 ** NULL if allocating a new page is effectively impossible.
9259 ** </table>
9260 **
@@ -9267,11 +9267,11 @@
9267 ** [[the xUnpin() page cache method]]
9268 ** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
9269 ** as its second argument. If the third parameter, discard, is non-zero,
9270 ** then the page must be evicted from the cache.
9271 ** ^If the discard parameter is
9272 ** zero, then the page may be discarded or retained at the discretion of the
9273 ** page cache implementation. ^The page cache implementation
9274 ** may choose to evict unpinned pages at any time.
9275 **
9276 ** The cache must not perform any reference counting. A single
9277 ** call to xUnpin() unpins the page regardless of the number of prior calls
@@ -9285,11 +9285,11 @@
9285 ** to be pinned.
9286 **
9287 ** When SQLite calls the xTruncate() method, the cache must discard all
9288 ** existing cache entries with page numbers (keys) greater than or equal
9289 ** to the value of the iLimit parameter passed to xTruncate(). If any
9290 ** of these pages are pinned, they become implicitly unpinned, meaning that
9291 ** they can be safely discarded.
9292 **
9293 ** [[the xDestroy() page cache method]]
9294 ** ^The xDestroy() method is used to delete a cache allocated by xCreate().
9295 ** All resources associated with the specified cache should be freed. ^After
@@ -9584,11 +9584,11 @@
9584 ** identity of the database connection (the blocking connection) that
9585 ** has locked the required resource is stored internally. ^After an
9586 ** application receives an SQLITE_LOCKED error, it may call the
9587 ** sqlite3_unlock_notify() method with the blocked connection handle as
9588 ** the first argument to register for a callback that will be invoked
9589 ** when the blocking connection's current transaction is concluded. ^The
9590 ** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
9591 ** call that concludes the blocking connection's transaction.
9592 **
9593 ** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
9594 ** there is a chance that the blocking connection will have already
@@ -9604,11 +9604,11 @@
9604 ** ^(There may be at most one unlock-notify callback registered by a
9605 ** blocked connection. If sqlite3_unlock_notify() is called when the
9606 ** blocked connection already has a registered unlock-notify callback,
9607 ** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
9608 ** called with a NULL pointer as its second argument, then any existing
9609 ** unlock-notify callback is canceled. ^The blocked connection's
9610 ** unlock-notify callback may also be canceled by closing the blocked
9611 ** connection using [sqlite3_close()].
9612 **
9613 ** The unlock-notify callback is not reentrant. If an application invokes
9614 ** any sqlite3_xxx API functions from within an unlock-notify callback, a
@@ -10002,11 +10002,11 @@
10002 ** where X is an integer. If X is zero, then the [virtual table] whose
10003 ** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
10004 ** support constraints. In this configuration (which is the default) if
10005 ** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
10006 ** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
10007 ** specified as part of the user's SQL statement, regardless of the actual
10008 ** ON CONFLICT mode specified.
10009 **
10010 ** If X is non-zero, then the virtual table implementation guarantees
10011 ** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
10012 ** any modifications to internal or persistent data structures have been made.
@@ -10036,11 +10036,11 @@
10036 ** </dd>
10037 **
10038 ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
10039 ** <dd>Calls of the form
10040 ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
10041 ** [xConnect] or [xCreate] methods of a [virtual table] implementation
10042 ** identify that virtual table as being safe to use from within triggers
10043 ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
10044 ** virtual table can do no serious harm even if it is controlled by a
10045 ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
10046 ** flag unless absolutely necessary.
@@ -10204,21 +10204,21 @@
10204 ** <tr><td>2<td>no<td>yes<td>yes
10205 ** <tr><td>3<td>yes<td>yes<td>yes
10206 ** </table>
10207 **
10208 ** ^For the purposes of comparing virtual table output values to see if the
10209 ** values are the same value for sorting purposes, two NULL values are considered
10210 ** to be the same. In other words, the comparison operator is "IS"
10211 ** (or "IS NOT DISTINCT FROM") and not "==".
10212 **
10213 ** If a virtual table implementation is unable to meet the requirements
10214 ** specified above, then it must not set the "orderByConsumed" flag in the
10215 ** [sqlite3_index_info] object or an incorrect answer may result.
10216 **
10217 ** ^A virtual table implementation is always free to return rows in any order
10218 ** it wants, as long as the "orderByConsumed" flag is not set. ^When the
10219 ** "orderByConsumed" flag is unset, the query planner will add extra
10220 ** [bytecode] to ensure that the final results returned by the SQL query are
10221 ** ordered correctly. The use of the "orderByConsumed" flag and the
10222 ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
10223 ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
10224 ** flag might help queries against a virtual table to run faster. Being
@@ -10311,11 +10311,11 @@
10311 **
10312 ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
10313 ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
10314 ** xFilter method which invokes these routines, and specifically
10315 ** a parameter that was previously selected for all-at-once IN constraint
10316 ** processing using the [sqlite3_vtab_in()] interface in the
10317 ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
10318 ** an xFilter argument that was selected for all-at-once IN constraint
10319 ** processing, then these routines return [SQLITE_ERROR].)^
10320 **
10321 ** ^(Use these routines to access all values on the right-hand side
@@ -10366,11 +10366,11 @@
10366 ** right-hand operand is not known, then *V is set to a NULL pointer.
10367 ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
10368 ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
10369 ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
10370 ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
10371 ** can return a result code other than SQLITE_OK or SQLITE_NOTFOUND if
10372 ** something goes wrong.
10373 **
10374 ** The sqlite3_vtab_rhs_value() interface is usually only successful if
10375 ** the right-hand operand of a constraint is a literal value in the original
10376 ** SQL statement. If the right-hand operand is an expression or a reference
@@ -10394,12 +10394,12 @@
10394 /*
10395 ** CAPI3REF: Conflict resolution modes
10396 ** KEYWORDS: {conflict resolution mode}
10397 **
10398 ** These constants are returned by [sqlite3_vtab_on_conflict()] to
10399 ** inform a [virtual table] implementation of the [ON CONFLICT] mode
10400 ** for the SQL statement being evaluated.
10401 **
10402 ** Note that the [SQLITE_IGNORE] constant is also used as a potential
10403 ** return value from the [sqlite3_set_authorizer()] callback and that
10404 ** [SQLITE_ABORT] is also a [result code].
10405 */
@@ -10435,43 +10435,43 @@
10435 ** to the total number of rows examined by all iterations of the X-th loop.</dd>
10436 **
10437 ** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
10438 ** <dd>^The "double" variable pointed to by the V parameter will be set to the
10439 ** query planner's estimate for the average number of rows output from each
10440 ** iteration of the X-th loop. If the query planner's estimate was accurate,
10441 ** then this value will approximate the quotient NVISIT/NLOOP and the
10442 ** product of this value for all prior loops with the same SELECTID will
10443 ** be the NLOOP value for the current loop.</dd>
10444 **
10445 ** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
10446 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10447 ** to a zero-terminated UTF-8 string containing the name of the index or table
10448 ** used for the X-th loop.</dd>
10449 **
10450 ** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
10451 ** <dd>^The "const char *" variable pointed to by the V parameter will be set
10452 ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
10453 ** description for the X-th loop.</dd>
10454 **
10455 ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
10456 ** <dd>^The "int" variable pointed to by the V parameter will be set to the
10457 ** id for the X-th query plan element. The id value is unique within the
10458 ** statement. The select-id is the same value as is output in the first
10459 ** column of an [EXPLAIN QUERY PLAN] query.</dd>
10460 **
10461 ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
10462 ** <dd>The "int" variable pointed to by the V parameter will be set to the
10463 ** id of the parent of the current query element, if applicable, or
10464 ** to zero if the query element has no parent. This is the same value as
10465 ** returned in the second column of an [EXPLAIN QUERY PLAN] query.</dd>
10466 **
10467 ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
10468 ** <dd>The sqlite3_int64 output value is set to the number of cycles,
10469 ** according to the processor time-stamp counter, that elapsed while the
10470 ** query element was being processed. This value is not available for
10471 ** all query elements - if it is unavailable the output variable is
10472 ** set to -1.</dd>
10473 ** </dl>
10474 */
10475 #define SQLITE_SCANSTAT_NLOOP 0
10476 #define SQLITE_SCANSTAT_NVISIT 1
10477 #define SQLITE_SCANSTAT_EST 2
@@ -10508,12 +10508,12 @@
10508 ** the EXPLAIN QUERY PLAN output) are available. Invoking API
10509 ** sqlite3_stmt_scanstatus() is equivalent to calling
10510 ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
10511 **
10512 ** Parameter "idx" identifies the specific query element to retrieve statistics
10513 ** for. Query elements are numbered starting from zero. A value of -1 may
10514 ** retrieve statistics for the entire query. ^If idx is out of range
10515 ** - less than -1 or greater than or equal to the total number of query
10516 ** elements used to implement the statement - a non-zero value is returned and
10517 ** the variable that pOut points to is unchanged.
10518 **
10519 ** See also: [sqlite3_stmt_scanstatus_reset()]
@@ -10666,12 +10666,12 @@
10666 ** operation; or 1 for inserts, updates, or deletes invoked by top-level
10667 ** triggers; or 2 for changes resulting from triggers called by top-level
10668 ** triggers; and so forth.
10669 **
10670 ** When the [sqlite3_blob_write()] API is used to update a blob column,
10671 ** the pre-update hook is invoked with SQLITE_DELETE, because
10672 ** the new values are not yet available. In this case, when a
10673 ** callback made with op==SQLITE_DELETE is actually a write using the
10674 ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10675 ** the index of the column being written. In other cases, where the
10676 ** pre-update hook is being invoked for some other reason, including a
10677 ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
@@ -10920,20 +10920,20 @@
10920 ** is written into *P.
10921 **
10922 ** For an ordinary on-disk database file, the serialization is just a
10923 ** copy of the disk file. For an in-memory database or a "TEMP" database,
10924 ** the serialization is the same sequence of bytes which would be written
10925 ** to disk if that database were backed up to disk.
10926 **
10927 ** The usual case is that sqlite3_serialize() copies the serialization of
10928 ** the database into memory obtained from [sqlite3_malloc64()] and returns
10929 ** a pointer to that memory. The caller is responsible for freeing the
10930 ** returned value to avoid a memory leak. However, if the F argument
10931 ** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
10932 ** are made, and the sqlite3_serialize() function will return a pointer
10933 ** to the contiguous memory representation of the database that SQLite
10934 ** is currently using for that database, or NULL if no such contiguous
10935 ** memory representation of the database exists. A contiguous memory
10936 ** representation of the database will usually only exist if there has
10937 ** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
10938 ** values of D and S.
10939 ** The size of the database is written into *P even if the
@@ -11000,11 +11000,11 @@
11000 **
11001 ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
11002 ** database is currently in a read transaction or is involved in a backup
11003 ** operation.
11004 **
11005 ** It is not possible to deserialize into the TEMP database. If the
11006 ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
11007 ** function returns SQLITE_ERROR.
11008 **
11009 ** The deserialized database should not be in [WAL mode]. If the database
11010 ** is in WAL mode, then any attempt to use the database file will result
@@ -11022,19 +11022,19 @@
11022 */
11023 SQLITE_API int sqlite3_deserialize(
11024 sqlite3 *db, /* The database connection */
11025 const char *zSchema, /* Which DB to reopen with the deserialization */
11026 unsigned char *pData, /* The serialized database content */
11027 sqlite3_int64 szDb, /* Number of bytes in the deserialization */
11028 sqlite3_int64 szBuf, /* Total size of buffer pData[] */
11029 unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
11030 );
11031
11032 /*
11033 ** CAPI3REF: Flags for sqlite3_deserialize()
11034 **
11035 ** The following are allowed values for the 6th argument (the F argument) to
11036 ** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
11037 **
11038 ** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
11039 ** in the P argument is held in memory obtained from [sqlite3_malloc64()]
11040 ** and that SQLite should take ownership of this memory and automatically
11041

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button