better-sqlite3-multiple-ciphers 8.1.0 → 8.2.0

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.
@@ -20,7 +20,7 @@
20
20
  ** Purpose: SQLite3 Multiple Ciphers version numbers
21
21
  ** Author: Ulrich Telle
22
22
  ** Created: 2020-08-05
23
- ** Copyright: (c) 2020-2022 Ulrich Telle
23
+ ** Copyright: (c) 2020-2023 Ulrich Telle
24
24
  ** License: MIT
25
25
  */
26
26
 
@@ -30,10 +30,10 @@
30
30
  #define SQLITE3MC_VERSION_H_
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 1
33
- #define SQLITE3MC_VERSION_MINOR 5
34
- #define SQLITE3MC_VERSION_RELEASE 5
33
+ #define SQLITE3MC_VERSION_MINOR 6
34
+ #define SQLITE3MC_VERSION_RELEASE 0
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.5.5"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.6.0"
37
37
 
38
38
  #endif /* SQLITE3MC_VERSION_H_ */
39
39
  /*** End of #include "sqlite3mc_version.h" ***/
@@ -192,9 +192,9 @@ extern "C" {
192
192
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
193
193
  ** [sqlite_version()] and [sqlite_source_id()].
194
194
  */
195
- #define SQLITE_VERSION "3.40.1"
196
- #define SQLITE_VERSION_NUMBER 3040001
197
- #define SQLITE_SOURCE_ID "2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24"
195
+ #define SQLITE_VERSION "3.41.0"
196
+ #define SQLITE_VERSION_NUMBER 3041000
197
+ #define SQLITE_SOURCE_ID "2023-02-21 18:09:37 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d"
198
198
 
199
199
  /*
200
200
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -609,6 +609,7 @@ SQLITE_API int sqlite3_exec(
609
609
  #define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8))
610
610
  #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
611
611
  #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
612
+ #define SQLITE_NOTICE_RBU (SQLITE_NOTICE | (3<<8))
612
613
  #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
613
614
  #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
614
615
  #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
@@ -1221,7 +1222,6 @@ struct sqlite3_io_methods {
1221
1222
  ** in wal mode after the client has finished copying pages from the wal
1222
1223
  ** file to the database file, but before the *-shm file is updated to
1223
1224
  ** record the fact that the pages have been checkpointed.
1224
- ** </ul>
1225
1225
  **
1226
1226
  ** <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
1227
1227
  ** The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
@@ -1234,16 +1234,16 @@ struct sqlite3_io_methods {
1234
1234
  ** the database is not a wal-mode db, or if there is no such connection in any
1235
1235
  ** other process. This opcode cannot be used to detect transactions opened
1236
1236
  ** by clients within the current process, only within other processes.
1237
- ** </ul>
1238
1237
  **
1239
1238
  ** <li>[[SQLITE_FCNTL_CKSM_FILE]]
1240
- ** Used by the cksmvfs VFS module only.
1239
+ ** The [SQLITE_FCNTL_CKSM_FILE] opcode is for use interally by the
1240
+ ** [checksum VFS shim] only.
1241
1241
  **
1242
1242
  ** <li>[[SQLITE_FCNTL_RESET_CACHE]]
1243
1243
  ** If there is currently no transaction open on the database, and the
1244
- ** database is not a temp db, then this file-control purges the contents
1245
- ** of the in-memory page cache. If there is an open transaction, or if
1246
- ** the db is a temp-db, it is a no-op, not an error.
1244
+ ** database is not a temp db, then the [SQLITE_FCNTL_RESET_CACHE] file-control
1245
+ ** purges the contents of the in-memory page cache. If there is an open
1246
+ ** transaction, or if the db is a temp-db, this opcode is a no-op, not an error.
1247
1247
  ** </ul>
1248
1248
  */
1249
1249
  #define SQLITE_FCNTL_LOCKSTATE 1
@@ -2230,7 +2230,7 @@ struct sqlite3_mem_methods {
2230
2230
  ** configuration for a database connection can only be changed when that
2231
2231
  ** connection is not currently using lookaside memory, or in other words
2232
2232
  ** when the "current value" returned by
2233
- ** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero.
2233
+ ** [sqlite3_db_status](D,[SQLITE_DBSTATUS_LOOKASIDE_USED],...) is zero.
2234
2234
  ** Any attempt to change the lookaside memory configuration when lookaside
2235
2235
  ** memory is in use leaves the configuration unchanged and returns
2236
2236
  ** [SQLITE_BUSY].)^</dd>
@@ -2380,8 +2380,12 @@ struct sqlite3_mem_methods {
2380
2380
  ** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0);
2381
2381
  ** </ol>
2382
2382
  ** Because resetting a database is destructive and irreversible, the
2383
- ** process requires the use of this obscure API and multiple steps to help
2384
- ** ensure that it does not happen by accident.
2383
+ ** process requires the use of this obscure API and multiple steps to
2384
+ ** help ensure that it does not happen by accident. Because this
2385
+ ** feature must be capable of resetting corrupt databases, and
2386
+ ** shutting down virtual tables may require access to that corrupt
2387
+ ** storage, the library must abandon any installed virtual tables
2388
+ ** without calling their xDestroy() methods.
2385
2389
  **
2386
2390
  ** [[SQLITE_DBCONFIG_DEFENSIVE]] <dt>SQLITE_DBCONFIG_DEFENSIVE</dt>
2387
2391
  ** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
@@ -2720,8 +2724,12 @@ SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*);
2720
2724
  ** ^A call to sqlite3_interrupt(D) that occurs when there are no running
