extralite-bundle 2.2 → 2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -146,9 +146,9 @@ extern "C" {
146
146
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147
147
  ** [sqlite_version()] and [sqlite_source_id()].
148
148
  */
149
- #define SQLITE_VERSION "3.42.0"
150
- #define SQLITE_VERSION_NUMBER 3042000
151
- #define SQLITE_SOURCE_ID "2023-05-16 12:36:15 831d0fb2836b71c9bc51067c49fee4b8f18047814f2ff22d817d25195cf350b0"
149
+ #define SQLITE_VERSION "3.44.2"
150
+ #define SQLITE_VERSION_NUMBER 3044002
151
+ #define SQLITE_SOURCE_ID "2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf92c0f"
152
152
 
153
153
  /*
154
154
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -528,6 +528,7 @@ SQLITE_API int sqlite3_exec(
528
528
  #define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
529
529
  #define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
530
530
  #define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
531
+ #define SQLITE_IOERR_IN_PAGE (SQLITE_IOERR | (34<<8))
531
532
  #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
532
533
  #define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
533
534
  #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
@@ -1190,7 +1191,7 @@ struct sqlite3_io_methods {
1190
1191
  ** by clients within the current process, only within other processes.
1191
1192
  **
1192
1193
  ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
1193
- ** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use interally by the
1194
+ ** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use internally by the
1194
1195
  ** [checksum VFS shim] only.
1195
1196
  **
1196
1197
  ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
@@ -2126,7 +2127,7 @@ struct sqlite3_mem_methods {
2126
2127
  ** is stored in each sorted record and the required column values loaded
2127
2128
  ** from the database as records are returned in sorted order. The default
2128
2129
  ** value for this option is to never use this optimization. Specifying a
2129
- ** negative value for this option restores the default behaviour.
2130
+ ** negative value for this option restores the default behavior.
2130
2131
  ** This option is only available if SQLite is compiled with the
2131
2132
  ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
2132
2133
  **
@@ -2301,7 +2302,7 @@ struct sqlite3_mem_methods {
2301
2302
  ** database handle, SQLite checks if this will mean that there are now no
2302
2303
  ** connections at all to the database. If so, it performs a checkpoint
2303
2304
  ** operation before closing the connection. This option may be used to
2304
- ** override this behaviour. The first parameter passed to this operation
2305
+ ** override this behavior. The first parameter passed to this operation
2305
2306
  ** is an integer - positive to disable checkpoints-on-close, or zero (the
2306
2307
  ** default) to enable them, and negative to leave the setting unchanged.
2307
2308
  ** The second parameter is a pointer to an integer
@@ -2454,7 +2455,7 @@ struct sqlite3_mem_methods {
2454
2455
  ** the [VACUUM] command will fail with an obscure error when attempting to
2455
2456
  ** process a table with generated columns and a descending index. This is
2456
2457
  ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2457
- ** either generated columns or decending indexes.
2458
+ ** either generated columns or descending indexes.
2458
2459
  ** </dd>
2459
2460
  **
2460
2461
  ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
@@ -2735,6 +2736,7 @@ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
2735
2736
  **
2736
2737
  ** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
2737
2738
  ** or not an interrupt is currently in effect for [database connection] D.
2739
+ ** It returns 1 if an interrupt is currently in effect, or 0 otherwise.
2738
2740
  */
2739
2741
  SQLITE_API void sqlite3_interrupt(sqlite3*);
2740
2742
  SQLITE_API int sqlite3_is_interrupted(sqlite3*);
@@ -3388,8 +3390,10 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
3388
3390
  ** M argument should be the bitwise OR-ed combination of
3389
3391
  ** zero or more [SQLITE_TRACE] constants.
3390
3392
  **
3391
- ** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides
3392
- ** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2().
3393
+ ** ^Each call to either sqlite3_trace(D,X,P) or sqlite3_trace_v2(D,M,X,P)
3394
+ ** overrides (cancels) all prior calls to sqlite3_trace(D,X,P) or
3395
+ ** sqlite3_trace_v2(D,M,X,P) for the [database connection] D. Each
3396
+ ** database connection may have at most one trace callback.
3393
3397
  **
3394
3398
  ** ^The X callback is invoked whenever any of the events identified by
3395
3399
  ** mask M occur. ^The integer return value from the callback is currently
@@ -3758,7 +3762,7 @@ SQLITE_API int sqlite3_open_v2(
3758
3762
  ** as F) must be one of:
3759
3763
  ** <ul>
3760
3764
  ** <li> A database filename pointer created by the SQLite core and
3761
- ** passed into the xOpen() method of a VFS implemention, or
3765
+ ** passed into the xOpen() method of a VFS implementation, or
3762
3766
  ** <li> A filename obtained from [sqlite3_db_filename()], or
3763
3767
  ** <li> A new filename constructed using [sqlite3_create_filename()].
3764
3768
  ** </ul>
@@ -3871,7 +3875,7 @@ SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
3871
3875
  /*
3872
3876
  ** CAPI3REF: Create and Destroy VFS Filenames
3873
3877
  **
3874
- ** These interfces are provided for use by [VFS shim] implementations and
3878
+ ** These interfaces are provided for use by [VFS shim] implementations and
3875
3879
  ** are not useful outside of that context.
3876
3880
  **
3877
3881
  ** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
@@ -3951,6 +3955,7 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
3951
3955
  **
3952
3956
  ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
3953
3957
  ** text that describes the error, as either UTF-8 or UTF-16 respectively.
3958
+ ** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
3954
3959
  ** ^(Memory to hold the error message string is managed internally.
3955
3960
  ** The application does not need to worry about freeing the result.
3956
3961
  ** However, the error string might be overwritten or deallocated by
@@ -4418,6 +4423,41 @@ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
4418
4423
  */
4419
4424
  SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
4420
4425
 
4426
+ /*
4427
+ ** CAPI3REF: Change The EXPLAIN Setting For A Prepared Statement
4428
+ ** METHOD: sqlite3_stmt
4429
+ **
4430
+ ** The sqlite3_stmt_explain(S,E) interface changes the EXPLAIN
4431
+ ** setting for [prepared statement] S. If E is zero, then S becomes
4432
+ ** a normal prepared statement. If E is 1, then S behaves as if
4433
+ ** its SQL text began with "[EXPLAIN]". If E is 2, then S behaves as if
4434
+ ** its SQL text began with "[EXPLAIN QUERY PLAN]".
4435
+ **
4436
+ ** Calling sqlite3_stmt_explain(S,E) might cause S to be reprepared.
4437
+ ** SQLite tries to avoid a reprepare, but a reprepare might be necessary
4438
+ ** on the first transition into EXPLAIN or EXPLAIN QUERY PLAN mode.
4439
+ **
4440
+ ** Because of the potential need to reprepare, a call to
4441
+ ** sqlite3_stmt_explain(S,E) will fail with SQLITE_ERROR if S cannot be
4442
+ ** reprepared because it was created using [sqlite3_prepare()] instead of
4443
+ ** the newer [sqlite3_prepare_v2()] or [sqlite3_prepare_v3()] interfaces and
4444
+ ** hence has no saved SQL text with which to reprepare.
4445
+ **
4446
+ ** Changing the explain setting for a prepared statement does not change
4447
+ ** the original SQL text for the statement. Hence, if the SQL text originally
4448
+ ** began with EXPLAIN or EXPLAIN QUERY PLAN, but sqlite3_stmt_explain(S,0)
4449
+ ** is called to convert the statement into an ordinary statement, the EXPLAIN
4450
+ ** or EXPLAIN QUERY PLAN keywords will still appear in the sqlite3_sql(S)
4451
+ ** output, even though the statement now acts like a normal SQL statement.
4452
+ **
4453
+ ** This routine returns SQLITE_OK if the explain mode is successfully
4454
+ ** changed, or an error code if the explain mode could not be changed.
4455
+ ** The explain mode cannot be changed while a statement is active.
4456
+ ** Hence, it is good practice to call [sqlite3_reset(S)]
4457
+ ** immediately prior to calling sqlite3_stmt_explain(S,E).
4458
+ */
4459
+ SQLITE_API int sqlite3_stmt_explain(sqlite3_stmt *pStmt, int eMode);
4460
+
4421
4461
  /*
4422
4462
  ** CAPI3REF: Determine If A Prepared Statement Has Been Reset
4423
4463
  ** METHOD: sqlite3_stmt
@@ -4581,7 +4621,7 @@ typedef struct sqlite3_context sqlite3_context;
4581
4621
  ** with it may be passed. ^It is called to dispose of the BLOB or string even
4582
4622
  ** if the call to the bind API fails, except the destructor is not called if
4583
4623
  ** the third parameter is a NULL pointer or the fourth parameter is negative.
4584
- ** ^ (2) The special constant, [SQLITE_STATIC], may be passsed to indicate that
4624
+ ** ^ (2) The special constant, [SQLITE_STATIC], may be passed to indicate that
4585
4625
  ** the application remains responsible for disposing of the object. ^In this
4586
4626
  ** case, the object and the provided pointer to it must remain valid until
4587
4627
  ** either the prepared statement is finalized or the same SQL parameter is
@@ -5260,20 +5300,33 @@ SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
5260
5300
  ** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
5261
5301
  ** back to the beginning of its program.
5262
5302
  **
5263
- ** ^If the most recent call to [sqlite3_step(S)] for the
5264
- ** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
5265
- ** or if [sqlite3_step(S)] has never before been called on S,
5266
- ** then [sqlite3_reset(S)] returns [SQLITE_OK].
5303
+ ** ^The return code from [sqlite3_reset(S)] indicates whether or not
5304
+ ** the previous evaluation of prepared statement S completed successfully.
5305
+ ** ^If [sqlite3_step(S)] has never before been called on S or if
5306
+ ** [sqlite3_step(S)] has not been called since the previous call
5307
+ ** to [sqlite3_reset(S)], then [sqlite3_reset(S)] will return
5308
+ ** [SQLITE_OK].
5267
5309
  **
5268
5310
  ** ^If the most recent call to [sqlite3_step(S)] for the
5269
5311
  ** [prepared statement] S indicated an error, then
5270
5312
  ** [sqlite3_reset(S)] returns an appropriate [error code].
5313
+ ** ^The [sqlite3_reset(S)] interface might also return an [error code]
5314
+ ** if there were no prior errors but the process of resetting
5315
+ ** the prepared statement caused a new error. ^For example, if an
5316
+ ** [INSERT] statement with a [RETURNING] clause is only stepped one time,
5317
+ ** that one call to [sqlite3_step(S)] might return SQLITE_ROW but
5318
+ ** the overall statement might still fail and the [sqlite3_reset(S)] call
5319
+ ** might return SQLITE_BUSY if locking constraints prevent the
5320
+ ** database change from committing. Therefore, it is important that
5321
+ ** applications check the return code from [sqlite3_reset(S)] even if
5322
+ ** no prior call to [sqlite3_step(S)] indicated a problem.
5271
5323
  **
5272
5324
  ** ^The [sqlite3_reset(S)] interface does not change the values
5273
5325
  ** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
5274
5326
  */
5275
5327
  SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
5276
5328
 
5329
+
5277
5330
  /*
5278
5331
  ** CAPI3REF: Create Or Redefine SQL Functions
5279
5332
  ** KEYWORDS: {function creation routines}
@@ -5484,7 +5537,7 @@ SQLITE_API int sqlite3_create_window_function(
5484
5537
  ** [application-defined SQL function]
5485
5538
  ** that has side-effects or that could potentially leak sensitive information.
5486
5539
  ** This will prevent attacks in which an application is tricked
5487
- ** into using a database file that has had its schema surreptiously
5540
+ ** into using a database file that has had its schema surreptitiously
5488
5541
  ** modified to invoke the application-defined function in ways that are
5489
5542
  ** harmful.
5490
5543
  ** <p>
@@ -5520,13 +5573,27 @@ SQLITE_API int sqlite3_create_window_function(
5520
5573
  ** </dd>
5521
5574
  **
5522
5575
  ** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
5523
- ** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
5576
+ ** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
5524
5577
  ** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
5525
- ** Specifying this flag makes no difference for scalar or aggregate user
5526
- ** functions. However, if it is not specified for a user-defined window
5527
- ** function, then any sub-types belonging to arguments passed to the window
5528
- ** function may be discarded before the window function is called (i.e.
5529
- ** sqlite3_value_subtype() will always return 0).
5578
+ ** This flag instructs SQLite to omit some corner-case optimizations that
5579
+ ** might disrupt the operation of the [sqlite3_value_subtype()] function,
5580
+ ** causing it to return zero rather than the correct subtype().
5581
+ ** SQL functions that invokes [sqlite3_value_subtype()] should have this
5582
+ ** property. If the SQLITE_SUBTYPE property is omitted, then the return
5583
+ ** value from [sqlite3_value_subtype()] might sometimes be zero even though
5584
+ ** a non-zero subtype was specified by the function argument expression.
5585
+ **
5586
+ ** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
5587
+ ** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
5588
+ ** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
5589
+ ** result.
5590
+ ** Every function that invokes [sqlite3_result_subtype()] should have this
5591
+ ** property. If it does not, then the call to [sqlite3_result_subtype()]
5592
+ ** might become a no-op if the function is used as term in an
5593
+ ** [expression index]. On the other hand, SQL functions that never invoke
5594
+ ** [sqlite3_result_subtype()] should avoid setting this property, as the
5595
+ ** purpose of this property is to disable certain optimizations that are
5596
+ ** incompatible with subtypes.
5530
5597
  ** </dd>
5531
5598
  ** </dl>
5532
5599
  */
@@ -5534,6 +5601,7 @@ SQLITE_API int sqlite3_create_window_function(
5534
5601
  #define SQLITE_DIRECTONLY 0x000080000
5535
5602
  #define SQLITE_SUBTYPE 0x000100000
5536
5603
  #define SQLITE_INNOCUOUS 0x000200000
5604
+ #define SQLITE_RESULT_SUBTYPE 0x001000000
5537
5605
 
5538
5606
  /*
5539
5607
  ** CAPI3REF: Deprecated Functions
@@ -5730,6 +5798,12 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
5730
5798
  ** information can be used to pass a limited amount of context from
5731
5799
  ** one SQL function to another. Use the [sqlite3_result_subtype()]
5732
5800
  ** routine to set the subtype for the return value of an SQL function.
5801
+ **
5802
+ ** Every [application-defined SQL function] that invoke this interface
5803
+ ** should include the [SQLITE_SUBTYPE] property in the text
5804
+ ** encoding argument when the function is [sqlite3_create_function|registered].
5805
+ ** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
5806
+ ** might return zero instead of the upstream subtype in some corner cases.
5733
5807
  */
5734
5808
  SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
5735
5809
 
@@ -5828,48 +5902,56 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
5828
5902
  ** METHOD: sqlite3_context
5829
5903
  **
5830
5904
  ** These functions may be used by (non-aggregate) SQL functions to
5831
- ** associate metadata with argument values. If the same value is passed to
5832
- ** multiple invocations of the same SQL function during query execution, under
5833
- ** some circumstances the associated metadata may be preserved. An example
5834
- ** of where this might be useful is in a regular-expression matching
5835
- ** function. The compiled version of the regular expression can be stored as
5836
- ** metadata associated with the pattern string.
5905
+ ** associate auxiliary data with argument values. If the same argument
5906
+ ** value is passed to multiple invocations of the same SQL function during
5907
+ ** query execution, under some circumstances the associated auxiliary data
5908
+ ** might be preserved. An example of where this might be useful is in a
5909
+ ** regular-expression matching function. The compiled version of the regular
5910
+ ** expression can be stored as auxiliary data associated with the pattern string.
5837
5911
  ** Then as long as the pattern string remains the same,
5838
5912
  ** the compiled regular expression can be reused on multiple
5839
5913
  ** invocations of the same function.
5840
5914
  **
5841
- ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata
5915
+ ** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the auxiliary data
5842
5916
  ** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
5843
5917
  ** value to the application-defined function. ^N is zero for the left-most
5844
- ** function argument. ^If there is no metadata
5918
+ ** function argument. ^If there is no auxiliary data
5845
5919
  ** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
5846
5920
  ** returns a NULL pointer.
5847
5921
  **
5848
- ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th
5849
- ** argument of the application-defined function. ^Subsequent
5922
+ ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as auxiliary data for the
5923
+ ** N-th argument of the application-defined function. ^Subsequent
5850
5924
  ** calls to sqlite3_get_auxdata(C,N) return P from the most recent
5851
- ** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or
5852
- ** NULL if the metadata has been discarded.
5925
+ ** sqlite3_set_auxdata(C,N,P,X) call if the auxiliary data is still valid or
5926
+ ** NULL if the auxiliary data has been discarded.
5853
5927
  ** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
5854
5928
  ** SQLite will invoke the destructor function X with parameter P exactly
5855
- ** once, when the metadata is discarded.
5856
- ** SQLite is free to discard the metadata at any time, including: <ul>
5929
+ ** once, when the auxiliary data is discarded.
5930
+ ** SQLite is free to discard the auxiliary data at any time, including: <ul>
5857
5931
  ** <li> ^(when the corresponding function parameter changes)^, or
5858
5932
  ** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
5859
5933
  ** SQL statement)^, or
5860
5934
  ** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
5861
5935
  ** parameter)^, or
