cordova-sqlite-evmax-build-free 0.0.2 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,30 @@ extern "C" {
43
43
 
44
44
 
45
45
  /*
46
- ** Provide the ability to override linkage features of the interface.
46
+ ** Facilitate override of interface linkage and calling conventions.
47
+ ** Be aware that these macros may not be used within this particular
48
+ ** translation of the amalgamation and its associated header file.
49
+ **
50
+ ** The SQLITE_EXTERN and SQLITE_API macros are used to instruct the
51
+ ** compiler that the target identifier should have external linkage.
52
+ **
53
+ ** The SQLITE_CDECL macro is used to set the calling convention for
54
+ ** public functions that accept a variable number of arguments.
55
+ **
56
+ ** The SQLITE_APICALL macro is used to set the calling convention for
57
+ ** public functions that accept a fixed number of arguments.
58
+ **
59
+ ** The SQLITE_STDCALL macro is no longer used and is now deprecated.
60
+ **
61
+ ** The SQLITE_CALLBACK macro is used to set the calling convention for
62
+ ** function pointers.
63
+ **
64
+ ** The SQLITE_SYSAPI macro is used to set the calling convention for
65
+ ** functions provided by the operating system.
66
+ **
67
+ ** Currently, the SQLITE_CDECL, SQLITE_APICALL, SQLITE_CALLBACK, and
68
+ ** SQLITE_SYSAPI macros are used only when building for environments
69
+ ** that require non-default calling conventions.
47
70
  */
48
71
  #ifndef SQLITE_EXTERN
49
72
  # define SQLITE_EXTERN extern
@@ -123,9 +146,9 @@ extern "C" {
123
146
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124
147
  ** [sqlite_version()] and [sqlite_source_id()].
125
148
  */
126
- #define SQLITE_VERSION "3.35.5"
127
- #define SQLITE_VERSION_NUMBER 3035005
128
- #define SQLITE_SOURCE_ID "2021-04-19 18:32:05 1b256d97b553a9611efca188a3d995a2fff712759044ba480f9a0c9e98fae886"
149
+ #define SQLITE_VERSION "3.38.5"
150
+ #define SQLITE_VERSION_NUMBER 3038005
151
+ #define SQLITE_SOURCE_ID "2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe"
129
152
 
130
153
  /*
131
154
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -537,12 +560,13 @@ SQLITE_API int sqlite3_exec(
537
560
  #define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8))
538
561
  #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8))
539
562
  #define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11<<8))
563
+ #define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8))
540
564
  #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
541
565
  #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
542
566
  #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
543
567
  #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
544
568
  #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
545
- #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8))
569
+ #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */
546
570
 
547
571
  /*
548
572
  ** CAPI3REF: Flags For File Open Operations
@@ -550,6 +574,19 @@ SQLITE_API int sqlite3_exec(
550
574
  ** These bit values are intended for use in the
551
575
  ** 3rd parameter to the [sqlite3_open_v2()] interface and
552
576
  ** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
577
+ **
578
+ ** Only those flags marked as "Ok for sqlite3_open_v2()" may be
579
+ ** used as the third argument to the [sqlite3_open_v2()] interface.
580
+ ** The other flags have historically been ignored by sqlite3_open_v2(),
581
+ ** though future versions of SQLite might change so that an error is
582
+ ** raised if any of the disallowed bits are passed into sqlite3_open_v2().
583
+ ** Applications should not depend on the historical behavior.
584
+ **
585
+ ** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into
586
+ ** [sqlite3_open_v2()] does *not* cause the underlying database file
587
+ ** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into
588
+ ** [sqlite3_open_v2()] has historically be a no-op and might become an
589
+ ** error in future versions of SQLite.
553
590
  */
554
591
  #define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
555
592
  #define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */
@@ -572,6 +609,7 @@ SQLITE_API int sqlite3_exec(
572
609
  #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
573
610
  #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
574
611
  #define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */
612
+ #define SQLITE_OPEN_EXRESCODE 0x02000000 /* Extended result codes */
575
613
 
576
614
  /* Reserved: 0x00F00000 */
577
615
  /* Legacy compatibility: */
@@ -1128,6 +1166,23 @@ struct sqlite3_io_methods {
1128
1166
  ** file to the database file, but before the *-shm file is updated to
1129
1167
  ** record the fact that the pages have been checkpointed.
1130
1168
  ** </ul>
1169
+ **
1170
+ ** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
1171
+ ** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
1172
+ ** whether or not there is a database client in another process with a wal-mode
1173
+ ** transaction open on the database or not. It is only available on unix.The
1174
+ ** (void*) argument passed with this file-control should be a pointer to a
1175
+ ** value of type (int). The integer value is set to 1 if the database is a wal
1176
+ ** mode database and there exists at least one client in another process that
1177
+ ** currently has an SQL transaction open on the database. It is set to 0 if
1178
+ ** the database is not a wal-mode db, or if there is no such connection in any
1179
+ ** other process. This opcode cannot be used to detect transactions opened
1180
+ ** by clients within the current process, only within other processes.
1181
+ ** </ul>
1182
+ **
1183
+ ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
1184
+ ** Used by the cksmvfs VFS module only.
1185
+ ** </ul>
1131
1186
  */
1132
1187
  #define SQLITE_FCNTL_LOCKSTATE 1
1133
1188
  #define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
@@ -1167,6 +1222,8 @@ struct sqlite3_io_methods {
1167
1222
  #define SQLITE_FCNTL_CKPT_DONE 37
1168
1223
  #define SQLITE_FCNTL_RESERVE_BYTES 38
1169
1224
  #define SQLITE_FCNTL_CKPT_START 39
1225
+ #define SQLITE_FCNTL_EXTERNAL_READER 40
1226
+ #define SQLITE_FCNTL_CKSM_FILE 41
1170
1227
 
1171
1228
  /* deprecated names */
1172
1229
  #define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -2445,11 +2502,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
2445
2502
  ** CAPI3REF: Count The Number Of Rows Modified
2446
2503
  ** METHOD: sqlite3
2447
2504
  **
2448
- ** ^This function returns the number of rows modified, inserted or
2505
+ ** ^These functions return the number of rows modified, inserted or
2449
2506
  ** deleted by the most recently completed INSERT, UPDATE or DELETE
2450
2507
  ** statement on the database connection specified by the only parameter.
2451
- ** ^Executing any other type of SQL statement does not modify the value
2452
- ** returned by this function.
2508
+ ** The two functions are identical except for the type of the return value
2509
+ ** and that if the number of rows modified by the most recent INSERT, UPDATE
2510
+ ** or DELETE is greater than the maximum value supported by type "int", then
2511
+ ** the return value of sqlite3_changes() is undefined. ^Executing any other
2512
+ ** type of SQL statement does not modify the value returned by these functions.
2453
2513
  **
2454
2514
  ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
2455
2515
  ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
@@ -2498,16 +2558,21 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
2498
2558
  ** </ul>
2499
2559
  */
2500
2560
  SQLITE_API int sqlite3_changes(sqlite3*);
2561
+ SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3*);
2501
2562
 
2502
2563
  /*
2503
2564
  ** CAPI3REF: Total Number Of Rows Modified
2504
2565
  ** METHOD: sqlite3
2505
2566
  **
2506
- ** ^This function returns the total number of rows inserted, modified or
2567
+ ** ^These functions return the total number of rows inserted, modified or
2507
2568
  ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
2508
2569
  ** since the database connection was opened, including those executed as
2509
- ** part of trigger programs. ^Executing any other type of SQL statement
2510
- ** does not affect the value returned by sqlite3_total_changes().
2570
+ ** part of trigger programs. The two functions are identical except for the
2571
+ ** type of the return value and that if the number of rows modified by the
2572
+ ** connection exceeds the maximum value supported by type "int", then
2573
+ ** the return value of sqlite3_total_changes() is undefined. ^Executing
2574
+ ** any other type of SQL statement does not affect the value returned by
2575
+ ** sqlite3_total_changes().
2511
2576
  **
2512
2577
  ** ^Changes made as part of [foreign key actions] are included in the
2513
2578
  ** count, but those made as part of REPLACE constraint resolution are
@@ -2535,6 +2600,7 @@ SQLITE_API int sqlite3_changes(sqlite3*);
2535
2600
  ** </ul>
2536
2601
  */
2537
2602
  SQLITE_API int sqlite3_total_changes(sqlite3*);
2603
+ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
2538
2604
 
2539
2605
  /*
2540
2606
  ** CAPI3REF: Interrupt A Long-Running Query
@@ -3364,6 +3430,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3364
3430
  ** the default shared cache setting provided by
3365
3431
  ** [sqlite3_enable_shared_cache()].)^
3366
3432
  **
3433
+ ** [[OPEN_EXRESCODE]] ^(<dt>[SQLITE_OPEN_EXRESCODE]</dt>
3434
+ ** <dd>The database connection comes up in "extended result code mode".
3435
+ ** In other words, the database behaves has if
3436
+ ** [sqlite3_extended_result_codes(db,1)] where called on the database
3437
+ ** connection as soon as the connection is created. In addition to setting
3438
+ ** the extended result code mode, this flag also causes [sqlite3_open_v2()]
3439
+ ** to return an extended result code.</dd>
3440
+ **
3367
3441
  ** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt>
3368
3442
  ** <dd>The database filename is not allowed to be a symbolic link</dd>
3369
3443
  ** </dl>)^
@@ -3371,7 +3445,15 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3371
3445
  ** If the 3rd parameter to sqlite3_open_v2() is not one of the
3372
3446
  ** required combinations shown above optionally combined with other
3373
3447
  ** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
3374
- ** then the behavior is undefined.
3448
+ ** then the behavior is undefined. Historic versions of SQLite
3449
+ ** have silently ignored surplus bits in the flags parameter to
3450
+ ** sqlite3_open_v2(), however that behavior might not be carried through
3451
+ ** into future versions of SQLite and so applications should not rely
3452
+ ** upon it. Note in particular that the SQLITE_OPEN_EXCLUSIVE flag is a no-op
3453
+ ** for sqlite3_open_v2(). The SQLITE_OPEN_EXCLUSIVE does *not* cause
3454
+ ** the open to fail if the database already exists. The SQLITE_OPEN_EXCLUSIVE
3455
+ ** flag is intended for use by the [sqlite3_vfs|VFS interface] only, and not
3456
+ ** by sqlite3_open_v2().
3375
3457
  **
3376
3458
  ** ^The fourth parameter to sqlite3_open_v2() is the name of the
3377
3459
  ** [sqlite3_vfs] object that defines the operating system interface that
@@ -3742,13 +3824,14 @@ SQLITE_API void sqlite3_free_filename(char*);
3742
3824
  ** sqlite3_extended_errcode() might change with each API call.
3743
3825
  ** Except, there are some interfaces that are guaranteed to never
3744
3826
  ** change the value of the error code. The error-code preserving
3745
- ** interfaces are:
3827
+ ** interfaces include the following:
3746
3828
  **
3747
3829
  ** <ul>
3748
3830
  ** <li> sqlite3_errcode()
3749
3831
  ** <li> sqlite3_extended_errcode()
3750
3832
  ** <li> sqlite3_errmsg()
3751
3833
  ** <li> sqlite3_errmsg16()
3834
+ ** <li> sqlite3_error_offset()
3752
3835
  ** </ul>
3753
3836
  **
3754
3837
  ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
@@ -3763,6 +3846,13 @@ SQLITE_API void sqlite3_free_filename(char*);
3763
3846
  ** ^(Memory to hold the error message string is managed internally
3764
3847
  ** and must not be freed by the application)^.
3765
3848
  **
3849
+ ** ^If the most recent error references a specific token in the input
3850
+ ** SQL, the sqlite3_error_offset() interface returns the byte offset
3851
+ ** of the start of that token. ^The byte offset returned by
3852
+ ** sqlite3_error_offset() assumes that the input SQL is UTF8.
3853
+ ** ^If the most recent error does not reference a specific token in the input
3854
+ ** SQL, then the sqlite3_error_offset() function returns -1.
3855
+ **
3766
3856
  ** When the serialized [threading mode] is in use, it might be the
3767
3857
  ** case that a second error occurs on a separate thread in between
3768
3858
  ** the time of the first error and the call to these interfaces.
@@ -3782,6 +3872,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3782
3872
  SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3783
3873
  SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3784
3874
  SQLITE_API const char *sqlite3_errstr(int);
3875
+ SQLITE_API int sqlite3_error_offset(sqlite3 *db);
3785
3876
 
3786
3877
  /*
3787
3878
  ** CAPI3REF: Prepared Statement Object
@@ -4139,12 +4230,17 @@ SQLITE_API int sqlite3_prepare16_v3(
4139
4230
  ** are managed by SQLite and are automatically freed when the prepared
4140
4231
  ** statement is finalized.
4141
4232
  ** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
4142
- ** is obtained from [sqlite3_malloc()] and must be free by the application
4233
+ ** is obtained from [sqlite3_malloc()] and must be freed by the application
4143
4234
  ** by passing it to [sqlite3_free()].
4235
+ **
4236
+ ** ^The sqlite3_normalized_sql() interface is only available if
4237
+ ** the [SQLITE_ENABLE_NORMALIZE] compile-time option is defined.
4144
4238
  */
4145
4239
  SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
4146
4240
  SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
4241
+ #ifdef SQLITE_ENABLE_NORMALIZE
4147
4242
  SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
4243
+ #endif
4148
4244
 
4149
4245
  /*
4150
4246
  ** CAPI3REF: Determine If An SQL Statement Writes The Database
@@ -4179,6 +4275,19 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
4179
4275
  ** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
4180
4276
  ** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
4181
4277
  ** sqlite3_stmt_readonly() returns false for those commands.
4278
+ **
4279
+ ** ^This routine returns false if there is any possibility that the
4280
+ ** statement might change the database file. ^A false return does
4281
+ ** not guarantee that the statement will change the database file.
4282
+ ** ^For example, an UPDATE statement might have a WHERE clause that
4283
+ ** makes it a no-op, but the sqlite3_stmt_readonly() result would still
4284
+ ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a
4285
+ ** read-only no-op if the table already exists, but
4286
+ ** sqlite3_stmt_readonly() still returns false for such a statement.
4287
+ **
4288
+ ** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN]
4289
+ ** statement, then sqlite3_stmt_readonly(X) returns the same value as
4290
+ ** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted.
4182
4291
  */
4183
4292
  SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
4184
4293
 
@@ -4247,6 +4356,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
4247
4356
  **
4248
4357
  ** ^The sqlite3_value objects that are passed as parameters into the
4249
4358
  ** implementation of [application-defined SQL functions] are protected.
4359
+ ** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()]
4360
+ ** are protected.
4250
4361
  ** ^The sqlite3_value object returned by
4251
4362
  ** [sqlite3_column_value()] is unprotected.
4252
4363
  ** Unprotected sqlite3_value objects may only be used as arguments
@@ -4348,18 +4459,22 @@ typedef struct sqlite3_context sqlite3_context;
4348
4459
  ** contain embedded NULs. The result of expressions involving strings
4349
4460
  ** with embedded NULs is undefined.
4350
4461
  **
4351
- ** ^The fifth argument to the BLOB and string binding interfaces
4352
- ** is a destructor used to dispose of the BLOB or
4353
- ** string after SQLite has finished with it. ^The destructor is called
4354
- ** to dispose of the BLOB or string even if the call to the bind API fails,
4355
- ** except the destructor is not called if the third parameter is a NULL
4356
- ** pointer or the fourth parameter is negative.
4357
- ** ^If the fifth argument is
4358
- ** the special value [SQLITE_STATIC], then SQLite assumes that the
4359
- ** information is in static, unmanaged space and does not need to be freed.
4360
- ** ^If the fifth argument has the value [SQLITE_TRANSIENT], then
4361
- ** SQLite makes its own private copy of the data immediately, before
4362
- ** the sqlite3_bind_*() routine returns.
4462
+ ** ^The fifth argument to the BLOB and string binding interfaces controls
4463
+ ** or indicates the lifetime of the object referenced by the third parameter.
4464
+ ** These three options exist:
4465
+ ** ^ (1) A destructor to dispose of the BLOB or string after SQLite has finished
4466
+ ** with it may be passed. ^It is called to dispose of the BLOB or string even
4467
+ ** if the call to the bind API fails, except the destructor is not called if
4468
+ ** the third parameter is a NULL pointer or the fourth parameter is negative.
4469
+ ** ^ (2) The special constant, [SQLITE_STATIC], may be passsed to indicate that
4470
+ ** the application remains responsible for disposing of the object. ^In this
4471
+ ** case, the object and the provided pointer to it must remain valid until
4472
+ ** either the prepared statement is finalized or the same SQL parameter is
4473
+ ** bound to something else, whichever occurs sooner.
4474
+ ** ^ (3) The constant, [SQLITE_TRANSIENT], may be passed to indicate that the
4475
+ ** object is to be copied prior to the return from sqlite3_bind_*(). ^The
4476
+ ** object and pointer to it must remain valid until then. ^SQLite will then
4477
+ ** manage the lifetime of its private copy.
4363
4478
  **
4364
4479
  ** ^The sixth argument to sqlite3_bind_text64() must be one of
4365
4480
  ** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
@@ -4864,6 +4979,10 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
4864
4979
  ** even empty strings, are always zero-terminated. ^The return
4865
4980
  ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
4866
4981
  **
4982
+ ** ^Strings returned by sqlite3_column_text16() always have the endianness
4983
+ ** which is native to the platform, regardless of the text encoding set
4984
+ ** for the database.
4985
+ **
4867
4986
  ** <b>Warning:</b> ^The object returned by [sqlite3_column_value()] is an
4868
4987
  ** [unprotected sqlite3_value] object. In a multithreaded environment,
4869
4988
  ** an unprotected sqlite3_value object may only be used safely with
@@ -4877,7 +4996,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
4877
4996
  ** [application-defined SQL functions] or [virtual tables], not within
4878
4997
  ** top-level application code.
4879
4998
  **
4880
- ** The these routines may attempt to convert the datatype of the result.
4999
+ ** These routines may attempt to convert the datatype of the result.
4881
5000
  ** ^For example, if the internal representation is FLOAT and a text result
4882
5001
  ** is requested, [sqlite3_snprintf()] is used internally to perform the
4883
5002
  ** conversion automatically. ^(The following table details the conversions
@@ -4902,7 +5021,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
4902
5021
  ** <tr><td> TEXT <td> BLOB <td> No change
4903
5022
  ** <tr><td> BLOB <td> INTEGER <td> [CAST] to INTEGER
4904
5023
  ** <tr><td> BLOB <td> FLOAT <td> [CAST] to REAL
4905
- ** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed
5024
+ ** <tr><td> BLOB <td> TEXT <td> [CAST] to TEXT, ensure zero terminator
4906
5025
  ** </table>
4907
5026
  ** </blockquote>)^
4908
5027
  **
@@ -5101,7 +5220,6 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5101
5220
  ** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
5102
5221
  ** index expressions, or the WHERE clause of partial indexes.
5103
5222
  **
5104
- ** <span style="background-color:#ffff90;">
5105
5223
  ** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
5106
5224
  ** all application-defined SQL functions that do not need to be
5107
5225
  ** used inside of triggers, view, CHECK constraints, or other elements of
@@ -5111,7 +5229,6 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5111
5229
  ** a database file to include invocations of the function with parameters
5112
5230
  ** chosen by the attacker, which the application will then execute when
5113
5231
  ** the database file is opened and read.
5114
- ** </span>
5115
5232
  **
5116
5233
  ** ^(The fifth parameter is an arbitrary pointer. The implementation of the
5117
5234
  ** function can gain access to this pointer using [sqlite3_user_data()].)^
@@ -6317,6 +6434,72 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
6317
6434
  SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
6318
6435
  SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
6319
6436
 
6437
+ /*
6438
+ ** CAPI3REF: Autovacuum Compaction Amount Callback
6439
+ ** METHOD: sqlite3
6440
+ **
6441
+ ** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback
6442
+ ** function C that is invoked prior to each autovacuum of the database
6443
+ ** file. ^The callback is passed a copy of the generic data pointer (P),
6444
+ ** the schema-name of the attached database that is being autovacuumed,
6445
+ ** the the size of the database file in pages, the number of free pages,
6446
+ ** and the number of bytes per page, respectively. The callback should
6447
+ ** return the number of free pages that should be removed by the
6448
+ ** autovacuum. ^If the callback returns zero, then no autovacuum happens.
6449
+ ** ^If the value returned is greater than or equal to the number of
6450
+ ** free pages, then a complete autovacuum happens.
6451
+ **
6452
+ ** <p>^If there are multiple ATTACH-ed database files that are being
6453
+ ** modified as part of a transaction commit, then the autovacuum pages
6454
+ ** callback is invoked separately for each file.
6455
+ **
6456
+ ** <p><b>The callback is not reentrant.</b> The callback function should
6457
+ ** not attempt to invoke any other SQLite interface. If it does, bad
6458
+ ** things may happen, including segmentation faults and corrupt database
6459
+ ** files. The callback function should be a simple function that
6460
+ ** does some arithmetic on its input parameters and returns a result.
6461
+ **
6462
+ ** ^The X parameter to sqlite3_autovacuum_pages(D,C,P,X) is an optional
6463
+ ** destructor for the P parameter. ^If X is not NULL, then X(P) is
6464
+ ** invoked whenever the database connection closes or when the callback
6465
+ ** is overwritten by another invocation of sqlite3_autovacuum_pages().
6466
+ **
6467
+ ** <p>^There is only one autovacuum pages callback per database connection.
6468
+ ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all
6469
+ ** previous invocations for that database connection. ^If the callback
6470
+ ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer,
6471
+ ** then the autovacuum steps callback is cancelled. The return value
6472
+ ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
6473
+ ** be some other error code if something goes wrong. The current
6474
+ ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other
6475
+ ** return codes might be added in future releases.
6476
+ **
6477
+ ** <p>If no autovacuum pages callback is specified (the usual case) or
6478
+ ** a NULL pointer is provided for the callback,
6479
+ ** then the default behavior is to vacuum all free pages. So, in other
6480
+ ** words, the default behavior is the same as if the callback function
6481
+ ** were something like this:
6482
+ **
6483
+ ** <blockquote><pre>
6484
+ ** &nbsp; unsigned int demonstration_autovac_pages_callback(
6485
+ ** &nbsp; void *pClientData,
6486
+ ** &nbsp; const char *zSchema,
6487
+ ** &nbsp; unsigned int nDbPage,
6488
+ ** &nbsp; unsigned int nFreePage,
6489
+ ** &nbsp; unsigned int nBytePerPage
6490
+ ** &nbsp; ){
6491
+ ** &nbsp; return nFreePage;
6492
+ ** &nbsp; }
6493
+ ** </pre></blockquote>
6494
+ */
6495
+ SQLITE_API int sqlite3_autovacuum_pages(
6496
+ sqlite3 *db,
6497
+ unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
6498
+ void*,
6499
+ void(*)(void*)
6500
+ );
6501
+
6502
+
6320
6503
  /*
6321
6504
  ** CAPI3REF: Data Change Notification Callbacks
6322
6505
  ** METHOD: sqlite3
@@ -6958,24 +7141,56 @@ struct sqlite3_index_info {
6958
7141
  **
6959
7142
  ** These macros define the allowed values for the
6960
7143
  ** [sqlite3_index_info].aConstraint[].op field. Each value represents
6961
- ** an operator that is part of a constraint term in the wHERE clause of
7144
+ ** an operator that is part of a constraint term in the WHERE clause of
6962
7145
  ** a query that uses a [virtual table].
6963
- */
6964
- #define SQLITE_INDEX_CONSTRAINT_EQ 2
6965
- #define SQLITE_INDEX_CONSTRAINT_GT 4
6966
- #define SQLITE_INDEX_CONSTRAINT_LE 8
6967
- #define SQLITE_INDEX_CONSTRAINT_LT 16
6968
- #define SQLITE_INDEX_CONSTRAINT_GE 32
6969
- #define SQLITE_INDEX_CONSTRAINT_MATCH 64
6970
- #define SQLITE_INDEX_CONSTRAINT_LIKE 65
6971
- #define SQLITE_INDEX_CONSTRAINT_GLOB 66
6972
- #define SQLITE_INDEX_CONSTRAINT_REGEXP 67
6973
- #define SQLITE_INDEX_CONSTRAINT_NE 68
6974
- #define SQLITE_INDEX_CONSTRAINT_ISNOT 69
6975
- #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
6976
- #define SQLITE_INDEX_CONSTRAINT_ISNULL 71
6977
- #define SQLITE_INDEX_CONSTRAINT_IS 72
6978
- #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
7146
+ **
7147
+ ** ^The left-hand operand of the operator is given by the corresponding
7148
+ ** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand
7149
+ ** operand is the rowid.
7150
+ ** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET
7151
+ ** operators have no left-hand operand, and so for those operators the
7152
+ ** corresponding aConstraint[].iColumn is meaningless and should not be
7153
+ ** used.
7154
+ **
7155
+ ** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through
7156
+ ** value 255 are reserved to represent functions that are overloaded
7157
+ ** by the [xFindFunction|xFindFunction method] of the virtual table
7158
+ ** implementation.
7159
+ **
7160
+ ** The right-hand operands for each constraint might be accessible using
7161
+ ** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand
7162
+ ** operand is only available if it appears as a single constant literal
7163
+ ** in the input SQL. If the right-hand operand is another column or an
7164
+ ** expression (even a constant expression) or a parameter, then the
7165
+ ** sqlite3_vtab_rhs_value() probably will not be able to extract it.
7166
+ ** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and
7167
+ ** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand
7168
+ ** and hence calls to sqlite3_vtab_rhs_value() for those operators will
7169
+ ** always return SQLITE_NOTFOUND.
7170
+ **
7171
+ ** The collating sequence to be used for comparison can be found using
7172
+ ** the [sqlite3_vtab_collation()] interface. For most real-world virtual
7173
+ ** tables, the collating sequence of constraints does not matter (for example
7174
+ ** because the constraints are numeric) and so the sqlite3_vtab_collation()
7175
+ ** interface is no commonly needed.
7176
+ */
7177
+ #define SQLITE_INDEX_CONSTRAINT_EQ 2
7178
+ #define SQLITE_INDEX_CONSTRAINT_GT 4
7179
+ #define SQLITE_INDEX_CONSTRAINT_LE 8
7180
+ #define SQLITE_INDEX_CONSTRAINT_LT 16
7181
+ #define SQLITE_INDEX_CONSTRAINT_GE 32
7182
+ #define SQLITE_INDEX_CONSTRAINT_MATCH 64
7183
+ #define SQLITE_INDEX_CONSTRAINT_LIKE 65
7184
+ #define SQLITE_INDEX_CONSTRAINT_GLOB 66
7185
+ #define SQLITE_INDEX_CONSTRAINT_REGEXP 67
7186
+ #define SQLITE_INDEX_CONSTRAINT_NE 68
7187
+ #define SQLITE_INDEX_CONSTRAINT_ISNOT 69
7188
+ #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
7189
+ #define SQLITE_INDEX_CONSTRAINT_ISNULL 71
7190
+ #define SQLITE_INDEX_CONSTRAINT_IS 72
7191
+ #define SQLITE_INDEX_CONSTRAINT_LIMIT 73
7192
+ #define SQLITE_INDEX_CONSTRAINT_OFFSET 74
7193
+ #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
6979
7194
 
6980
7195
  /*
6981
7196
  ** CAPI3REF: Register A Virtual Table Implementation
@@ -7004,7 +7219,7 @@ struct sqlite3_index_info {
7004
7219
  ** destructor.
7005
7220
  **
7006
7221
  ** ^If the third parameter (the pointer to the sqlite3_module object) is
7007
- ** NULL then no new module is create and any existing modules with the
7222
+ ** NULL then no new module is created and any existing modules with the
7008
7223
  ** same name are dropped.
7009
7224
  **
7010
7225
  ** See also: [sqlite3_drop_modules()]
@@ -7779,7 +7994,9 @@ SQLITE_API int sqlite3_test_control(int op, ...);
7779
7994
  #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
7780
7995
  #define SQLITE_TESTCTRL_SEEK_COUNT 30
7781
7996
  #define SQLITE_TESTCTRL_TRACEFLAGS 31
7782
- #define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */
7997
+ #define SQLITE_TESTCTRL_TUNE 32
7998
+ #define SQLITE_TESTCTRL_LOGEST 33
7999
+ #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
7783
8000
 
7784
8001
  /*
7785
8002
  ** CAPI3REF: SQL Keyword Checking
@@ -8302,6 +8519,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
8302
8519
  ** The counter is incremented on the first [sqlite3_step()] call of each
8303
8520
  ** cycle.
8304
8521
  **
8522
+ ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
8523
+ ** [[SQLITE_STMTSTATUS_FILTER HIT]]
8524
+ ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
8525
+ ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
8526
+ ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
8527
+ ** step was bypassed because a Bloom filter returned not-found. The
8528
+ ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
8529
+ ** times that the Bloom filter returned a find, and thus the join step
8530
+ ** had to be processed as normal.
8531
+ **
8305
8532
  ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
8306
8533
  ** <dd>^This is the approximate number of bytes of heap memory
8307
8534
  ** used to store the prepared statement. ^This value is not actually
@@ -8316,6 +8543,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
8316
8543
  #define SQLITE_STMTSTATUS_VM_STEP 4
8317
8544
  #define SQLITE_STMTSTATUS_REPREPARE 5
8318
8545
  #define SQLITE_STMTSTATUS_RUN 6
8546
+ #define SQLITE_STMTSTATUS_FILTER_MISS 7
8547
+ #define SQLITE_STMTSTATUS_FILTER_HIT 8
8319
8548
  #define SQLITE_STMTSTATUS_MEMUSED 99
8320
8549
 
8321
8550
  /*
@@ -8979,8 +9208,9 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
8979
9208
  **
8980
9209
  ** A single database handle may have at most a single write-ahead log callback
8981
9210
  ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
8982
- ** previously registered write-ahead log callback. ^Note that the
8983
- ** [sqlite3_wal_autocheckpoint()] interface and the
9211
+ ** previously registered write-ahead log callback. ^The return value is
9212
+ ** a copy of the third parameter from the previous call, if any, or 0.
9213
+ ** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the
8984
9214
  ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
8985
9215
  ** overwrite any prior [sqlite3_wal_hook()] settings.
8986
9216
  */
@@ -9283,19 +9513,269 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
9283
9513
 
9284
9514
  /*
9285
9515
  ** CAPI3REF: Determine The Collation For a Virtual Table Constraint
9516
+ ** METHOD: sqlite3_index_info
9286
9517
  **
9287
9518
  ** This function may only be called from within a call to the [xBestIndex]
9288
- ** method of a [virtual table].
9519
+ ** method of a [virtual table]. This function returns a pointer to a string
9520
+ ** that is the name of the appropriate collation sequence to use for text
9521
+ ** comparisons on the constraint identified by its arguments.
9522
+ **
9523
+ ** The first argument must be the pointer to the [sqlite3_index_info] object
9524
+ ** that is the first parameter to the xBestIndex() method. The second argument
9525
+ ** must be an index into the aConstraint[] array belonging to the
9526
+ ** sqlite3_index_info structure passed to xBestIndex.
9527
+ **
9528
+ ** Important:
9529
+ ** The first parameter must be the same pointer that is passed into the
9530
+ ** xBestMethod() method. The first parameter may not be a pointer to a
9531
+ ** different [sqlite3_index_info] object, even an exact copy.
9289
9532
  **
9290
- ** The first argument must be the sqlite3_index_info object that is the
9291
- ** first parameter to the xBestIndex() method. The second argument must be
9292
- ** an index into the aConstraint[] array belonging to the sqlite3_index_info
9293
- ** structure passed to xBestIndex. This function returns a pointer to a buffer
9294
- ** containing the name of the collation sequence for the corresponding
9295
- ** constraint.
9533
+ ** The return value is computed as follows:
9534
+ **
9535
+ ** <ol>
9536
+ ** <li><p> If the constraint comes from a WHERE clause expression that contains
9537
+ ** a [COLLATE operator], then the name of the collation specified by
9538
+ ** that COLLATE operator is returned.
9539
+ ** <li><p> If there is no COLLATE operator, but the column that is the subject
9540
+ ** of the constraint specifies an alternative collating sequence via
9541
+ ** a [COLLATE clause] on the column definition within the CREATE TABLE
9542
+ ** statement that was passed into [sqlite3_declare_vtab()], then the
9543
+ ** name of that alternative collating sequence is returned.
9544
+ ** <li><p> Otherwise, "BINARY" is returned.
9545
+ ** </ol>
9296
9546
  */
9297
9547
  SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9298
9548
 
9549
+ /*
9550
+ ** CAPI3REF: Determine if a virtual table query is DISTINCT
9551
+ ** METHOD: sqlite3_index_info
9552
+ **
9553
+ ** This API may only be used from within an [xBestIndex|xBestIndex method]
9554
+ ** of a [virtual table] implementation. The result of calling this
9555
+ ** interface from outside of xBestIndex() is undefined and probably harmful.
9556
+ **
9557
+ ** ^The sqlite3_vtab_distinct() interface returns an integer that is
9558
+ ** either 0, 1, or 2. The integer returned by sqlite3_vtab_distinct()
9559
+ ** gives the virtual table additional information about how the query
9560
+ ** planner wants the output to be ordered. As long as the virtual table
9561
+ ** can meet the ordering requirements of the query planner, it may set
9562
+ ** the "orderByConsumed" flag.
9563
+ **
9564
+ ** <ol><li value="0"><p>
9565
+ ** ^If the sqlite3_vtab_distinct() interface returns 0, that means
9566
+ ** that the query planner needs the virtual table to return all rows in the
9567
+ ** sort order defined by the "nOrderBy" and "aOrderBy" fields of the
9568
+ ** [sqlite3_index_info] object. This is the default expectation. If the
9569
+ ** virtual table outputs all rows in sorted order, then it is always safe for
9570
+ ** the xBestIndex method to set the "orderByConsumed" flag, regardless of
9571
+ ** the return value from sqlite3_vtab_distinct().
9572
+ ** <li value="1"><p>
9573
+ ** ^(If the sqlite3_vtab_distinct() interface returns 1, that means
9574
+ ** that the query planner does not need the rows to be returned in sorted order
9575
+ ** as long as all rows with the same values in all columns identified by the
9576
+ ** "aOrderBy" field are adjacent.)^ This mode is used when the query planner
9577
+ ** is doing a GROUP BY.
9578
+ ** <li value="2"><p>
9579
+ ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
9580
+ ** that the query planner does not need the rows returned in any particular
9581
+ ** order, as long as rows with the same values in all "aOrderBy" columns
9582
+ ** are adjacent.)^ ^(Furthermore, only a single row for each particular
9583
+ ** combination of values in the columns identified by the "aOrderBy" field
9584
+ ** needs to be returned.)^ ^It is always ok for two or more rows with the same
9585
+ ** values in all "aOrderBy" columns to be returned, as long as all such rows
9586
+ ** are adjacent. ^The virtual table may, if it chooses, omit extra rows
9587
+ ** that have the same value for all columns identified by "aOrderBy".
9588
+ ** ^However omitting the extra rows is optional.
9589
+ ** This mode is used for a DISTINCT query.
9590
+ ** </ol>
9591
+ **
9592
+ ** ^For the purposes of comparing virtual table output values to see if the
9593
+ ** values are same value for sorting purposes, two NULL values are considered
9594
+ ** to be the same. In other words, the comparison operator is "IS"
9595
+ ** (or "IS NOT DISTINCT FROM") and not "==".
9596
+ **
9597
+ ** If a virtual table implementation is unable to meet the requirements
9598
+ ** specified above, then it must not set the "orderByConsumed" flag in the
9599
+ ** [sqlite3_index_info] object or an incorrect answer may result.
9600
+ **
9601
+ ** ^A virtual table implementation is always free to return rows in any order
9602
+ ** it wants, as long as the "orderByConsumed" flag is not set. ^When the
9603
+ ** the "orderByConsumed" flag is unset, the query planner will add extra
9604
+ ** [bytecode] to ensure that the final results returned by the SQL query are
9605
+ ** ordered correctly. The use of the "orderByConsumed" flag and the
9606
+ ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
9607
+ ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
9608
+ ** flag might help queries against a virtual table to run faster. Being
9609
+ ** overly aggressive and setting the "orderByConsumed" flag when it is not
9610
+ ** valid to do so, on the other hand, might cause SQLite to return incorrect
9611
+ ** results.
9612
+ */
9613
+ SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*);
9614
+
9615
+ /*
9616
+ ** CAPI3REF: Identify and handle IN constraints in xBestIndex
9617
+ **
9618
+ ** This interface may only be used from within an
9619
+ ** [xBestIndex|xBestIndex() method] of a [virtual table] implementation.
9620
+ ** The result of invoking this interface from any other context is
9621
+ ** undefined and probably harmful.
9622
+ **
9623
+ ** ^(A constraint on a virtual table of the form
9624
+ ** "[IN operator|column IN (...)]" is
9625
+ ** communicated to the xBestIndex method as a
9626
+ ** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
9627
+ ** this constraint, it must set the corresponding
9628
+ ** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under
9629
+ ** the usual mode of handling IN operators, SQLite generates [bytecode]
9630
+ ** that invokes the [xFilter|xFilter() method] once for each value
9631
+ ** on the right-hand side of the IN operator.)^ Thus the virtual table
9632
+ ** only sees a single value from the right-hand side of the IN operator
9633
+ ** at a time.
9634
+ **
9635
+ ** In some cases, however, it would be advantageous for the virtual
9636
+ ** table to see all values on the right-hand of the IN operator all at
9637
+ ** once. The sqlite3_vtab_in() interfaces facilitates this in two ways:
9638
+ **
9639
+ ** <ol>
9640
+ ** <li><p>
9641
+ ** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero)
9642
+ ** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint
9643
+ ** is an [IN operator] that can be processed all at once. ^In other words,
9644
+ ** sqlite3_vtab_in() with -1 in the third argument is a mechanism
9645
+ ** by which the virtual table can ask SQLite if all-at-once processing
9646
+ ** of the IN operator is even possible.
9647
+ **
9648
+ ** <li><p>
9649
+ ** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates
9650
+ ** to SQLite that the virtual table does or does not want to process
9651
+ ** the IN operator all-at-once, respectively. ^Thus when the third
9652
+ ** parameter (F) is non-negative, this interface is the mechanism by
9653
+ ** which the virtual table tells SQLite how it wants to process the
9654
+ ** IN operator.
9655
+ ** </ol>
9656
+ **
9657
+ ** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times
9658
+ ** within the same xBestIndex method call. ^For any given P,N pair,
9659
+ ** the return value from sqlite3_vtab_in(P,N,F) will always be the same
9660
+ ** within the same xBestIndex call. ^If the interface returns true
9661
+ ** (non-zero), that means that the constraint is an IN operator
9662
+ ** that can be processed all-at-once. ^If the constraint is not an IN
9663
+ ** operator or cannot be processed all-at-once, then the interface returns
9664
+ ** false.
9665
+ **
9666
+ ** ^(All-at-once processing of the IN operator is selected if both of the
9667
+ ** following conditions are met:
9668
+ **
9669
+ ** <ol>
9670
+ ** <li><p> The P->aConstraintUsage[N].argvIndex value is set to a positive
9671
+ ** integer. This is how the virtual table tells SQLite that it wants to
9672
+ ** use the N-th constraint.
9673
+ **
9674
+ ** <li><p> The last call to sqlite3_vtab_in(P,N,F) for which F was
9675
+ ** non-negative had F>=1.
9676
+ ** </ol>)^
9677
+ **
9678
+ ** ^If either or both of the conditions above are false, then SQLite uses
9679
+ ** the traditional one-at-a-time processing strategy for the IN constraint.
9680
+ ** ^If both conditions are true, then the argvIndex-th parameter to the
9681
+ ** xFilter method will be an [sqlite3_value] that appears to be NULL,
9682
+ ** but which can be passed to [sqlite3_vtab_in_first()] and
9683
+ ** [sqlite3_vtab_in_next()] to find all values on the right-hand side
9684
+ ** of the IN constraint.
9685
+ */
9686
+ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
9687
+
9688
+ /*
9689
+ ** CAPI3REF: Find all elements on the right-hand side of an IN constraint.
9690
+ **
9691
+ ** These interfaces are only useful from within the
9692
+ ** [xFilter|xFilter() method] of a [virtual table] implementation.
9693
+ ** The result of invoking these interfaces from any other context
9694
+ ** is undefined and probably harmful.
9695
+ **
9696
+ ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
9697
+ ** sqlite3_vtab_in_next(X,P) must be one of the parameters to the
9698
+ ** xFilter method which invokes these routines, and specifically
9699
+ ** a parameter that was previously selected for all-at-once IN constraint
9700
+ ** processing use the [sqlite3_vtab_in()] interface in the
9701
+ ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
9702
+ ** an xFilter argument that was selected for all-at-once IN constraint
9703
+ ** processing, then these routines return [SQLITE_MISUSE])^ or perhaps
9704
+ ** exhibit some other undefined or harmful behavior.
9705
+ **
9706
+ ** ^(Use these routines to access all values on the right-hand side
9707
+ ** of the IN constraint using code like the following:
9708
+ **
9709
+ ** <blockquote><pre>
9710
+ ** &nbsp; for(rc=sqlite3_vtab_in_first(pList, &pVal);
9711
+ ** &nbsp; rc==SQLITE_OK && pVal
9712
+ ** &nbsp; rc=sqlite3_vtab_in_next(pList, &pVal)
9713
+ ** &nbsp; ){
9714
+ ** &nbsp; // do something with pVal
9715
+ ** &nbsp; }
9716
+ ** &nbsp; if( rc!=SQLITE_OK ){
9717
+ ** &nbsp; // an error has occurred
9718
+ ** &nbsp; }
9719
+ ** </pre></blockquote>)^
9720
+ **
9721
+ ** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P)
9722
+ ** routines return SQLITE_OK and set *P to point to the first or next value
9723
+ ** on the RHS of the IN constraint. ^If there are no more values on the
9724
+ ** right hand side of the IN constraint, then *P is set to NULL and these
9725
+ ** routines return [SQLITE_DONE]. ^The return value might be
9726
+ ** some other value, such as SQLITE_NOMEM, in the event of a malfunction.
9727
+ **
9728
+ ** The *ppOut values returned by these routines are only valid until the
9729
+ ** next call to either of these routines or until the end of the xFilter
9730
+ ** method from which these routines were called. If the virtual table
9731
+ ** implementation needs to retain the *ppOut values for longer, it must make
9732
+ ** copies. The *ppOut values are [protected sqlite3_value|protected].
9733
+ */
9734
+ SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut);
9735
+ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
9736
+
9737
+ /*
9738
+ ** CAPI3REF: Constraint values in xBestIndex()
9739
+ ** METHOD: sqlite3_index_info
9740
+ **
9741
+ ** This API may only be used from within the [xBestIndex|xBestIndex method]
9742
+ ** of a [virtual table] implementation. The result of calling this interface
9743
+ ** from outside of an xBestIndex method are undefined and probably harmful.
9744
+ **
9745
+ ** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within
9746
+ ** the [xBestIndex] method of a [virtual table] implementation, with P being
9747
+ ** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and
9748
+ ** J being a 0-based index into P->aConstraint[], then this routine
9749
+ ** attempts to set *V to the value of the right-hand operand of
9750
+ ** that constraint if the right-hand operand is known. ^If the
9751
+ ** right-hand operand is not known, then *V is set to a NULL pointer.
9752
+ ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
9753
+ ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
9754
+ ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
9755
+ ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
9756
+ ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
9757
+ ** something goes wrong.
9758
+ **
9759
+ ** The sqlite3_vtab_rhs_value() interface is usually only successful if
9760
+ ** the right-hand operand of a constraint is a literal value in the original
9761
+ ** SQL statement. If the right-hand operand is an expression or a reference
9762
+ ** to some other column or a [host parameter], then sqlite3_vtab_rhs_value()
9763
+ ** will probably return [SQLITE_NOTFOUND].
9764
+ **
9765
+ ** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and
9766
+ ** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such
9767
+ ** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^
9768
+ **
9769
+ ** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value
9770
+ ** and remains valid for the duration of the xBestIndex method call.
9771
+ ** ^When xBestIndex returns, the sqlite3_value object returned by
9772
+ ** sqlite3_vtab_rhs_value() is automatically deallocated.
9773
+ **
9774
+ ** The "_rhs_" in the name of this routine is an abbreviation for
9775
+ ** "Right-Hand Side".
9776
+ */
9777
+ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal);
9778
+
9299
9779
  /*
9300
9780
  ** CAPI3REF: Conflict resolution modes
9301
9781
  ** KEYWORDS: {conflict resolution mode}
@@ -9531,6 +10011,15 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
9531
10011
  ** triggers; or 2 for changes resulting from triggers called by top-level
9532
10012
  ** triggers; and so forth.
9533
10013
  **
10014
+ ** When the [sqlite3_blob_write()] API is used to update a blob column,
10015
+ ** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10016
+ ** in this case the new values are not available. In this case, when a
10017
+ ** callback made with op==SQLITE_DELETE is actuall a write using the
10018
+ ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10019
+ ** the index of the column being written. In other cases, where the
10020
+ ** pre-update hook is being invoked for some other reason, including a
10021
+ ** regular DELETE, sqlite3_preupdate_blobwrite() returns -1.
10022
+ **
9534
10023
  ** See also: [sqlite3_update_hook()]
9535
10024
  */