2721
2725
  ** SQL statements is a no-op and has no effect on SQL statements
2722
2726
  ** that are started after the sqlite3_interrupt() call returns.
2727
+ **
2728
+ ** ^The [sqlite3_is_interrupted(D)] interface can be used to determine whether
2729
+ ** or not an interrupt is currently in effect for [database connection] D.
2723
2730
  */
2724
2731
  SQLITE_API void sqlite3_interrupt(sqlite3*);
2732
+ SQLITE_API int sqlite3_is_interrupted(sqlite3*);
2725
2733
 
2726
2734
  /*
2727
2735
  ** CAPI3REF: Determine If An SQL Statement Is Complete
@@ -3339,8 +3347,8 @@ SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
3339
3347
  ** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same
3340
3348
  ** information as is provided by the [sqlite3_profile()] callback.
3341
3349
  ** ^The P argument is a pointer to the [prepared statement] and the
3342
- ** X argument points to a 64-bit integer which is the estimated of
3343
- ** the number of nanosecond that the prepared statement took to run.
3350
+ ** X argument points to a 64-bit integer which is approximately
3351
+ ** the number of nanoseconds that the prepared statement took to run.
3344
3352
  ** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
3345
3353
  **
3346
3354
  ** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt>
@@ -3403,7 +3411,7 @@ SQLITE_API int sqlite3_trace_v2(
3403
3411
  **
3404
3412
  ** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
3405
3413
  ** function X to be invoked periodically during long running calls to
3406
- ** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for
3414
+ ** [sqlite3_step()] and [sqlite3_prepare()] and similar for
3407
3415
  ** database connection D. An example use for this
3408
3416
  ** interface is to keep a GUI updated during a large query.
3409
3417
  **
@@ -3428,6 +3436,13 @@ SQLITE_API int sqlite3_trace_v2(
3428
3436
  ** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
3429
3437
  ** database connections for the meaning of "modify" in this paragraph.
3430
3438
  **
3439
+ ** The progress handler callback would originally only be invoked from the
3440
+ ** bytecode engine. It still might be invoked during [sqlite3_prepare()]
3441
+ ** and similar because those routines might force a reparse of the schema
3442
+ ** which involves running the bytecode engine. However, beginning with
3443
+ ** SQLite version 3.41.0, the progress handler callback might also be
3444
+ ** invoked directly from [sqlite3_prepare()] while analyzing and generating
3445
+ ** code for complex queries.
3431
3446
  */