5862
5936
  ** <li> ^(during the original sqlite3_set_auxdata() call when a memory
5863
- ** allocation error occurs.)^ </ul>
5937
+ ** allocation error occurs.)^
5938
+ ** <li> ^(during the original sqlite3_set_auxdata() call if the function
5939
+ ** is evaluated during query planning instead of during query execution,
5940
+ ** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ </ul>
5864
5941
  **
5865
- ** Note the last bullet in particular. The destructor X in
5942
+ ** Note the last two bullets in particular. The destructor X in
5866
5943
  ** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
5867
5944
  ** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
5868
5945
  ** should be called near the end of the function implementation and the
5869
5946
  ** function implementation should not make any use of P after
5870
- ** sqlite3_set_auxdata() has been called.
5871
- **
5872
- ** ^(In practice, metadata is preserved between function calls for
5947
+ ** sqlite3_set_auxdata() has been called. Furthermore, a call to
5948
+ ** sqlite3_get_auxdata() that occurs immediately after a corresponding call
5949
+ ** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
5950
+ ** condition occurred during the sqlite3_set_auxdata() call or if the
5951
+ ** function is being evaluated during query planning rather than during
5952
+ ** query execution.
5953
+ **
5954
+ ** ^(In practice, auxiliary data is preserved between function calls for
5873
5955
  ** function parameters that are compile-time constants, including literal
5874
5956
  ** values and [parameters] and expressions composed from the same.)^
5875
5957
  **
@@ -5879,10 +5961,67 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
5879
5961
  **
5880
5962
  ** These routines must be called from the same thread in which
5881
5963
  ** the SQL function is running.
5964
+ **
5965
+ ** See also: [sqlite3_get_clientdata()] and [sqlite3_set_clientdata()].
5882
5966
  */
5883
5967
  SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
5884
5968
  SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
5885
5969
 
5970
+ /*
5971
+ ** CAPI3REF: Database Connection Client Data
5972
+ ** METHOD: sqlite3
5973
+ **
5974
+ ** These functions are used to associate one or more named pointers
5975
+ ** with a [database connection].
5976
+ ** A call to sqlite3_set_clientdata(D,N,P,X) causes the pointer P
5977
+ ** to be attached to [database connection] D using name N. Subsequent
5978
+ ** calls to sqlite3_get_clientdata(D,N) will return a copy of pointer P
5979
+ ** or a NULL pointer if there were no prior calls to
5980
+ ** sqlite3_set_clientdata() with the same values of D and N.
5981
+ ** Names are compared using strcmp() and are thus case sensitive.
5982
+ **
5983
+ ** If P and X are both non-NULL, then the destructor X is invoked with
5984
+ ** argument P on the first of the following occurrences:
5985
+ ** <ul>
5986
+ ** <li> An out-of-memory error occurs during the call to
5987
+ ** sqlite3_set_clientdata() which attempts to register pointer P.
5988
+ ** <li> A subsequent call to sqlite3_set_clientdata(D,N,P,X) is made
5989
+ ** with the same D and N parameters.
5990
+ ** <li> The database connection closes. SQLite does not make any guarantees
5991
+ ** about the order in which destructors are called, only that all
5992
+ ** destructors will be called exactly once at some point during the
5993
+ ** database connection closing process.
5994
+ ** </ul>
5995
+ **
5996
+ ** SQLite does not do anything with client data other than invoke
5997
+ ** destructors on the client data at the appropriate time. The intended
5998
+ ** use for client data is to provide a mechanism for wrapper libraries
5999
+ ** to store additional information about an SQLite database connection.
6000
+ **
6001
+ ** There is no limit (other than available memory) on the number of different
6002
+ ** client data pointers (with different names) that can be attached to a
6003
+ ** single database connection. However, the implementation is optimized
6004
+ ** for the case of having only one or two different client data names.
6005
+ ** Applications and wrapper libraries are discouraged from using more than
6006
+ ** one client data name each.
6007
+ **
6008
+ ** There is no way to enumerate the client data pointers
6009
+ ** associated with a database connection. The N parameter can be thought
6010
+ ** of as a secret key such that only code that knows the secret key is able
6011
+ ** to access the associated data.
6012
+ **
6013
+ ** Security Warning: These interfaces should not be exposed in scripting
6014
+ ** languages or in other circumstances where it might be possible for an
6015
+ ** an attacker to invoke them. Any agent that can invoke these interfaces
6016
+ ** can probably also take control of the process.
6017
+ **
6018
+ ** Database connection client data is only available for SQLite
6019
+ ** version 3.44.0 ([dateof:3.44.0]) and later.
6020
+ **
6021
+ ** See also: [sqlite3_set_auxdata()] and [sqlite3_get_auxdata()].
6022
+ */
6023
+ SQLITE_API void *sqlite3_get_clientdata(sqlite3*,const char*);
6024
+ SQLITE_API int sqlite3_set_clientdata(sqlite3*, const char*, void*, void(*)(void*));
5886
6025
 
5887
6026
  /*
5888
6027
  ** CAPI3REF: Constants Defining Special Destructor Behavior
@@ -6084,6 +6223,20 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
6084
6223
  ** higher order bits are discarded.
6085
6224
  ** The number of subtype bytes preserved by SQLite might increase
6086
6225
  ** in future releases of SQLite.
6226
+ **
6227
+ ** Every [application-defined SQL function] that invokes this interface
6228
+ ** should include the [SQLITE_RESULT_SUBTYPE] property in its
6229
+ ** text encoding argument when the SQL function is
6230
+ ** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
6231
+ ** property is omitted from the function that invokes sqlite3_result_subtype(),
6232
+ ** then in some cases the sqlite3_result_subtype() might fail to set
6233
+ ** the result subtype.
6234
+ **
6235
+ ** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
6236
+ ** SQL function that invokes the sqlite3_result_subtype() interface
6237
+ ** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
6238
+ ** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
6239
+ ** by default.
6087
6240
  */
6088
6241
  SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
6089
6242
 
@@ -6515,7 +6668,7 @@ SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
6515
6668
  SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
6516
6669
 
6517
6670
  /*
6518
- ** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
6671
+ ** CAPI3REF: Allowed return values from sqlite3_txn_state()
6519
6672
  ** KEYWORDS: {transaction state}
6520
6673
  **
6521
6674
  ** These constants define the current transaction state of a database file.
@@ -6647,7 +6800,7 @@ SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
6647
6800
  ** ^Each call to the sqlite3_autovacuum_pages() interface overrides all
6648
6801
  ** previous invocations for that database connection. ^If the callback
6649
6802
  ** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer,
6650
- ** then the autovacuum steps callback is cancelled. The return value
6803
+ ** then the autovacuum steps callback is canceled. The return value
6651
6804
  ** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might
6652
6805
  ** be some other error code if something goes wrong. The current
6653
6806
  ** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other
@@ -7166,6 +7319,10 @@ struct sqlite3_module {
7166
7319
  /* The methods above are in versions 1 and 2 of the sqlite_module object.
7167
7320
  ** Those below are for version 3 and greater. */
7168
7321
  int (*xShadowName)(const char*);
7322
+ /* The methods above are in versions 1 through 3 of the sqlite_module object.
7323
+ ** Those below are for version 4 and greater. */
7324
+ int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema,
7325
+ const char *zTabName, int mFlags, char **pzErr);
7169
7326
  };
