better-sqlite3-multiple-ciphers 7.5.1-beta.0 → 7.5.1-beta.3

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-2021 Ulrich Telle
23
+ ** Copyright: (c) 2020-2022 Ulrich Telle
24
24
  ** License: MIT
25
25
  */
26
26
 
@@ -31,9 +31,9 @@
31
31
 
32
32
  #define SQLITE3MC_VERSION_MAJOR 1
33
33
  #define SQLITE3MC_VERSION_MINOR 3
34
- #define SQLITE3MC_VERSION_RELEASE 7
34
+ #define SQLITE3MC_VERSION_RELEASE 9
35
35
  #define SQLITE3MC_VERSION_SUBRELEASE 0
36
- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.3.7"
36
+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.3.9"
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.37.2"
196
- #define SQLITE_VERSION_NUMBER 3037002
197
- #define SQLITE_SOURCE_ID "2022-01-06 13:25:41 872ba256cbf61d9290b571c0e6d82a20c224ca3ad82971edc46b29818d5d17a0"
195
+ #define SQLITE_VERSION "3.38.1"
196
+ #define SQLITE_VERSION_NUMBER 3038001
197
+ #define SQLITE_SOURCE_ID "2022-03-12 13:37:29 38c210fdd258658321c85ec9c01a072fda3ada94540e3239d29b34dc547a8cbc"
198
198
 
199
199
  /*
200
200
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -612,7 +612,7 @@ SQLITE_API int sqlite3_exec(
612
612
  #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
613
613
  #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
614
614
  #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
615
- #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8))
615
+ #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */
616
616
 
617
617
  /*
618
618
  ** CAPI3REF: Flags For File Open Operations
@@ -3870,13 +3870,14 @@ SQLITE_API void sqlite3_free_filename(char*);
3870
3870
  ** sqlite3_extended_errcode() might change with each API call.
3871
3871
  ** Except, there are some interfaces that are guaranteed to never
3872
3872
  ** change the value of the error code. The error-code preserving
3873
- ** interfaces are:
3873
+ ** interfaces include the following:
3874
3874
  **
3875
3875
  ** <ul>
3876
3876
  ** <li> sqlite3_errcode()
3877
3877
  ** <li> sqlite3_extended_errcode()
3878
3878
  ** <li> sqlite3_errmsg()
3879
3879
  ** <li> sqlite3_errmsg16()
3880
+ ** <li> sqlite3_error_offset()
3880
3881
  ** </ul>
3881
3882
  **
3882
3883
  ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
@@ -3891,6 +3892,13 @@ SQLITE_API void sqlite3_free_filename(char*);
3891
3892
  ** ^(Memory to hold the error message string is managed internally
3892
3893
  ** and must not be freed by the application)^.
3893
3894
  **
3895
+ ** ^If the most recent error references a specific token in the input
3896
+ ** SQL, the sqlite3_error_offset() interface returns the byte offset
3897
+ ** of the start of that token. ^The byte offset returned by
3898
+ ** sqlite3_error_offset() assumes that the input SQL is UTF8.
3899
+ ** ^If the most recent error does not reference a specific token in the input
3900
+ ** SQL, then the sqlite3_error_offset() function returns -1.
3901
+ **
3894
3902
  ** When the serialized [threading mode] is in use, it might be the
3895
3903
  ** case that a second error occurs on a separate thread in between
3896
3904
  ** the time of the first error and the call to these interfaces.
@@ -3910,6 +3918,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
3910
3918
  SQLITE_API const char *sqlite3_errmsg(sqlite3*);
3911
3919
  SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
3912
3920
  SQLITE_API const char *sqlite3_errstr(int);
3921
+ SQLITE_API int sqlite3_error_offset(sqlite3 *db);
3913
3922
 
3914
3923
  /*
3915
3924
  ** CAPI3REF: Prepared Statement Object
@@ -4321,6 +4330,10 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
4321
4330
  ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a
4322
4331
  ** read-only no-op if the table already exists, but
4323
4332
  ** sqlite3_stmt_readonly() still returns false for such a statement.
4333
+ **
4334
+ ** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN]
4335
+ ** statement, then sqlite3_stmt_readonly(X) returns the same value as
4336
+ ** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted.
4324
4337
  */
4325
4338
  SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
4326
4339
 
@@ -4389,6 +4402,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
4389
4402
  **