3432
3447
  SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3433
3448
 
@@ -3464,13 +3479,18 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
3464
3479
  **
3465
3480
  ** <dl>
3466
3481
  ** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
3467
- ** <dd>The database is opened in read-only mode. If the database does not
3468
- ** already exist, an error is returned.</dd>)^
3482
+ ** <dd>The database is opened in read-only mode. If the database does
3483
+ ** not already exist, an error is returned.</dd>)^
3469
3484
  **
3470
3485
  ** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
3471
- ** <dd>The database is opened for reading and writing if possible, or reading
3472
- ** only if the file is write protected by the operating system. In either
3473
- ** case the database must already exist, otherwise an error is returned.</dd>)^
3486
+ ** <dd>The database is opened for reading and writing if possible, or
3487
+ ** reading only if the file is write protected by the operating
3488
+ ** system. In either case the database must already exist, otherwise
3489
+ ** an error is returned. For historical reasons, if opening in
3490
+ ** read-write mode fails due to OS-level permissions, an attempt is
3491
+ ** made to open it in read-only mode. [sqlite3_db_readonly()] can be
3492
+ ** used to determine whether the database is actually
3493
+ ** read-write.</dd>)^
3474
3494
  **
3475
3495
  ** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
3476
3496
  ** <dd>The database is opened for reading and writing, and is created if
@@ -5451,10 +5471,21 @@ SQLITE_API int sqlite3_create_window_function(
5451
5471
  ** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in
5452
5472
  ** schema structures such as [CHECK constraints], [DEFAULT clauses],
5453
5473
  ** [expression indexes], [partial indexes], or [generated columns].
5454
- ** The SQLITE_DIRECTONLY flags is a security feature which is recommended
5455
- ** for all [application-defined SQL functions], and especially for functions
5456
- ** that have side-effects or that could potentially leak sensitive
5457
- ** information.
5474
+ ** <p>
5475
+ ** The SQLITE_DIRECTONLY flag is recommended for any
5476
+ ** [application-defined SQL function]
5477
+ ** that has side-effects or that could potentially leak sensitive information.
5478
+ ** This will prevent attacks in which an application is tricked
5479
+ ** into using a database file that has had its schema surreptiously
5480
+ ** modified to invoke the application-defined function in ways that are
5481
+ ** harmful.
5482
+ ** <p>
5483
+ ** Some people say it is good practice to set SQLITE_DIRECTONLY on all
5484
+ ** [application-defined SQL functions], regardless of whether or not they
5485
+ ** are security sensitive, as doing so prevents those functions from being used
5486
+ ** inside of the database schema, and thus ensures that the database
5487
+ ** can be inspected and modified using generic tools (such as the [CLI])
5488
+ ** that do not have access to the application-defined functions.
5458
5489
  ** </dd>
5459
5490
  **
5460
5491
  ** [[SQLITE_INNOCUOUS]] <dt>SQLITE_INNOCUOUS</dt><dd>
@@ -5595,16 +5626,6 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
5595
5626
  ** then the conversion is performed. Otherwise no conversion occurs.
5596
5627
  ** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
5597
5628
  **
5598
- ** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8],
5599
- ** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current encoding
5600
- ** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
5601
- ** returns something other than SQLITE_TEXT, then the return value from
5602
- ** sqlite3_value_encoding(X) is meaningless. ^Calls to
5603
- ** sqlite3_value_text(X), sqlite3_value_text16(X), sqlite3_value_text16be(X),
5604
- ** sqlite3_value_text16le(X), sqlite3_value_bytes(X), or
5605
- ** sqlite3_value_bytes16(X) might change the encoding of the value X and
5606
- ** thus change the return from subsequent calls to sqlite3_value_encoding(X).
5607
- **
5608
5629
  ** ^Within the [xUpdate] method of a [virtual table], the