7170
7327
 
7171
7328
  /*
@@ -7653,7 +7810,7 @@ SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
7653
7810
  ** code is returned and the transaction rolled back.
7654
7811
  **
7655
7812
  ** Calling this function with an argument that is not a NULL pointer or an
7656
- ** open blob handle results in undefined behaviour. ^Calling this routine
7813
+ ** open blob handle results in undefined behavior. ^Calling this routine
7657
7814
  ** with a null pointer (such as would be returned by a failed call to
7658
7815
  ** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
7659
7816
  ** is passed a valid open blob handle, the values returned by the
@@ -8133,6 +8290,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8133
8290
  #define SQLITE_TESTCTRL_PRNG_SAVE 5
8134
8291
  #define SQLITE_TESTCTRL_PRNG_RESTORE 6
8135
8292
  #define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
8293
+ #define SQLITE_TESTCTRL_FK_NO_ACTION 7
8136
8294
  #define SQLITE_TESTCTRL_BITVEC_TEST 8
8137
8295
  #define SQLITE_TESTCTRL_FAULT_INSTALL 9
8138
8296
  #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
@@ -8161,7 +8319,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8161
8319
  #define SQLITE_TESTCTRL_TRACEFLAGS 31
8162
8320
  #define SQLITE_TESTCTRL_TUNE 32
8163
8321
  #define SQLITE_TESTCTRL_LOGEST 33
8164
- #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
8322
+ #define SQLITE_TESTCTRL_USELONGDOUBLE 34
8323
+ #define SQLITE_TESTCTRL_LAST 34 /* Largest TESTCTRL */
8165
8324
 