9536
10025
  #if defined(SQLITE_ENABLE_PREUPDATE_HOOK)
@@ -9551,6 +10040,7 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
9551
10040
  SQLITE_API int sqlite3_preupdate_count(sqlite3 *);
9552
10041
  SQLITE_API int sqlite3_preupdate_depth(sqlite3 *);
9553
10042
  SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
10043
+ SQLITE_API int sqlite3_preupdate_blobwrite(sqlite3 *);
9554
10044
  #endif
9555
10045
 
9556
10046
  /*
@@ -9789,8 +10279,8 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
9789
10279
  ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
9790
10280
  ** allocation error occurs.
9791
10281
  **
9792
- ** This interface is only available if SQLite is compiled with the
9793
- ** [SQLITE_ENABLE_DESERIALIZE] option.
10282
+ ** This interface is omitted if SQLite is compiled with the
10283
+ ** [SQLITE_OMIT_DESERIALIZE] option.
9794
10284
  */
9795
10285
  SQLITE_API unsigned char *sqlite3_serialize(
9796
10286
  sqlite3 *db, /* The database connection */
@@ -9837,12 +10327,16 @@ SQLITE_API unsigned char *sqlite3_serialize(
9837
10327
  ** database is currently in a read transaction or is involved in a backup
9838
10328
  ** operation.
9839
10329
  **
10330
+ ** It is not possible to deserialized into the TEMP database. If the
10331
+ ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
10332
+ ** function returns SQLITE_ERROR.
10333
+ **
9840
10334
  ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
9841
10335
  ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
9842
10336
  ** [sqlite3_free()] is invoked on argument P prior to returning.
9843
10337
  **
9844
- ** This interface is only available if SQLite is compiled with the
9845
- ** [SQLITE_ENABLE_DESERIALIZE] option.
10338
+ ** This interface is omitted if SQLite is compiled with the
10339
+ ** [SQLITE_OMIT_DESERIALIZE] option.
9846
10340
  */
9847
10341
  SQLITE_API int sqlite3_deserialize(
9848
10342
  sqlite3 *db, /* The database connection */
@@ -10091,6 +10585,38 @@ SQLITE_API int sqlite3session_create(
10091
10585
  */
10092
10586
  SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
10093
10587
 
10588
+ /*
10589
+ ** CAPIREF: Conigure a Session Object
10590
+ ** METHOD: sqlite3_session
10591
+ **
10592
+ ** This method is used to configure a session object after it has been
10593
+ ** created. At present the only valid value for the second parameter is
10594
+ ** [SQLITE_SESSION_OBJCONFIG_SIZE].
10595
+ **
10596
+ ** Arguments for sqlite3session_object_config()
10597
+ **
10598
+ ** The following values may passed as the the 4th parameter to
10599
+ ** sqlite3session_object_config().
10600
+ **
10601
+ ** <dt>SQLITE_SESSION_OBJCONFIG_SIZE <dd>
10602
+ ** This option is used to set, clear or query the flag that enables
10603
+ ** the [sqlite3session_changeset_size()] API. Because it imposes some
10604
+ ** computational overhead, this API is disabled by default. Argument
10605
+ ** pArg must point to a value of type (int). If the value is initially
10606
+ ** 0, then the sqlite3session_changeset_size() API is disabled. If it
10607
+ ** is greater than 0, then the same API is enabled. Or, if the initial
10608
+ ** value is less than zero, no change is made. In all cases the (int)
10609
+ ** variable is set to 1 if the sqlite3session_changeset_size() API is
10610
+ ** enabled following the current call, or 0 otherwise.
10611
+ **
10612
+ ** It is an error (SQLITE_MISUSE) to attempt to modify this setting after
10613
+ ** the first table has been attached to the session object.
10614
+ */
10615
+ SQLITE_API int sqlite3session_object_config(sqlite3_session*, int op, void *pArg);
10616
+
10617
+ /*
10618
+ */
10619
+ #define SQLITE_SESSION_OBJCONFIG_SIZE 1
10094
10620
 
10095
10621
  /*
10096
10622
  ** CAPI3REF: Enable Or Disable A Session Object
@@ -10335,6 +10861,22 @@ SQLITE_API int sqlite3session_changeset(
10335
10861
  void **ppChangeset /* OUT: Buffer containing changeset */
10336
10862
  );
10337
10863
 
10864
+ /*
10865
+ ** CAPI3REF: Return An Upper-limit For The Size Of The Changeset
10866
+ ** METHOD: sqlite3_session
10867
+ **
10868
+ ** By default, this function always returns 0. For it to return
10869
+ ** a useful result, the sqlite3_session object must have been configured
10870
+ ** to enable this API using sqlite3session_object_config() with the
10871
+ ** SQLITE_SESSION_OBJCONFIG_SIZE verb.
10872
+ **
10873
+ ** When enabled, this function returns an upper limit, in bytes, for the size
10874
+ ** of the changeset that might be produced if sqlite3session_changeset() were
10875
+ ** called. The final changeset size might be equal to or smaller than the
10876
+ ** size in bytes returned by this function.
10877
+ */
10878
+ SQLITE_API sqlite3_int64 sqlite3session_changeset_size(sqlite3_session *pSession);
10879
+
10338
10880
  /*
10339
10881
  ** CAPI3REF: Load The Difference Between Tables Into A Session
10340
10882
  ** METHOD: sqlite3_session