5609
5630
  ** sqlite3_value_nochange(X) interface returns true if and only if
5610
5631
  ** the column corresponding to X is unchanged by the UPDATE operation
@@ -5669,6 +5690,27 @@ SQLITE_API int sqlite3_value_type(sqlite3_value*);
5669
5690
  SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
5670
5691
  SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
5671
5692
  SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
5693
+
5694
+ /*
5695
+ ** CAPI3REF: Report the internal text encoding state of an sqlite3_value object
5696
+ ** METHOD: sqlite3_value
5697
+ **
5698
+ ** ^(The sqlite3_value_encoding(X) interface returns one of [SQLITE_UTF8],
5699
+ ** [SQLITE_UTF16BE], or [SQLITE_UTF16LE] according to the current text encoding
5700
+ ** of the value X, assuming that X has type TEXT.)^ If sqlite3_value_type(X)
5701
+ ** returns something other than SQLITE_TEXT, then the return value from
5702
+ ** sqlite3_value_encoding(X) is meaningless. ^Calls to
5703
+ ** [sqlite3_value_text(X)], [sqlite3_value_text16(X)], [sqlite3_value_text16be(X)],
5704
+ ** [sqlite3_value_text16le(X)], [sqlite3_value_bytes(X)], or
5705
+ ** [sqlite3_value_bytes16(X)] might change the encoding of the value X and
5706
+ ** thus change the return from subsequent calls to sqlite3_value_encoding(X).
5707
+ **
5708
+ ** This routine is intended for used by applications that test and validate
5709
+ ** the SQLite implementation. This routine is inquiring about the opaque
5710
+ ** internal state of an [sqlite3_value] object. Ordinary applications should
5711
+ ** not need to know what the internal state of an sqlite3_value object is and
5712
+ ** hence should not need to use this interface.
5713
+ */
5672
5714
  SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
5673
5715
 
5674
5716
  /*
@@ -7049,15 +7091,6 @@ SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
7049
7091
  */
7050
7092
  SQLITE_API void sqlite3_reset_auto_extension(void);
7051
7093
 
7052
- /*
7053
- ** The interface to the virtual-table mechanism is currently considered
7054
- ** to be experimental. The interface might change in incompatible ways.
7055
- ** If this is a problem for you, do not use the interface at this time.
7056
- **
7057
- ** When the virtual-table mechanism stabilizes, we will declare the
7058
- ** interface fixed, support it indefinitely, and remove this comment.
7059
- */
7060
-
7061
7094
  /*
7062
7095
  ** Structures used by the virtual table interface
7063
7096
  */
@@ -7176,10 +7209,10 @@ struct sqlite3_module {
7176
7209
  ** when the omit flag is true there is no guarantee that the constraint will
7177
7210
  ** not be checked again using byte code.)^
7178
7211
  **
7179
- ** ^The idxNum and idxPtr values are recorded and passed into the
7212
+ ** ^The idxNum and idxStr values are recorded and passed into the
7180
7213
  ** [xFilter] method.
7181
- ** ^[sqlite3_free()] is used to free idxPtr if and only if
7182
- ** needToFreeIdxPtr is true.
7214
+ ** ^[sqlite3_free()] is used to free idxStr if and only if
7215
+ ** needToFreeIdxStr is true.
7183
7216
  **
7184
7217
  ** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
7185
7218
  ** the correct order to satisfy the ORDER BY clause so that no separate