8166
8325
  /*
8167
8326
  ** CAPI3REF: SQL Keyword Checking
@@ -9617,7 +9776,7 @@ SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
9617
9776
  ** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
9618
9777
  ** <dd>Calls of the form
9619
9778
  ** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
9620
- ** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
9779
+ ** the [xConnect] or [xCreate] methods of a [virtual table] implementation
9621
9780
  ** prohibits that virtual table from being used from within triggers and
9622
9781
  ** views.
9623
9782
  ** </dd>
@@ -9807,7 +9966,7 @@ SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*);
9807
9966
  ** communicated to the xBestIndex method as a
9808
9967
  ** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
9809
9968
  ** this constraint, it must set the corresponding
9810
- ** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under
9969
+ ** aConstraintUsage[].argvIndex to a positive integer. ^(Then, under
9811
9970
  ** the usual mode of handling IN operators, SQLite generates [bytecode]
9812
9971
  ** that invokes the [xFilter|xFilter() method] once for each value
9813
9972
  ** on the right-hand side of the IN operator.)^ Thus the virtual table
@@ -10236,7 +10395,7 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
10236
10395
  ** When the [sqlite3_blob_write()] API is used to update a blob column,
10237
10396
  ** the pre-update hook is invoked with SQLITE_DELETE. This is because the
10238
10397
  ** in this case the new values are not available. In this case, when a
10239
- ** callback made with op==SQLITE_DELETE is actuall a write using the
10398
+ ** callback made with op==SQLITE_DELETE is actually a write using the
10240
10399
  ** sqlite3_blob_write() API, the [sqlite3_preupdate_blobwrite()] returns
10241
10400
  ** the index of the column being written. In other cases, where the
10242
10401
  ** pre-update hook is being invoked for some other reason, including a
@@ -10497,6 +10656,13 @@ SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const c
10497
10656
  ** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy
10498
10657
  ** of the database exists.
10499
10658
  **
10659
+ ** After the call, if the SQLITE_SERIALIZE_NOCOPY bit had been set,
10660
+ ** the returned buffer content will remain accessible and unchanged
10661
+ ** until either the next write operation on the connection or when
10662
+ ** the connection is closed, and applications must not modify the
10663
+ ** buffer. If the bit had been clear, the returned buffer will not
10664
+ ** be accessed by SQLite after the call.
10665
+ **
10500
10666
  ** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the
10501
10667
  ** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
10502
10668
  ** allocation error occurs.
@@ -10545,6 +10711,9 @@ SQLITE_API unsigned char *sqlite3_serialize(
10545
10711
  ** SQLite will try to increase the buffer size using sqlite3_realloc64()
10546
10712
  ** if writes on the database cause it to grow larger than M bytes.
10547
10713
  **
10714
+ ** Applications must not modify the buffer P or invalidate it before
10715
+ ** the database connection D is closed.
10716
+ **
10548
10717
  ** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
10549
10718
  ** database is currently in a read transaction or is involved in a backup
10550
10719
  ** operation.
@@ -10553,6 +10722,13 @@ SQLITE_API unsigned char *sqlite3_serialize(
10553
10722
  ** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the
10554
10723
  ** function returns SQLITE_ERROR.
10555
10724
  **
10725
+ ** The deserialized database should not be in [WAL mode]. If the database
10726
+ ** is in WAL mode, then any attempt to use the database file will result
10727
+ ** in an [SQLITE_CANTOPEN] error. The application can set the
10728
+ ** [file format version numbers] (bytes 18 and 19) of the input database P
10729
+ ** to 0x01 prior to invoking sqlite3_deserialize(D,S,P,N,M,F) to force the
10730
+ ** database file into rollback mode and work around this limitation.
10731
+ **
10556
10732
  ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
10557
10733
  ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
10558
10734
  ** [sqlite3_free()] is invoked on argument P prior to returning.
@@ -11625,6 +11801,18 @@ SQLITE_API int sqlite3changeset_concat(
11625
11801
  );
11626
11802
 
11627
11803
 
11804
+ /*
11805
+ ** CAPI3REF: Upgrade the Schema of a Changeset/Patchset
11806
+ */
11807
+ SQLITE_API int sqlite3changeset_upgrade(
11808
+ sqlite3 *db,
11809
+ const char *zDb,
11810
+ int nIn, const void *pIn, /* Input changeset */
11811
+ int *pnOut, void **ppOut /* OUT: Inverse of input */
11812
+ );
11813
+
11814
+
11815
+
11628
11816
  /*
11629
11817
  ** CAPI3REF: Changegroup Handle
11630
11818
  **
@@ -11671,6 +11859,38 @@ typedef struct sqlite3_changegroup sqlite3_changegroup;
11671
11859
  */
