@op-engineering/op-sqlite 9.1.3 → 9.2.1

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.
@@ -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.44.2"
150
- #define SQLITE_VERSION_NUMBER 3044002
151
- #define SQLITE_SOURCE_ID "2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf9alt1"
149
+ #define SQLITE_VERSION "3.46.1"
150
+ #define SQLITE_VERSION_NUMBER 3046001
151
+ #define SQLITE_SOURCE_ID "2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69aalt1"
152
152
 
153
153
  /*
154
154
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -420,6 +420,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
420
420
  ** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
421
421
  ** <li> The application must not modify the SQL statement text passed into
422
422
  ** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
423
+ ** <li> The application must not dereference the arrays or string pointers
424
+ ** passed as the 3rd and 4th callback parameters after it returns.
423
425
  ** </ul>
424
426
  */
425
427
  SQLITE_API int sqlite3_exec(
@@ -762,11 +764,11 @@ struct sqlite3_file {
762
764
  ** </ul>
763
765
  ** xLock() upgrades the database file lock. In other words, xLock() moves the
764
766
  ** database file lock in the direction NONE toward EXCLUSIVE. The argument to
765
- ** xLock() is always on of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
767
+ ** xLock() is always one of SHARED, RESERVED, PENDING, or EXCLUSIVE, never
766
768
  ** SQLITE_LOCK_NONE. If the database file lock is already at or above the
767
769
  ** requested lock, then the call to xLock() is a no-op.
768
770
  ** xUnlock() downgrades the database file lock to either SHARED or NONE.
769
- * If the lock is already at or below the requested lock state, then the call
771
+ ** If the lock is already at or below the requested lock state, then the call
770
772
  ** to xUnlock() is a no-op.
771
773
  ** The xCheckReservedLock() method checks whether any database connection,
772
774
  ** either in this process or in some other process, is holding a RESERVED,
@@ -2141,6 +2143,22 @@ struct sqlite3_mem_methods {
2141
2143
  ** configuration setting is never used, then the default maximum is determined
2142
2144
  ** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
2143
2145
  ** compile-time option is not set, then the default maximum is 1073741824.
2146
+ **
2147
+ ** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
2148
+ ** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
2149
+ ** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
2150
+ ** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
2151
+ ** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
2152
+ ** defaults to on. This configuration option queries the current setting or
2153
+ ** changes the setting to off or on. The argument is a pointer to an integer.
2154
+ ** If that integer initially holds a value of 1, then the ability for VIEWs to
2155
+ ** have ROWIDs is activated. If the integer initially holds zero, then the
2156
+ ** ability is deactivated. Any other initial value for the integer leaves the
2157
+ ** setting unchanged. After changes, if any, the integer is written with
2158
+ ** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
2159
+ ** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
2160
+ ** recommended case) then the integer is always filled with zero, regardless
2161
+ ** if its initial value.
2144
2162
  ** </dl>
2145
2163
  */
2146
2164
  #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -2172,6 +2190,7 @@ struct sqlite3_mem_methods {
2172
2190
  #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
2173
2191
  #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
2174
2192
  #define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
2193
+ #define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
2175
2194
 
2176
2195
  /*
2177
2196
  ** CAPI3REF: Database Connection Configuration Options
@@ -3286,8 +3305,8 @@ SQLITE_API int sqlite3_set_authorizer(
3286
3305
  #define SQLITE_RECURSIVE 33 /* NULL NULL */
3287
3306
 
3288
3307
  /*
3289
- ** CAPI3REF: Tracing And Profiling Functions
3290
- ** METHOD: sqlite3
3308
+ ** CAPI3REF: Deprecated Tracing And Profiling Functions
3309
+ ** DEPRECATED
3291
3310
  **
3292
3311
  ** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
3293
3312
  ** instead of the routines described here.
@@ -3954,15 +3973,17 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
3954
3973
  ** </ul>
3955
3974
  **
3956
3975
  ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
3957
- ** text that describes the error, as either UTF-8 or UTF-16 respectively.
3976
+ ** text that describes the error, as either UTF-8 or UTF-16 respectively,
3977
+ ** or NULL if no error message is available.
3958
3978
  ** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
3959
3979
  ** ^(Memory to hold the error message string is managed internally.
3960
3980
  ** The application does not need to worry about freeing the result.
3961
3981
  ** However, the error string might be overwritten or deallocated by
3962
3982
  ** subsequent calls to other SQLite interface functions.)^
3963
3983
  **
3964
- ** ^The sqlite3_errstr() interface returns the English-language text
3965
- ** that describes the [result code], as UTF-8.
3984
+ ** ^The sqlite3_errstr(E) interface returns the English-language text
3985
+ ** that describes the [result code] E, as UTF-8, or NULL if E is not an
3986
+ ** result code for which a text error message is available.
3966
3987
  ** ^(Memory to hold the error message string is managed internally
3967
3988
  ** and must not be freed by the application)^.
3968
3989
  **
@@ -6926,6 +6947,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
6926
6947
  ** The exceptions defined in this paragraph might change in a future
6927
6948
  ** release of SQLite.
6928
6949
  **
6950
+ ** Whether the update hook is invoked before or after the
6951
+ ** corresponding change is currently unspecified and may differ
6952
+ ** depending on the type of change. Do not rely on the order of the
6953
+ ** hook call with regards to the final result of the operation which
6954
+ ** triggers the hook.
6955
+ **
6929
6956
  ** The update hook implementation must not do anything that will modify
6930
6957
  ** the database connection that invoked the update hook. Any actions
6931
6958
  ** to modify the database connection must be deferred until after the
@@ -8097,9 +8124,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
8097
8124
  **
8098
8125
  ** ^(Some systems (for example, Windows 95) do not support the operation
8099
8126
  ** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
8100
- ** will always return SQLITE_BUSY. The SQLite core only ever uses
8101
- ** sqlite3_mutex_try() as an optimization so this is acceptable
8102
- ** behavior.)^
8127
+ ** will always return SQLITE_BUSY. In most cases the SQLite core only uses
8128
+ ** sqlite3_mutex_try() as an optimization, so this is acceptable
8129
+ ** behavior. The exceptions are unix builds that set the
8130
+ ** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
8131
+ ** sqlite3_mutex_try() is required.)^
8103
8132
  **
8104
8133
  ** ^The sqlite3_mutex_leave() routine exits a mutex that was
8105
8134
  ** previously entered by the same thread. The behavior
@@ -8358,6 +8387,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8358
8387
  #define SQLITE_TESTCTRL_ASSERT 12
8359
8388
  #define SQLITE_TESTCTRL_ALWAYS 13
8360
8389
  #define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
8390
+ #define SQLITE_TESTCTRL_JSON_SELFCHECK 14
8361
8391
  #define SQLITE_TESTCTRL_OPTIMIZATIONS 15
8362
8392
  #define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
8363
8393
  #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
@@ -8393,7 +8423,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8393
8423
  ** The sqlite3_keyword_count() interface returns the number of distinct
8394
8424
  ** keywords understood by SQLite.
8395
8425
  **
8396
- ** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
8426
+ ** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
8397
8427
  ** makes *Z point to that keyword expressed as UTF8 and writes the number
8398
8428
  ** of bytes in the keyword into *L. The string that *Z points to is not
8399
8429
  ** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
@@ -9972,24 +10002,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9972
10002
  ** <li value="2"><p>
9973
10003
  ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
9974
10004
  ** that the query planner does not need the rows returned in any particular
9975
- ** order, as long as rows with the same values in all "aOrderBy" columns
9976
- ** are adjacent.)^ ^(Furthermore, only a single row for each particular
9977
- ** combination of values in the columns identified by the "aOrderBy" field
9978
- ** needs to be returned.)^ ^It is always ok for two or more rows with the same
9979
- ** values in all "aOrderBy" columns to be returned, as long as all such rows
9980
- ** are adjacent. ^The virtual table may, if it chooses, omit extra rows
9981
- ** that have the same value for all columns identified by "aOrderBy".
9982
- ** ^However omitting the extra rows is optional.
10005
+ ** order, as long as rows with the same values in all columns identified
10006
+ ** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
10007
+ ** contain the same values for all columns identified by "colUsed", all but
10008
+ ** one such row may optionally be omitted from the result.)^
10009
+ ** The virtual table is not required to omit rows that are duplicates
10010
+ ** over the "colUsed" columns, but if the virtual table can do that without
10011
+ ** too much extra effort, it could potentially help the query to run faster.
9983
10012
  ** This mode is used for a DISTINCT query.
9984
10013
  ** <li value="3"><p>
9985
- ** ^(If the sqlite3_vtab_distinct() interface returns 3, that means
9986
- ** that the query planner needs only distinct rows but it does need the
9987
- ** rows to be sorted.)^ ^The virtual table implementation is free to omit
9988
- ** rows that are identical in all aOrderBy columns, if it wants to, but
9989
- ** it is not required to omit any rows. This mode is used for queries
10014
+ ** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
10015
+ ** virtual table must return rows in the order defined by "aOrderBy" as
10016
+ ** if the sqlite3_vtab_distinct() interface had returned 0. However if
10017
+ ** two or more rows in the result have the same values for all columns
10018
+ ** identified by "colUsed", then all but one such row may optionally be
10019
+ ** omitted.)^ Like when the return value is 2, the virtual table
10020
+ ** is not required to omit rows that are duplicates over the "colUsed"
10021
+ ** columns, but if the virtual table can do that without
10022
+ ** too much extra effort, it could potentially help the query to run faster.
10023
+ ** This mode is used for queries
9990
10024
  ** that have both DISTINCT and ORDER BY clauses.
9991
10025
  ** </ol>
9992
10026
  **
10027
+ ** <p>The following table summarizes the conditions under which the
10028
+ ** virtual table is allowed to set the "orderByConsumed" flag based on
10029
+ ** the value returned by sqlite3_vtab_distinct(). This table is a
10030
+ ** restatement of the previous four paragraphs:
10031
+ **
10032
+ ** <table border=1 cellspacing=0 cellpadding=10 width="90%">
10033
+ ** <tr>
10034
+ ** <td valign="top">sqlite3_vtab_distinct() return value
10035
+ ** <td valign="top">Rows are returned in aOrderBy order
10036
+ ** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
10037
+ ** <td valign="top">Duplicates over all colUsed columns may be omitted
10038
+ ** <tr><td>0<td>yes<td>yes<td>no
10039
+ ** <tr><td>1<td>no<td>yes<td>no
10040
+ ** <tr><td>2<td>no<td>yes<td>yes
10041
+ ** <tr><td>3<td>yes<td>yes<td>yes
10042
+ ** </table>
10043
+ **
9993
10044
  ** ^For the purposes of comparing virtual table output values to see if the
9994
10045
  ** values are same value for sorting purposes, two NULL values are considered
9995
10046
  ** to be the same. In other words, the comparison operator is "IS"
@@ -12034,6 +12085,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c
12034
12085
  */
12035
12086
  SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
12036
12087
 
12088
+ /*
12089
+ ** CAPI3REF: Add A Single Change To A Changegroup
12090
+ ** METHOD: sqlite3_changegroup
12091
+ **
12092
+ ** This function adds the single change currently indicated by the iterator
12093
+ ** passed as the second argument to the changegroup object. The rules for
12094
+ ** adding the change are just as described for [sqlite3changegroup_add()].
12095
+ **
12096
+ ** If the change is successfully added to the changegroup, SQLITE_OK is
12097
+ ** returned. Otherwise, an SQLite error code is returned.
12098
+ **
12099
+ ** The iterator must point to a valid entry when this function is called.
12100
+ ** If it does not, SQLITE_ERROR is returned and no change is added to the
12101
+ ** changegroup. Additionally, the iterator must not have been opened with
12102
+ ** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
12103
+ ** returned.
12104
+ */
12105
+ SQLITE_API int sqlite3changegroup_add_change(
12106
+ sqlite3_changegroup*,
12107
+ sqlite3_changeset_iter*
12108
+ );
12109
+
12110
+
12111
+
12037
12112
  /*
12038
12113
  ** CAPI3REF: Obtain A Composite Changeset From A Changegroup
12039
12114
  ** METHOD: sqlite3_changegroup
@@ -12838,8 +12913,8 @@ struct Fts5PhraseIter {
12838
12913
  ** EXTENSION API FUNCTIONS
12839
12914
  **
12840
12915
  ** xUserData(pFts):
12841
- ** Return a copy of the context pointer the extension function was
12842
- ** registered with.
12916
+ ** Return a copy of the pUserData pointer passed to the xCreateFunction()
12917
+ ** API when the extension function was registered.
12843
12918
  **
12844
12919
  ** xColumnTotalSize(pFts, iCol, pnToken):
12845
12920
  ** If parameter iCol is less than zero, set output variable *pnToken
@@ -12871,8 +12946,11 @@ struct Fts5PhraseIter {
12871
12946
  ** created with the "columnsize=0" option.
12872
12947
  **
12873
12948
  ** xColumnText:
12874
- ** This function attempts to retrieve the text of column iCol of the
12875
- ** current document. If successful, (*pz) is set to point to a buffer
12949
+ ** If parameter iCol is less than zero, or greater than or equal to the
12950
+ ** number of columns in the table, SQLITE_RANGE is returned.
12951
+ **
12952
+ ** Otherwise, this function attempts to retrieve the text of column iCol of
12953
+ ** the current document. If successful, (*pz) is set to point to a buffer
12876
12954
  ** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
12877
12955
  ** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
12878
12956
  ** if an error occurs, an SQLite error code is returned and the final values
@@ -12882,8 +12960,10 @@ struct Fts5PhraseIter {
12882
12960
  ** Returns the number of phrases in the current query expression.
12883
12961
  **
12884
12962
  ** xPhraseSize:
12885
- ** Returns the number of tokens in phrase iPhrase of the query. Phrases
12886
- ** are numbered starting from zero.
12963
+ ** If parameter iCol is less than zero, or greater than or equal to the
12964
+ ** number of phrases in the current query, as returned by xPhraseCount,
12965
+ ** 0 is returned. Otherwise, this function returns the number of tokens in
12966
+ ** phrase iPhrase of the query. Phrases are numbered starting from zero.
12887
12967
  **
12888
12968
  ** xInstCount:
12889
12969
  ** Set *pnInst to the total number of occurrences of all phrases within
@@ -12899,12 +12979,13 @@ struct Fts5PhraseIter {
12899
12979
  ** Query for the details of phrase match iIdx within the current row.
12900
12980
  ** Phrase matches are numbered starting from zero, so the iIdx argument
12901
12981
  ** should be greater than or equal to zero and smaller than the value
12902
- ** output by xInstCount().
12982
+ ** output by xInstCount(). If iIdx is less than zero or greater than
12983
+ ** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
12903
12984
  **
12904
- ** Usually, output parameter *piPhrase is set to the phrase number, *piCol
12985
+ ** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
12905
12986
  ** to the column in which it occurs and *piOff the token offset of the
12906
- ** first token of the phrase. Returns SQLITE_OK if successful, or an error
12907
- ** code (i.e. SQLITE_NOMEM) if an error occurs.
12987
+ ** first token of the phrase. SQLITE_OK is returned if successful, or an
12988
+ ** error code (i.e. SQLITE_NOMEM) if an error occurs.
12908
12989
  **
12909
12990
  ** This API can be quite slow if used with an FTS5 table created with the
12910
12991
  ** "detail=none" or "detail=column" option.
@@ -12930,6 +13011,10 @@ struct Fts5PhraseIter {
12930
13011
  ** Invoking Api.xUserData() returns a copy of the pointer passed as
12931
13012
  ** the third argument to pUserData.
12932
13013
  **
13014
+ ** If parameter iPhrase is less than zero, or greater than or equal to
13015
+ ** the number of phrases in the query, as returned by xPhraseCount(),
13016
+ ** this function returns SQLITE_RANGE.
13017
+ **
12933
13018
  ** If the callback function returns any value other than SQLITE_OK, the
12934
13019
  ** query is abandoned and the xQueryPhrase function returns immediately.
12935
13020
  ** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
@@ -13044,9 +13129,42 @@ struct Fts5PhraseIter {
13044
13129
  **
13045
13130
  ** xPhraseNextColumn()
13046
13131
  ** See xPhraseFirstColumn above.
13132
+ **
13133
+ ** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
13134
+ ** This is used to access token iToken of phrase iPhrase of the current
13135
+ ** query. Before returning, output parameter *ppToken is set to point
13136
+ ** to a buffer containing the requested token, and *pnToken to the
13137
+ ** size of this buffer in bytes.
13138
+ **
13139
+ ** If iPhrase or iToken are less than zero, or if iPhrase is greater than
13140
+ ** or equal to the number of phrases in the query as reported by
13141
+ ** xPhraseCount(), or if iToken is equal to or greater than the number of
13142
+ ** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
13143
+ are both zeroed.
13144
+ **
13145
+ ** The output text is not a copy of the query text that specified the
13146
+ ** token. It is the output of the tokenizer module. For tokendata=1
13147
+ ** tables, this includes any embedded 0x00 and trailing data.
13148
+ **
13149
+ ** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
13150
+ ** This is used to access token iToken of phrase hit iIdx within the
13151
+ ** current row. If iIdx is less than zero or greater than or equal to the
13152
+ ** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
13153
+ ** output variable (*ppToken) is set to point to a buffer containing the
13154
+ ** matching document token, and (*pnToken) to the size of that buffer in
13155
+ ** bytes. This API is not available if the specified token matches a
13156
+ ** prefix query term. In that case both output variables are always set
13157
+ ** to 0.
13158
+ **
13159
+ ** The output text is not a copy of the document text that was tokenized.
13160
+ ** It is the output of the tokenizer module. For tokendata=1 tables, this
13161
+ ** includes any embedded 0x00 and trailing data.
13162
+ **
13163
+ ** This API can be quite slow if used with an FTS5 table created with the
13164
+ ** "detail=none" or "detail=column" option.
13047
13165
  */
13048
13166
  struct Fts5ExtensionApi {
13049
- int iVersion; /* Currently always set to 2 */
13167
+ int iVersion; /* Currently always set to 3 */
13050
13168
 
13051
13169
  void *(*xUserData)(Fts5Context*);
13052
13170
 
@@ -13081,6 +13199,13 @@ struct Fts5ExtensionApi {
13081
13199
 
13082
13200
  int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
13083
13201
  void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
13202
+
13203
+ /* Below this point are iVersion>=3 only */
13204
+ int (*xQueryToken)(Fts5Context*,
13205
+ int iPhrase, int iToken,
13206
+ const char **ppToken, int *pnToken
13207
+ );
13208
+ int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
13084
13209
  };
13085
13210
 
13086
13211
  /*