@@ -7299,7 +7332,7 @@ struct sqlite3_index_info {
7299
7332
  ** the [sqlite3_vtab_collation()] interface. For most real-world virtual
7300
7333
  ** tables, the collating sequence of constraints does not matter (for example
7301
7334
  ** because the constraints are numeric) and so the sqlite3_vtab_collation()
7302
- ** interface is no commonly needed.
7335
+ ** interface is not commonly needed.
7303
7336
  */
7304
7337
  #define SQLITE_INDEX_CONSTRAINT_EQ 2
7305
7338
  #define SQLITE_INDEX_CONSTRAINT_GT 4
@@ -7458,16 +7491,6 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
7458
7491
  */
7459
7492
  SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
7460
7493
 
7461
- /*
7462
- ** The interface to the virtual-table mechanism defined above (back up
7463
- ** to a comment remarkably similar to this one) is currently considered
7464
- ** to be experimental. The interface might change in incompatible ways.
7465
- ** If this is a problem for you, do not use the interface at this time.
7466
- **
7467
- ** When the virtual-table mechanism stabilizes, we will declare the
7468
- ** interface fixed, support it indefinitely, and remove this comment.
7469
- */
7470
-
7471
7494
  /*
7472
7495
  ** CAPI3REF: A Handle To An Open BLOB
7473
7496
  ** KEYWORDS: {BLOB handle} {BLOB handles}
@@ -9671,7 +9694,7 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
9671
9694
  ** <li><p> Otherwise, "BINARY" is returned.
9672
9695
  ** </ol>
9673
9696
  */
9674
- SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9697
+ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9675
9698
 
9676
9699
  /*
9677
9700
  ** CAPI3REF: Determine if a virtual table query is DISTINCT
@@ -9828,21 +9851,20 @@ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
9828
9851
  ** is undefined and probably harmful.
9829
9852
  **
9830
9853
  ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
9831
- ** sqlite3_vtab_in_next(X,P) must be one of the parameters to the
9854
+ ** sqlite3_vtab_in_next(X,P) should be one of the parameters to the
9832
9855
  ** xFilter method which invokes these routines, and specifically
9833
9856
  ** a parameter that was previously selected for all-at-once IN constraint
9834
9857
  ** processing use the [sqlite3_vtab_in()] interface in the
9835
9858
  ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
9836
9859
  ** an xFilter argument that was selected for all-at-once IN constraint
9837
- ** processing, then these routines return [SQLITE_MISUSE])^ or perhaps
9838
- ** exhibit some other undefined or harmful behavior.
9860
+ ** processing, then these routines return [SQLITE_ERROR].)^
9839
9861
  **
9840
9862
  ** ^(Use these routines to access all values on the right-hand side
9841
9863
  ** of the IN constraint using code like the following:
9842
9864
  **
9843
9865
  ** <blockquote><pre>
9844
9866
  ** &nbsp; for(rc=sqlite3_vtab_in_first(pList, &pVal);
9845
- ** &nbsp; rc==SQLITE_OK && pVal
9867
+ ** &nbsp; rc==SQLITE_OK && pVal;
9846
9868
  ** &nbsp; rc=sqlite3_vtab_in_next(pList, &pVal)
9847
9869
  ** &nbsp; ){
9848
9870
  ** &nbsp; // do something with pVal
@@ -9940,6 +9962,10 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
9940
9962
  ** managed by the prepared statement S and will be automatically freed when
9941
9963
  ** S is finalized.
9942
9964
  **
9965
+ ** Not all values are available for all query elements. When a value is
9966
+ ** not available, the output variable is set to -1 if the value is numeric,
9967
+ ** or to NULL if it is a string (SQLITE_SCANSTAT_NAME).
9968
+ **
9943
9969
  ** <dl>
9944
9970
  ** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
9945
9971
  ** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be
@@ -9967,12 +9993,24 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
9967
9993
  ** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
9968
9994
  ** description for the X-th loop.
9969
9995
  **
9970
- ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
9996
+ ** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECTID</dt>
9971
9997
  ** <dd>^The "int" variable pointed to by the V parameter will be set to the
9972
- ** "select-id" for the X-th loop. The select-id identifies which query or
9973
- ** subquery the loop is part of. The main query has a select-id of zero.
9974
- ** The select-id is the same value as is output in the first column
9975
- ** of an [EXPLAIN QUERY PLAN] query.
9998
+ ** id for the X-th query plan element. The id value is unique within the
9999
+ ** statement. The select-id is the same value as is output in the first
10000
+ ** column of an [EXPLAIN QUERY PLAN] query.
10001
+ **
10002
+ ** [[SQLITE_SCANSTAT_PARENTID]] <dt>SQLITE_SCANSTAT_PARENTID</dt>
10003
+ ** <dd>The "int" variable pointed to by the V parameter will be set to the
10004
+ ** the id of the parent of the current query element, if applicable, or
10005
+ ** to zero if the query element has no parent. This is the same value as
10006
+ ** returned in the second column of an [EXPLAIN QUERY PLAN] query.
10007
+ **
10008
+ ** [[SQLITE_SCANSTAT_NCYCLE]] <dt>SQLITE_SCANSTAT_NCYCLE</dt>
10009
+ ** <dd>The sqlite3_int64 output value is set to the number of cycles,
10010
+ ** according to the processor time-stamp counter, that elapsed while the
10011
+ ** query element was being processed. This value is not available for
10012
+ ** all query elements - if it is unavailable the output variable is
10013
+ ** set to -1.
9976
10014
  ** </dl>
9977
10015
  */
9978
10016
  #define SQLITE_SCANSTAT_NLOOP 0
@@ -9981,12 +10019,14 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
9981
10019
  #define SQLITE_SCANSTAT_NAME 3
9982
10020
  #define SQLITE_SCANSTAT_EXPLAIN 4
9983
10021
  #define SQLITE_SCANSTAT_SELECTID 5
10022
+ #define SQLITE_SCANSTAT_PARENTID 6
10023
+ #define SQLITE_SCANSTAT_NCYCLE 7
9984
10024
 
9985
10025
  /*
9986
10026
  ** CAPI3REF: Prepared Statement Scan Status
9987
10027
  ** METHOD: sqlite3_stmt
9988
10028
  **
9989
- ** This interface returns information about the predicted and measured
10029
+ ** These interfaces return information about the predicted and measured
9990
10030
  ** performance for pStmt. Advanced applications can use this
9991
10031
  ** interface to compare the predicted and the measured performance and
9992
10032
  ** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
@@ -9997,19 +10037,25 @@ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **
9997
10037
  **
9998
10038
  ** The "iScanStatusOp" parameter determines which status information to return.
9999
10039
  ** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
10000
- ** of this interface is undefined.
10001
- ** ^The requested measurement is written into a variable pointed to by
10002
- ** the "pOut" parameter.
10003
- ** Parameter "idx" identifies the specific loop to retrieve statistics for.
10004
- ** Loops are numbered starting from zero. ^If idx is out of range - less than
10005
- ** zero or greater than or equal to the total number of loops used to implement
10006
- ** the statement - a non-zero value is returned and the variable that pOut
10007
- ** points to is unchanged.
10008
- **
10009
- ** ^Statistics might not be available for all loops in all statements. ^In cases
10010
- ** where there exist loops with no available statistics, this function behaves
10011
- ** as if the loop did not exist - it returns non-zero and leave the variable
10012
- ** that pOut points to unchanged.
10040
+ ** of this interface is undefined. ^The requested measurement is written into
10041
+ ** a variable pointed to by the "pOut" parameter.
10042
+ **
10043
+ ** The "flags" parameter must be passed a mask of flags. At present only
10044
+ ** one flag is defined - SQLITE_SCANSTAT_COMPLEX. If SQLITE_SCANSTAT_COMPLEX
10045
+ ** is specified, then status information is available for all elements
10046
+ ** of a query plan that are reported by "EXPLAIN QUERY PLAN" output. If
10047
+ ** SQLITE_SCANSTAT_COMPLEX is not specified, then only query plan elements
10048
+ ** that correspond to query loops (the "SCAN..." and "SEARCH..." elements of
10049
+ ** the EXPLAIN QUERY PLAN output) are available. Invoking API
10050
+ ** sqlite3_stmt_scanstatus() is equivalent to calling
10051
+ ** sqlite3_stmt_scanstatus_v2() with a zeroed flags parameter.
10052
+ **
10053
+ ** Parameter "idx" identifies the specific query element to retrieve statistics
10054
+ ** for. Query elements are numbered starting from zero. A value of -1 may be
10055
+ ** to query for statistics regarding the entire query. ^If idx is out of range
10056
+ ** - less than -1 or greater than or equal to the total number of query
10057
+ ** elements used to implement the statement - a non-zero value is returned and
10058
+ ** the variable that pOut points to is unchanged.
10013
10059
  **
10014
10060
  ** See also: [sqlite3_stmt_scanstatus_reset()]
10015
10061
  */
@@ -10019,6 +10065,19 @@ SQLITE_API int sqlite3_stmt_scanstatus(
10019
10065
  int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
10020
10066
  void *pOut /* Result written here */
10021
10067
  );
10068
+ SQLITE_API int sqlite3_stmt_scanstatus_v2(
10069
+ sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
10070
+ int idx, /* Index of loop to report on */
10071
+ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
10072
+ int flags, /* Mask of flags defined below */
10073
+ void *pOut /* Result written here */
10074
+ );
10075
+
10076
+ /*
10077
+ ** CAPI3REF: Prepared Statement Scan Status
10078
+ ** KEYWORDS: {scan status flags}
10079
+ */
10080
+ #define SQLITE_SCANSTAT_COMPLEX 0x0001
10022
10081
 
10023
10082
  /*
10024
10083
  ** CAPI3REF: Zero Scan-Status Counters
@@ -10109,6 +10168,10 @@ SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
10109
10168
  ** function is not defined for operations on WITHOUT ROWID tables, or for
10110
10169
  ** DELETE operations on rowid tables.
10111
10170
  **
10171
+ ** ^The sqlite3_preupdate_hook(D,C,P) function returns the P argument from
10172
+ ** the previous call on the same [database connection] D, or NULL for
10173
+ ** the first call on D.
10174
+ **
10112
10175
  ** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
10113
10176
  ** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
10114
10177
  ** provide additional information about a preupdate event. These routines
@@ -10514,6 +10577,19 @@ SQLITE_API int sqlite3_deserialize(
10514
10577
  # undef double
10515
10578
  #endif
10516
10579
 
10580
+ #if defined(__wasi__)
10581
+ # undef SQLITE_WASI
10582
+ # define SQLITE_WASI 1
10583
+ # undef SQLITE_OMIT_WAL
10584
+ # define SQLITE_OMIT_WAL 1/* because it requires shared memory APIs */
10585
+ # ifndef SQLITE_OMIT_LOAD_EXTENSION
10586
+ # define SQLITE_OMIT_LOAD_EXTENSION
10587
+ # endif
10588
+ # ifndef SQLITE_THREADSAFE
10589
+ # define SQLITE_THREADSAFE 0
10590
+ # endif
10591
+ #endif
10592
+
10517
10593
  #ifdef __cplusplus
10518
10594
  } /* End of the 'extern "C"' block */