11672
11860
  SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
11673
11861
 
11862
+ /*
11863
+ ** CAPI3REF: Add a Schema to a Changegroup
11864
+ ** METHOD: sqlite3_changegroup_schema
11865
+ **
11866
+ ** This method may be used to optionally enforce the rule that the changesets
11867
+ ** added to the changegroup handle must match the schema of database zDb
11868
+ ** ("main", "temp", or the name of an attached database). If
11869
+ ** sqlite3changegroup_add() is called to add a changeset that is not compatible
11870
+ ** with the configured schema, SQLITE_SCHEMA is returned and the changegroup
11871
+ ** object is left in an undefined state.
11872
+ **
11873
+ ** A changeset schema is considered compatible with the database schema in
11874
+ ** the same way as for sqlite3changeset_apply(). Specifically, for each
11875
+ ** table in the changeset, there exists a database table with:
11876
+ **
11877
+ ** <ul>
11878
+ ** <li> The name identified by the changeset, and
11879
+ ** <li> at least as many columns as recorded in the changeset, and
11880
+ ** <li> the primary key columns in the same position as recorded in
11881
+ ** the changeset.
11882
+ ** </ul>
11883
+ **
11884
+ ** The output of the changegroup object always has the same schema as the
11885
+ ** database nominated using this function. In cases where changesets passed
11886
+ ** to sqlite3changegroup_add() have fewer columns than the corresponding table
11887
+ ** in the database schema, these are filled in using the default column
11888
+ ** values from the database schema. This makes it possible to combined
11889
+ ** changesets that have different numbers of columns for a single table
11890
+ ** within a changegroup, provided that they are otherwise compatible.
11891
+ */
11892
+ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const char *zDb);
11893
+
11674
11894
  /*
11675
11895
  ** CAPI3REF: Add A Changeset To A Changegroup
11676
11896
  ** METHOD: sqlite3_changegroup
@@ -11739,13 +11959,18 @@ SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
11739
11959
  ** If the new changeset contains changes to a table that is already present
11740
11960
  ** in the changegroup, then the number of columns and the position of the
11741
11961
  ** primary key columns for the table must be consistent. If this is not the
11742
- ** case, this function fails with SQLITE_SCHEMA. If the input changeset
11743
- ** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is
11744
- ** returned. Or, if an out-of-memory condition occurs during processing, this
11745
- ** function returns SQLITE_NOMEM. In all cases, if an error occurs the state
11746
- ** of the final contents of the changegroup is undefined.
11962
+ ** case, this function fails with SQLITE_SCHEMA. Except, if the changegroup
11963
+ ** object has been configured with a database schema using the
11964
+ ** sqlite3changegroup_schema() API, then it is possible to combine changesets
11965
+ ** with different numbers of columns for a single table, provided that
11966
+ ** they are otherwise compatible.
11747
11967
  **
11748
- ** If no error occurs, SQLITE_OK is returned.
11968
+ ** If the input changeset appears to be corrupt and the corruption is
11969
+ ** detected, SQLITE_CORRUPT is returned. Or, if an out-of-memory condition
11970
+ ** occurs during processing, this function returns SQLITE_NOMEM.
11971
+ **
11972
+ ** In all cases, if an error occurs the state of the final contents of the
11973
+ ** changegroup is undefined. If no error occurs, SQLITE_OK is returned.
11749
11974
  */