4390
4403
  ** ^The sqlite3_value objects that are passed as parameters into the
4391
4404
  ** implementation of [application-defined SQL functions] are protected.
4405
+ ** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()]
4406
+ ** are protected.
4392
4407
  ** ^The sqlite3_value object returned by
4393
4408
  ** [sqlite3_column_value()] is unprotected.
4394
4409
  ** Unprotected sqlite3_value objects may only be used as arguments
@@ -5010,6 +5025,10 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
5010
5025
  ** even empty strings, are always zero-terminated. ^The return
5011
5026
  ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
5012
5027
  **
5028
+ ** ^Strings returned by sqlite3_column_text16() always have the endianness
5029
+ ** which is native to the platform, regardless of the text encoding set
5030
+ ** for the database.
5031
+ **
5013
5032
  ** <b>Warning:</b> ^The object returned by [sqlite3_column_value()] is an
5014
5033
  ** [unprotected sqlite3_value] object. In a multithreaded environment,
5015
5034
  ** an unprotected sqlite3_value object may only be used safely with
@@ -5023,7 +5042,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
5023
5042
  ** [application-defined SQL functions] or [virtual tables], not within
5024
5043
  ** top-level application code.
5025
5044
  **
5026
- ** The these routines may attempt to convert the datatype of the result.
5045
+ ** These routines may attempt to convert the datatype of the result.
5027
5046
  ** ^For example, if the internal representation is FLOAT and a text result
5028
5047
  ** is requested, [sqlite3_snprintf()] is used internally to perform the
5029
5048
  ** conversion automatically. ^(The following table details the conversions
@@ -5048,7 +5067,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
5048
5067
  ** <tr><td> TEXT <td> BLOB <td> No change
5049
5068
  ** <tr><td> BLOB <td> INTEGER <td> [CAST] to INTEGER
5050
5069
  ** <tr><td> BLOB <td> FLOAT <td> [CAST] to REAL
5051
- ** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed
5070
+ ** <tr><td> BLOB <td> TEXT <td> [CAST] to TEXT, ensure zero terminator
5052
5071
  ** </table>
5053
5072
  ** </blockquote>)^
5054
5073
  **