10519
10595
  #endif
@@ -13232,7 +13308,7 @@ SQLITE_API int sqlite3mc_register_cipher(const CipherDescriptor* desc, const Cip
13232
13308
  ** Purpose: Header file for VFS of SQLite3 Multiple Ciphers support
13233
13309
  ** Author: Ulrich Telle
13234
13310
  ** Created: 2020-03-01
13235
- ** Copyright: (c) 2020 Ulrich Telle
13311
+ ** Copyright: (c) 2020-2023 Ulrich Telle
13236
13312
  ** License: MIT
13237
13313
  */
13238
13314
 
@@ -13242,6 +13318,11 @@ SQLITE_API int sqlite3mc_register_cipher(const CipherDescriptor* desc, const Cip
13242
13318
  extern "C" {
13243
13319
  #endif
13244
13320
 
13321
+ #ifndef SQLITE_PRIVATE
13322
+ #define SQLITE_PRIVATE
13323
+ #endif
13324
+ SQLITE_PRIVATE int sqlite3mcCheckVfs(const char* zVfs);
13325
+
13245
13326
  SQLITE_API int sqlite3mc_vfs_create(const char* zVfsReal, int makeDefault);
13246
13327
  SQLITE_API void sqlite3mc_vfs_destroy(const char* zName);
13247
13328
  SQLITE_API void sqlite3mc_vfs_shutdown();
@@ -359,6 +359,8 @@ struct sqlite3_api_routines {
359
359
  const char *(*db_name)(sqlite3*,int);
360
360
  /* Version 3.40.0 and later */
361
361
  int (*value_encoding)(sqlite3_value*);
362
+ /* Version 3.41.0 and later */
363
+ int (*is_interrupted)(sqlite3*);
362
364
  };
363
365
 
364
366
  /*
@@ -685,6 +687,8 @@ typedef int (*sqlite3_loadext_entry)(
685
687
  #define sqlite3_db_name sqlite3_api->db_name
686
688
  /* Version 3.40.0 and later */
687
689
  #define sqlite3_value_encoding sqlite3_api->value_encoding
690
+ /* Version 3.41.0 and later */
691
+ #define sqlite3_is_interrupted sqlite3_api->is_interrupted
688
692
  #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
689
693
 
690
694
  #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
package/lib/database.js CHANGED
@@ -76,6 +76,8 @@ Database.prototype.aggregate = require('./methods/aggregate');
76
76
  Database.prototype.table = require('./methods/table');
77
77
  Database.prototype.loadExtension = wrappers.loadExtension;
78
78
  Database.prototype.exec = wrappers.exec;
79
+ Database.prototype.key = wrappers.key;
80
+ Database.prototype.rekey = wrappers.rekey;
79
81
  Database.prototype.close = wrappers.close;
80
82
  Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
81
83
  Database.prototype.unsafeMode = wrappers.unsafeMode;
@@ -5,6 +5,16 @@ exports.prepare = function prepare(sql) {
5
5
  return this[cppdb].prepare(sql, this, false);
6
6
  };
7
7
 
8
+ exports.key = function key(key) {
9
+ if (!Buffer.isBuffer(key)) throw new TypeError('Expected first argument to be a Buffer');
10
+ return this[cppdb].key(key, key.length);
11
+ };
12
+
13
+ exports.rekey = function rekey(key) {
14
+ if (!Buffer.isBuffer(key)) throw new TypeError('Expected first argument to be a Buffer');
15
+ return this[cppdb].rekey(key, key.length);
16
+ };
17
+
8
18
  exports.exec = function exec(sql) {
9
19
  this[cppdb].exec(sql);
10
20
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "better-sqlite3 with multiple-cipher encryption support",
5
5
  "homepage": "https://github.com/m4heshd/better-sqlite3-multiple-ciphers",
6
6
  "author": "Mahesh Bandara Wijerathna (m4heshd) <m4heshd@gmail.com>",
@@ -44,6 +44,7 @@
44
44
  "rebuild-release": "npm run lzz && npm run build-release",
45
45
  "rebuild-debug": "npm run lzz && npm run build-debug",
46
46
  "test": "mocha --exit --slow=75 --timeout=30000",
47
+ "test:container": "docker-compose up --detach --build",
47
48
  "benchmark": "node benchmark",
48
49
  "download": "bash ./deps/download.sh",
49
50
  "setup": "powershell ./deps/setup.ps1",