11750
11975
  SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
11751
11976
 
@@ -12010,10 +12235,17 @@ SQLITE_API int sqlite3changeset_apply_v2(
12010
12235
  ** <li>an insert change if all fields of the conflicting row match
12011
12236
  ** the row being inserted.
12012
12237
  ** </ul>
12238
+ **
12239
+ ** <dt>SQLITE_CHANGESETAPPLY_FKNOACTION <dd>
12240
+ ** If this flag it set, then all foreign key constraints in the target
12241
+ ** database behave as if they were declared with "ON UPDATE NO ACTION ON
12242
+ ** DELETE NO ACTION", even if they are actually CASCADE, RESTRICT, SET NULL
12243
+ ** or SET DEFAULT.
12013
12244
  */
12014
12245
  #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
12015
12246
  #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
12016
12247
  #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
12248
+ #define SQLITE_CHANGESETAPPLY_FKNOACTION 0x0008
12017
12249
 
12018
12250
  /*
12019
12251
  ** CAPI3REF: Constants Passed To The Conflict Handler
@@ -12754,7 +12986,7 @@ struct Fts5PhraseIter {
12754
12986
  ** See xPhraseFirstColumn above.
12755
12987
  */
12756
12988
  struct Fts5ExtensionApi {
12757
- int iVersion; /* Currently always set to 3 */
12989
+ int iVersion; /* Currently always set to 2 */
12758
12990
 
12759
12991
  void *(*xUserData)(Fts5Context*);
12760
12992
 
@@ -12983,8 +13215,8 @@ struct Fts5ExtensionApi {
12983
13215
  ** as separate queries of the FTS index are required for each synonym.
12984
13216
  **
12985
13217
  ** When using methods (2) or (3), it is important that the tokenizer only
12986
- ** provide synonyms when tokenizing document text (method (2)) or query
12987
- ** text (method (3)), not both. Doing so will not cause any errors, but is
13218
+ ** provide synonyms when tokenizing document text (method (3)) or query
13219
+ ** text (method (2)), not both. Doing so will not cause any errors, but is
12988
13220
  ** inefficient.
12989
13221
  */
12990
13222
  typedef struct Fts5Tokenizer Fts5Tokenizer;
@@ -13032,7 +13264,7 @@ struct fts5_api {
13032
13264
  int (*xCreateTokenizer)(
13033
13265
  fts5_api *pApi,
13034
13266
  const char *zName,
13035
- void *pContext,
13267
+ void *pUserData,
13036
13268
  fts5_tokenizer *pTokenizer,
13037
13269
  void (*xDestroy)(void*)
13038
13270
  );
@@ -13041,7 +13273,7 @@ struct fts5_api {
13041
13273
  int (*xFindTokenizer)(
13042
13274
  fts5_api *pApi,
13043
13275
  const char *zName,
13044
- void **ppContext,
13276
+ void **ppUserData,
13045
13277
  fts5_tokenizer *pTokenizer
13046
13278
  );
13047
13279
 
@@ -13049,7 +13281,7 @@ struct fts5_api {
13049
13281
  int (*xCreateFunction)(
13050
13282
  fts5_api *pApi,
13051
13283
  const char *zName,
13052
- void *pContext,
13284
+ void *pUserData,
13053
13285
  fts5_extension_function xFunction,
13054
13286
  void (*xDestroy)(void*)
13055
13287
  );