@@ -7168,24 +7187,56 @@ struct sqlite3_index_info {
7168
7187
  **
7169
7188
  ** These macros define the allowed values for the
7170
7189
  ** [sqlite3_index_info].aConstraint[].op field. Each value represents
7171
- ** an operator that is part of a constraint term in the wHERE clause of
7190
+ ** an operator that is part of a constraint term in the WHERE clause of
7172
7191
  ** a query that uses a [virtual table].
7173
- */
7174
- #define SQLITE_INDEX_CONSTRAINT_EQ 2
7175
- #define SQLITE_INDEX_CONSTRAINT_GT 4
7176
- #define SQLITE_INDEX_CONSTRAINT_LE 8
7177
- #define SQLITE_INDEX_CONSTRAINT_LT 16
7178
- #define SQLITE_INDEX_CONSTRAINT_GE 32
7179
- #define SQLITE_INDEX_CONSTRAINT_MATCH 64
7180
- #define SQLITE_INDEX_CONSTRAINT_LIKE 65
7181
- #define SQLITE_INDEX_CONSTRAINT_GLOB 66
7182
- #define SQLITE_INDEX_CONSTRAINT_REGEXP 67
7183
- #define SQLITE_INDEX_CONSTRAINT_NE 68
7184
- #define SQLITE_INDEX_CONSTRAINT_ISNOT 69
7185
- #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
7186
- #define SQLITE_INDEX_CONSTRAINT_ISNULL 71
7187
- #define SQLITE_INDEX_CONSTRAINT_IS 72
7188
- #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
7192
+ **
7193
+ ** ^The left-hand operand of the operator is given by the corresponding
7194
+ ** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand
7195
+ ** operand is the rowid.
7196
+ ** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET
7197
+ ** operators have no left-hand operand, and so for those operators the
7198
+ ** corresponding aConstraint[].iColumn is meaningless and should not be
7199
+ ** used.
7200
+ **
7201
+ ** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through
7202
+ ** value 255 are reserved to represent functions that are overloaded
7203
+ ** by the [xFindFunction|xFindFunction method] of the virtual table
7204
+ ** implementation.
7205
+ **
7206
+ ** The right-hand operands for each constraint might be accessible using
7207
+ ** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand
7208
+ ** operand is only available if it appears as a single constant literal
7209
+ ** in the input SQL. If the right-hand operand is another column or an
7210
+ ** expression (even a constant expression) or a parameter, then the
7211
+ ** sqlite3_vtab_rhs_value() probably will not be able to extract it.
7212
+ ** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and
7213
+ ** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand
7214
+ ** and hence calls to sqlite3_vtab_rhs_value() for those operators will
7215
+ ** always return SQLITE_NOTFOUND.
7216
+ **
7217
+ ** The collating sequence to be used for comparison can be found using
7218
+ ** the [sqlite3_vtab_collation()] interface. For most real-world virtual
7219
+ ** tables, the collating sequence of constraints does not matter (for example
7220
+ ** because the constraints are numeric) and so the sqlite3_vtab_collation()
7221
+ ** interface is no commonly needed.
7222
+ */
7223
+ #define SQLITE_INDEX_CONSTRAINT_EQ 2
7224
+ #define SQLITE_INDEX_CONSTRAINT_GT 4
7225
+ #define SQLITE_INDEX_CONSTRAINT_LE 8
7226
+ #define SQLITE_INDEX_CONSTRAINT_LT 16
7227
+ #define SQLITE_INDEX_CONSTRAINT_GE 32
7228
+ #define SQLITE_INDEX_CONSTRAINT_MATCH 64
7229
+ #define SQLITE_INDEX_CONSTRAINT_LIKE 65
7230
+ #define SQLITE_INDEX_CONSTRAINT_GLOB 66
7231
+ #define SQLITE_INDEX_CONSTRAINT_REGEXP 67
7232
+ #define SQLITE_INDEX_CONSTRAINT_NE 68
7233
+ #define SQLITE_INDEX_CONSTRAINT_ISNOT 69
7234
+ #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
7235
+ #define SQLITE_INDEX_CONSTRAINT_ISNULL 71
7236
+ #define SQLITE_INDEX_CONSTRAINT_IS 72
7237
+ #define SQLITE_INDEX_CONSTRAINT_LIMIT 73
7238
+ #define SQLITE_INDEX_CONSTRAINT_OFFSET 74
7239
+ #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
7189
7240
 
7190
7241
  /*
7191
7242
  ** CAPI3REF: Register A Virtual Table Implementation
@@ -7214,7 +7265,7 @@ struct sqlite3_index_info {
7214
7265
  ** destructor.
7215
7266
  **
7216
7267
  ** ^If the third parameter (the pointer to the sqlite3_module object) is
7217
- ** NULL then no new module is create and any existing modules with the
7268
+ ** NULL then no new module is created and any existing modules with the
7218
7269
  ** same name are dropped.
7219
7270
  **
7220
7271
  ** See also: [sqlite3_drop_modules()]
@@ -7990,7 +8041,8 @@ SQLITE_API int sqlite3_test_control(int op, ...);
7990
8041
  #define SQLITE_TESTCTRL_SEEK_COUNT 30
7991
8042
  #define SQLITE_TESTCTRL_TRACEFLAGS 31
7992
8043
  #define SQLITE_TESTCTRL_TUNE 32
7993
- #define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */
8044
+ #define SQLITE_TESTCTRL_LOGEST 33
8045
+ #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */
7994
8046
 
7995
8047
  /*
7996
8048
  ** CAPI3REF: SQL Keyword Checking
@@ -8513,6 +8565,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
8513
8565
  ** The counter is incremented on the first [sqlite3_step()] call of each
8514
8566
  ** cycle.
8515
8567
  **
8568
+ ** [[SQLITE_STMTSTATUS_FILTER_MISS]]
8569
+ ** [[SQLITE_STMTSTATUS_FILTER HIT]]
8570
+ ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br>
8571
+ ** SQLITE_STMTSTATUS_FILTER_MISS</dt>
8572
+ ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join
8573
+ ** step was bypassed because a Bloom filter returned not-found. The
8574
+ ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of
8575
+ ** times that the Bloom filter returned a find, and thus the join step
8576
+ ** had to be processed as normal.
8577
+ **
8516
8578
  ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
8517
8579
  ** <dd>^This is the approximate number of bytes of heap memory
8518
8580
  ** used to store the prepared statement. ^This value is not actually
@@ -8527,6 +8589,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
8527
8589
  #define SQLITE_STMTSTATUS_VM_STEP 4
8528
8590
  #define SQLITE_STMTSTATUS_REPREPARE 5
8529
8591
  #define SQLITE_STMTSTATUS_RUN 6
8592
+ #define SQLITE_STMTSTATUS_FILTER_MISS 7
8593
+ #define SQLITE_STMTSTATUS_FILTER_HIT 8
8530
8594
  #define SQLITE_STMTSTATUS_MEMUSED 99
8531
8595
 
8532
8596
  /*
@@ -9495,19 +9559,269 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
9495
9559
 
9496
9560
  /*
9497
9561
  ** CAPI3REF: Determine The Collation For a Virtual Table Constraint
9562
+ ** METHOD: sqlite3_index_info
9498
9563
  **
9499
9564
  ** This function may only be called from within a call to the [xBestIndex]
9500
- ** method of a [virtual table].
9565
+ ** method of a [virtual table]. This function returns a pointer to a string
9566
+ ** that is the name of the appropriate collation sequence to use for text
9567
+ ** comparisons on the constraint identified by its arguments.
9568
+ **
9569
+ ** The first argument must be the pointer to the [sqlite3_index_info] object
9570
+ ** that is the first parameter to the xBestIndex() method. The second argument
9571
+ ** must be an index into the aConstraint[] array belonging to the
9572
+ ** sqlite3_index_info structure passed to xBestIndex.
9573
+ **
9574
+ ** Important:
9575
+ ** The first parameter must be the same pointer that is passed into the
9576
+ ** xBestMethod() method. The first parameter may not be a pointer to a
9577
+ ** different [sqlite3_index_info] object, even an exact copy.
9578
+ **
9579
+ ** The return value is computed as follows:
9501
9580
  **
9502
- ** The first argument must be the sqlite3_index_info object that is the
9503
- ** first parameter to the xBestIndex() method. The second argument must be
9504
- ** an index into the aConstraint[] array belonging to the sqlite3_index_info
9505
- ** structure passed to xBestIndex. This function returns a pointer to a buffer
9506
- ** containing the name of the collation sequence for the corresponding
9507
- ** constraint.
9581
+ ** <ol>
9582
+ ** <li><p> If the constraint comes from a WHERE clause expression that contains
9583
+ ** a [COLLATE operator], then the name of the collation specified by
9584
+ ** that COLLATE operator is returned.
9585
+ ** <li><p> If there is no COLLATE operator, but the column that is the subject
9586
+ ** of the constraint specifies an alternative collating sequence via
9587
+ ** a [COLLATE clause] on the column definition within the CREATE TABLE
9588
+ ** statement that was passed into [sqlite3_declare_vtab()], then the
9589
+ ** name of that alternative collating sequence is returned.
9590
+ ** <li><p> Otherwise, "BINARY" is returned.
9591
+ ** </ol>
9508
9592
  */
9509
9593
  SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9510
9594
 
9595
+ /*
9596
+ ** CAPI3REF: Determine if a virtual table query is DISTINCT
9597
+ ** METHOD: sqlite3_index_info
9598
+ **
9599
+ ** This API may only be used from within an [xBestIndex|xBestIndex method]
9600
+ ** of a [virtual table] implementation. The result of calling this
9601
+ ** interface from outside of xBestIndex() is undefined and probably harmful.
9602
+ **
9603
+ ** ^The sqlite3_vtab_distinct() interface returns an integer that is
9604
+ ** either 0, 1, or 2. The integer returned by sqlite3_vtab_distinct()
9605
+ ** gives the virtual table additional information about how the query
9606
+ ** planner wants the output to be ordered. As long as the virtual table
9607
+ ** can meet the ordering requirements of the query planner, it may set
9608
+ ** the "orderByConsumed" flag.
9609
+ **
9610
+ ** <ol><li value="0"><p>
9611
+ ** ^If the sqlite3_vtab_distinct() interface returns 0, that means
9612
+ ** that the query planner needs the virtual table to return all rows in the
9613
+ ** sort order defined by the "nOrderBy" and "aOrderBy" fields of the
9614
+ ** [sqlite3_index_info] object. This is the default expectation. If the
9615
+ ** virtual table outputs all rows in sorted order, then it is always safe for
9616
+ ** the xBestIndex method to set the "orderByConsumed" flag, regardless of
9617
+ ** the return value from sqlite3_vtab_distinct().
9618
+ ** <li value="1"><p>
9619
+ ** ^(If the sqlite3_vtab_distinct() interface returns 1, that means
9620
+ ** that the query planner does not need the rows to be returned in sorted order
9621
+ ** as long as all rows with the same values in all columns identified by the
9622
+ ** "aOrderBy" field are adjacent.)^ This mode is used when the query planner
9623
+ ** is doing a GROUP BY.
9624
+ ** <li value="2"><p>
9625
+ ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
9626
+ ** that the query planner does not need the rows returned in any particular
9627
+ ** order, as long as rows with the same values in all "aOrderBy" columns
9628
+ ** are adjacent.)^ ^(Furthermore, only a single row for each particular
9629
+ ** combination of values in the columns identified by the "aOrderBy" field
9630
+ ** needs to be returned.)^ ^It is always ok for two or more rows with the same
9631
+ ** values in all "aOrderBy" columns to be returned, as long as all such rows
9632
+ ** are adjacent. ^The virtual table may, if it chooses, omit extra rows
9633
+ ** that have the same value for all columns identified by "aOrderBy".
9634
+ ** ^However omitting the extra rows is optional.
9635
+ ** This mode is used for a DISTINCT query.
9636
+ ** </ol>
9637
+ **
9638
+ ** ^For the purposes of comparing virtual table output values to see if the
9639
+ ** values are same value for sorting purposes, two NULL values are considered
9640
+ ** to be the same. In other words, the comparison operator is "IS"
9641
+ ** (or "IS NOT DISTINCT FROM") and not "==".
9642
+ **
9643
+ ** If a virtual table implementation is unable to meet the requirements
9644
+ ** specified above, then it must not set the "orderByConsumed" flag in the
9645
+ ** [sqlite3_index_info] object or an incorrect answer may result.
9646
+ **
9647
+ ** ^A virtual table implementation is always free to return rows in any order
9648
+ ** it wants, as long as the "orderByConsumed" flag is not set. ^When the
9649
+ ** the "orderByConsumed" flag is unset, the query planner will add extra
9650
+ ** [bytecode] to ensure that the final results returned by the SQL query are
9651
+ ** ordered correctly. The use of the "orderByConsumed" flag and the
9652
+ ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful
9653
+ ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed"
9654
+ ** flag might help queries against a virtual table to run faster. Being
9655
+ ** overly aggressive and setting the "orderByConsumed" flag when it is not
9656
+ ** valid to do so, on the other hand, might cause SQLite to return incorrect
9657
+ ** results.
9658
+ */
9659
+ SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*);
9660
+
9661
+ /*
9662
+ ** CAPI3REF: Identify and handle IN constraints in xBestIndex
9663
+ **
9664
+ ** This interface may only be used from within an
9665
+ ** [xBestIndex|xBestIndex() method] of a [virtual table] implementation.
9666
+ ** The result of invoking this interface from any other context is
9667
+ ** undefined and probably harmful.
9668
+ **
9669
+ ** ^(A constraint on a virtual table of the form
9670
+ ** "[IN operator|column IN (...)]" is
9671
+ ** communicated to the xBestIndex method as a
9672
+ ** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use
9673
+ ** this constraint, it must set the corresponding
9674
+ ** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under
9675
+ ** the usual mode of handling IN operators, SQLite generates [bytecode]
9676
+ ** that invokes the [xFilter|xFilter() method] once for each value
9677
+ ** on the right-hand side of the IN operator.)^ Thus the virtual table
9678
+ ** only sees a single value from the right-hand side of the IN operator
9679
+ ** at a time.
9680
+ **
9681
+ ** In some cases, however, it would be advantageous for the virtual
9682
+ ** table to see all values on the right-hand of the IN operator all at
9683
+ ** once. The sqlite3_vtab_in() interfaces facilitates this in two ways:
9684
+ **
9685
+ ** <ol>
9686
+ ** <li><p>
9687
+ ** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero)
9688
+ ** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint
9689
+ ** is an [IN operator] that can be processed all at once. ^In other words,
9690
+ ** sqlite3_vtab_in() with -1 in the third argument is a mechanism
9691
+ ** by which the virtual table can ask SQLite if all-at-once processing
9692
+ ** of the IN operator is even possible.
9693
+ **
9694
+ ** <li><p>
9695
+ ** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates
9696
+ ** to SQLite that the virtual table does or does not want to process
9697
+ ** the IN operator all-at-once, respectively. ^Thus when the third
9698
+ ** parameter (F) is non-negative, this interface is the mechanism by
9699
+ ** which the virtual table tells SQLite how it wants to process the
9700
+ ** IN operator.
9701
+ ** </ol>
9702
+ **
9703
+ ** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times
9704
+ ** within the same xBestIndex method call. ^For any given P,N pair,
9705
+ ** the return value from sqlite3_vtab_in(P,N,F) will always be the same
9706
+ ** within the same xBestIndex call. ^If the interface returns true
9707
+ ** (non-zero), that means that the constraint is an IN operator
9708
+ ** that can be processed all-at-once. ^If the constraint is not an IN
9709
+ ** operator or cannot be processed all-at-once, then the interface returns
9710
+ ** false.
9711
+ **
9712
+ ** ^(All-at-once processing of the IN operator is selected if both of the
9713
+ ** following conditions are met:
9714
+ **
9715
+ ** <ol>
9716
+ ** <li><p> The P->aConstraintUsage[N].argvIndex value is set to a positive
9717
+ ** integer. This is how the virtual table tells SQLite that it wants to
9718
+ ** use the N-th constraint.
9719
+ **
9720
+ ** <li><p> The last call to sqlite3_vtab_in(P,N,F) for which F was
9721
+ ** non-negative had F>=1.
9722
+ ** </ol>)^
9723
+ **
9724
+ ** ^If either or both of the conditions above are false, then SQLite uses
9725
+ ** the traditional one-at-a-time processing strategy for the IN constraint.
9726
+ ** ^If both conditions are true, then the argvIndex-th parameter to the
9727
+ ** xFilter method will be an [sqlite3_value] that appears to be NULL,
9728
+ ** but which can be passed to [sqlite3_vtab_in_first()] and
9729
+ ** [sqlite3_vtab_in_next()] to find all values on the right-hand side
9730
+ ** of the IN constraint.
9731
+ */
9732
+ SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle);
9733
+
9734
+ /*
9735
+ ** CAPI3REF: Find all elements on the right-hand side of an IN constraint.
9736
+ **
9737
+ ** These interfaces are only useful from within the
9738
+ ** [xFilter|xFilter() method] of a [virtual table] implementation.
9739
+ ** The result of invoking these interfaces from any other context
9740
+ ** is undefined and probably harmful.
9741
+ **
9742
+ ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or
9743
+ ** sqlite3_vtab_in_next(X,P) must be one of the parameters to the
9744
+ ** xFilter method which invokes these routines, and specifically
9745
+ ** a parameter that was previously selected for all-at-once IN constraint
9746
+ ** processing use the [sqlite3_vtab_in()] interface in the
9747
+ ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not
9748
+ ** an xFilter argument that was selected for all-at-once IN constraint
9749
+ ** processing, then these routines return [SQLITE_MISUSE])^ or perhaps
9750
+ ** exhibit some other undefined or harmful behavior.
9751
+ **
9752
+ ** ^(Use these routines to access all values on the right-hand side
9753
+ ** of the IN constraint using code like the following:
9754
+ **
9755
+ ** <blockquote><pre>
9756
+ ** &nbsp; for(rc=sqlite3_vtab_in_first(pList, &pVal);
9757
+ ** &nbsp; rc==SQLITE_OK && pVal
9758
+ ** &nbsp; rc=sqlite3_vtab_in_next(pList, &pVal)
9759
+ ** &nbsp; ){
9760
+ ** &nbsp; // do something with pVal
9761
+ ** &nbsp; }
9762
+ ** &nbsp; if( rc!=SQLITE_OK ){
9763
+ ** &nbsp; // an error has occurred
9764
+ ** &nbsp; }
9765
+ ** </pre></blockquote>)^
9766
+ **
9767
+ ** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P)
9768
+ ** routines return SQLITE_OK and set *P to point to the first or next value
9769
+ ** on the RHS of the IN constraint. ^If there are no more values on the
9770
+ ** right hand side of the IN constraint, then *P is set to NULL and these
9771
+ ** routines return [SQLITE_DONE]. ^The return value might be
9772
+ ** some other value, such as SQLITE_NOMEM, in the event of a malfunction.
9773
+ **
9774
+ ** The *ppOut values returned by these routines are only valid until the
9775
+ ** next call to either of these routines or until the end of the xFilter
9776
+ ** method from which these routines were called. If the virtual table
9777
+ ** implementation needs to retain the *ppOut values for longer, it must make
9778
+ ** copies. The *ppOut values are [protected sqlite3_value|protected].
9779
+ */
9780
+ SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut);
9781
+ SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut);
9782
+
9783
+ /*
9784
+ ** CAPI3REF: Constraint values in xBestIndex()
9785
+ ** METHOD: sqlite3_index_info
9786
+ **
9787
+ ** This API may only be used from within the [xBestIndex|xBestIndex method]
9788
+ ** of a [virtual table] implementation. The result of calling this interface
9789
+ ** from outside of an xBestIndex method are undefined and probably harmful.
9790
+ **
9791
+ ** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within
9792
+ ** the [xBestIndex] method of a [virtual table] implementation, with P being
9793
+ ** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and
9794
+ ** J being a 0-based index into P->aConstraint[], then this routine
9795
+ ** attempts to set *V to the value of the right-hand operand of
9796
+ ** that constraint if the right-hand operand is known. ^If the
9797
+ ** right-hand operand is not known, then *V is set to a NULL pointer.
9798
+ ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if
9799
+ ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V)
9800
+ ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th
9801
+ ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface
9802
+ ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if
9803
+ ** something goes wrong.
9804
+ **
9805
+ ** The sqlite3_vtab_rhs_value() interface is usually only successful if
9806
+ ** the right-hand operand of a constraint is a literal value in the original
9807
+ ** SQL statement. If the right-hand operand is an expression or a reference
9808
+ ** to some other column or a [host parameter], then sqlite3_vtab_rhs_value()
9809
+ ** will probably return [SQLITE_NOTFOUND].
9810
+ **
9811
+ ** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and
9812
+ ** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such
9813
+ ** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^
9814
+ **
9815
+ ** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value
9816
+ ** and remains valid for the duration of the xBestIndex method call.
9817
+ ** ^When xBestIndex returns, the sqlite3_value object returned by
9818
+ ** sqlite3_vtab_rhs_value() is automatically deallocated.
9819
+ **
9820
+ ** The "_rhs_" in the name of this routine is an abbreviation for
9821
+ ** "Right-Hand Side".
9822
+ */
9823
+ SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal);
9824
+
9511
9825
  /*
9512
9826
  ** CAPI3REF: Conflict resolution modes
9513
9827
  ** KEYWORDS: {conflict resolution mode}
@@ -344,6 +344,13 @@ struct sqlite3_api_routines {
344
344
  int (*autovacuum_pages)(sqlite3*,
345
345
  unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
346
346
  void*, void(*)(void*));
347
+ /* Version 3.38.0 and later */
348
+ int (*error_offset)(sqlite3*);
349
+ int (*vtab_rhs_value)(sqlite3_index_info*,int,sqlite3_value**);
350
+ int (*vtab_distinct)(sqlite3_index_info*);
351
+ int (*vtab_in)(sqlite3_index_info*,int,int);
352
+ int (*vtab_in_first)(sqlite3_value*,sqlite3_value**);
353
+ int (*vtab_in_next)(sqlite3_value*,sqlite3_value**);
347
354
  };
348
355
 
349
356
  /*
@@ -655,6 +662,13 @@ typedef int (*sqlite3_loadext_entry)(
655
662
  #define sqlite3_total_changes64 sqlite3_api->total_changes64
656
663
  /* Version 3.37.0 and later */
657
664
  #define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages
665
+ /* Version 3.38.0 and later */
666
+ #define sqlite3_error_offset sqlite3_api->error_offset
667
+ #define sqlite3_vtab_rhs_value sqlite3_api->vtab_rhs_value
668
+ #define sqlite3_vtab_distinct sqlite3_api->vtab_distinct
669
+ #define sqlite3_vtab_in sqlite3_api->vtab_in
670
+ #define sqlite3_vtab_in_first sqlite3_api->vtab_in_first
671
+ #define sqlite3_vtab_in_next sqlite3_api->vtab_in_next
658
672
  #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
659
673
 
660
674
  #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-sqlite3-multiple-ciphers",
3
- "version": "7.5.1-beta.0",
3
+ "version": "7.5.1-beta.3",
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>",