summaryrefslogtreecommitdiff
path: root/c/sqlite3.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/sqlite3.h')
-rw-r--r--c/sqlite3.h262
1 files changed, 215 insertions, 47 deletions
diff --git a/c/sqlite3.h b/c/sqlite3.h
index d4f1c81..f64ca01 100644
--- a/c/sqlite3.h
+++ b/c/sqlite3.h
@@ -146,9 +146,9 @@ extern "C" {
146** [sqlite3_libversion_number()], [sqlite3_sourceid()], 146** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147** [sqlite_version()] and [sqlite_source_id()]. 147** [sqlite_version()] and [sqlite_source_id()].
148*/ 148*/
149#define SQLITE_VERSION "3.44.0" 149#define SQLITE_VERSION "3.46.1"
150#define SQLITE_VERSION_NUMBER 3044000 150#define SQLITE_VERSION_NUMBER 3046001
151#define SQLITE_SOURCE_ID "2023-11-01 11:23:50 17129ba1ff7f0daf37100ee82d507aef7827cf38de1866e2633096ae6ad81301" 151#define SQLITE_SOURCE_ID "2024-08-13 09:16:08 c9c2ab54ba1f5f46360f1b4f35d849cd3f080e6fc2b6c60e91b16c63f69a1e33"
152 152
153/* 153/*
154** CAPI3REF: Run-Time Library Version Numbers 154** CAPI3REF: Run-Time Library Version Numbers
@@ -420,6 +420,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
420** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. 420** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
421** <li> The application must not modify the SQL statement text passed into 421** <li> The application must not modify the SQL statement text passed into
422** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. 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** </ul> 425** </ul>
424*/ 426*/
425SQLITE_API int sqlite3_exec( 427SQLITE_API int sqlite3_exec(
@@ -762,11 +764,11 @@ struct sqlite3_file {
762** </ul> 764** </ul>
763** xLock() upgrades the database file lock. In other words, xLock() moves the 765** xLock() upgrades the database file lock. In other words, xLock() moves the
764** database file lock in the direction NONE toward EXCLUSIVE. The argument to 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** SQLITE_LOCK_NONE. If the database file lock is already at or above the 768** SQLITE_LOCK_NONE. If the database file lock is already at or above the
767** requested lock, then the call to xLock() is a no-op. 769** requested lock, then the call to xLock() is a no-op.
768** xUnlock() downgrades the database file lock to either SHARED or NONE. 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** to xUnlock() is a no-op. 772** to xUnlock() is a no-op.
771** The xCheckReservedLock() method checks whether any database connection, 773** The xCheckReservedLock() method checks whether any database connection,
772** either in this process or in some other process, is holding a RESERVED, 774** either in this process or in some other process, is holding a RESERVED,
@@ -2141,6 +2143,22 @@ struct sqlite3_mem_methods {
2141** configuration setting is never used, then the default maximum is determined 2143** configuration setting is never used, then the default maximum is determined
2142** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that 2144** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
2143** compile-time option is not set, then the default maximum is 1073741824. 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** </dl> 2162** </dl>
2145*/ 2163*/
2146#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ 2164#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -2172,6 +2190,7 @@ struct sqlite3_mem_methods {
2172#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ 2190#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
2173#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ 2191#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
2174#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */ 2192#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
2193#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
2175 2194
2176/* 2195/*
2177** CAPI3REF: Database Connection Configuration Options 2196** CAPI3REF: Database Connection Configuration Options
@@ -3286,8 +3305,8 @@ SQLITE_API int sqlite3_set_authorizer(
3286#define SQLITE_RECURSIVE 33 /* NULL NULL */ 3305#define SQLITE_RECURSIVE 33 /* NULL NULL */
3287 3306
3288/* 3307/*
3289** CAPI3REF: Tracing And Profiling Functions 3308** CAPI3REF: Deprecated Tracing And Profiling Functions
3290** METHOD: sqlite3 3309** DEPRECATED
3291** 3310**
3292** These routines are deprecated. Use the [sqlite3_trace_v2()] interface 3311** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
3293** instead of the routines described here. 3312** instead of the routines described here.
@@ -3954,15 +3973,17 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
3954** </ul> 3973** </ul>
3955** 3974**
3956** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language 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** (See how SQLite handles [invalid UTF] for exceptions to this rule.) 3978** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
3959** ^(Memory to hold the error message string is managed internally. 3979** ^(Memory to hold the error message string is managed internally.
3960** The application does not need to worry about freeing the result. 3980** The application does not need to worry about freeing the result.
3961** However, the error string might be overwritten or deallocated by 3981** However, the error string might be overwritten or deallocated by
3962** subsequent calls to other SQLite interface functions.)^ 3982** subsequent calls to other SQLite interface functions.)^
3963** 3983**
3964** ^The sqlite3_errstr() interface returns the English-language text 3984** ^The sqlite3_errstr(E) interface returns the English-language text
3965** that describes the [result code], as UTF-8. 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** ^(Memory to hold the error message string is managed internally 3987** ^(Memory to hold the error message string is managed internally
3967** and must not be freed by the application)^. 3988** and must not be freed by the application)^.
3968** 3989**
@@ -5573,13 +5594,27 @@ SQLITE_API int sqlite3_create_window_function(
5573** </dd> 5594** </dd>
5574** 5595**
5575** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd> 5596** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
5576** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call 5597** The SQLITE_SUBTYPE flag indicates to SQLite that a function might call
5577** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. 5598** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
5578** Specifying this flag makes no difference for scalar or aggregate user 5599** This flag instructs SQLite to omit some corner-case optimizations that
5579** functions. However, if it is not specified for a user-defined window 5600** might disrupt the operation of the [sqlite3_value_subtype()] function,
5580** function, then any sub-types belonging to arguments passed to the window 5601** causing it to return zero rather than the correct subtype().
5581** function may be discarded before the window function is called (i.e. 5602** SQL functions that invokes [sqlite3_value_subtype()] should have this
5582** sqlite3_value_subtype() will always return 0). 5603** property. If the SQLITE_SUBTYPE property is omitted, then the return
5604** value from [sqlite3_value_subtype()] might sometimes be zero even though
5605** a non-zero subtype was specified by the function argument expression.
5606**
5607** [[SQLITE_RESULT_SUBTYPE]] <dt>SQLITE_RESULT_SUBTYPE</dt><dd>
5608** The SQLITE_RESULT_SUBTYPE flag indicates to SQLite that a function might call
5609** [sqlite3_result_subtype()] to cause a sub-type to be associated with its
5610** result.
5611** Every function that invokes [sqlite3_result_subtype()] should have this
5612** property. If it does not, then the call to [sqlite3_result_subtype()]
5613** might become a no-op if the function is used as term in an
5614** [expression index]. On the other hand, SQL functions that never invoke
5615** [sqlite3_result_subtype()] should avoid setting this property, as the
5616** purpose of this property is to disable certain optimizations that are
5617** incompatible with subtypes.
5583** </dd> 5618** </dd>
5584** </dl> 5619** </dl>
5585*/ 5620*/
@@ -5587,6 +5622,7 @@ SQLITE_API int sqlite3_create_window_function(
5587#define SQLITE_DIRECTONLY 0x000080000 5622#define SQLITE_DIRECTONLY 0x000080000
5588#define SQLITE_SUBTYPE 0x000100000 5623#define SQLITE_SUBTYPE 0x000100000
5589#define SQLITE_INNOCUOUS 0x000200000 5624#define SQLITE_INNOCUOUS 0x000200000
5625#define SQLITE_RESULT_SUBTYPE 0x001000000
5590 5626
5591/* 5627/*
5592** CAPI3REF: Deprecated Functions 5628** CAPI3REF: Deprecated Functions
@@ -5783,6 +5819,12 @@ SQLITE_API int sqlite3_value_encoding(sqlite3_value*);
5783** information can be used to pass a limited amount of context from 5819** information can be used to pass a limited amount of context from
5784** one SQL function to another. Use the [sqlite3_result_subtype()] 5820** one SQL function to another. Use the [sqlite3_result_subtype()]
5785** routine to set the subtype for the return value of an SQL function. 5821** routine to set the subtype for the return value of an SQL function.
5822**
5823** Every [application-defined SQL function] that invoke this interface
5824** should include the [SQLITE_SUBTYPE] property in the text
5825** encoding argument when the function is [sqlite3_create_function|registered].
5826** If the [SQLITE_SUBTYPE] property is omitted, then sqlite3_value_subtype()
5827** might return zero instead of the upstream subtype in some corner cases.
5786*/ 5828*/
5787SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*); 5829SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
5788 5830
@@ -5913,14 +5955,22 @@ SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
5913** <li> ^(when sqlite3_set_auxdata() is invoked again on the same 5955** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
5914** parameter)^, or 5956** parameter)^, or
5915** <li> ^(during the original sqlite3_set_auxdata() call when a memory 5957** <li> ^(during the original sqlite3_set_auxdata() call when a memory
5916** allocation error occurs.)^ </ul> 5958** allocation error occurs.)^
5959** <li> ^(during the original sqlite3_set_auxdata() call if the function
5960** is evaluated during query planning instead of during query execution,
5961** as sometimes happens with [SQLITE_ENABLE_STAT4].)^ </ul>
5917** 5962**
5918** Note the last bullet in particular. The destructor X in 5963** Note the last two bullets in particular. The destructor X in
5919** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the 5964** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
5920** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() 5965** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
5921** should be called near the end of the function implementation and the 5966** should be called near the end of the function implementation and the
5922** function implementation should not make any use of P after 5967** function implementation should not make any use of P after
5923** sqlite3_set_auxdata() has been called. 5968** sqlite3_set_auxdata() has been called. Furthermore, a call to
5969** sqlite3_get_auxdata() that occurs immediately after a corresponding call
5970** to sqlite3_set_auxdata() might still return NULL if an out-of-memory
5971** condition occurred during the sqlite3_set_auxdata() call or if the
5972** function is being evaluated during query planning rather than during
5973** query execution.
5924** 5974**
5925** ^(In practice, auxiliary data is preserved between function calls for 5975** ^(In practice, auxiliary data is preserved between function calls for
5926** function parameters that are compile-time constants, including literal 5976** function parameters that are compile-time constants, including literal
@@ -6194,6 +6244,20 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
6194** higher order bits are discarded. 6244** higher order bits are discarded.
6195** The number of subtype bytes preserved by SQLite might increase 6245** The number of subtype bytes preserved by SQLite might increase
6196** in future releases of SQLite. 6246** in future releases of SQLite.
6247**
6248** Every [application-defined SQL function] that invokes this interface
6249** should include the [SQLITE_RESULT_SUBTYPE] property in its
6250** text encoding argument when the SQL function is
6251** [sqlite3_create_function|registered]. If the [SQLITE_RESULT_SUBTYPE]
6252** property is omitted from the function that invokes sqlite3_result_subtype(),
6253** then in some cases the sqlite3_result_subtype() might fail to set
6254** the result subtype.
6255**
6256** If SQLite is compiled with -DSQLITE_STRICT_SUBTYPE=1, then any
6257** SQL function that invokes the sqlite3_result_subtype() interface
6258** and that does not have the SQLITE_RESULT_SUBTYPE property will raise
6259** an error. Future versions of SQLite might enable -DSQLITE_STRICT_SUBTYPE=1
6260** by default.
6197*/ 6261*/
6198SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int); 6262SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
6199 6263
@@ -6823,6 +6887,12 @@ SQLITE_API int sqlite3_autovacuum_pages(
6823** The exceptions defined in this paragraph might change in a future 6887** The exceptions defined in this paragraph might change in a future
6824** release of SQLite. 6888** release of SQLite.
6825** 6889**
6890** Whether the update hook is invoked before or after the
6891** corresponding change is currently unspecified and may differ
6892** depending on the type of change. Do not rely on the order of the
6893** hook call with regards to the final result of the operation which
6894** triggers the hook.
6895**
6826** The update hook implementation must not do anything that will modify 6896** The update hook implementation must not do anything that will modify
6827** the database connection that invoked the update hook. Any actions 6897** the database connection that invoked the update hook. Any actions
6828** to modify the database connection must be deferred until after the 6898** to modify the database connection must be deferred until after the
@@ -7994,9 +8064,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
7994** 8064**
7995** ^(Some systems (for example, Windows 95) do not support the operation 8065** ^(Some systems (for example, Windows 95) do not support the operation
7996** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() 8066** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
7997** will always return SQLITE_BUSY. The SQLite core only ever uses 8067** will always return SQLITE_BUSY. In most cases the SQLite core only uses
7998** sqlite3_mutex_try() as an optimization so this is acceptable 8068** sqlite3_mutex_try() as an optimization, so this is acceptable
7999** behavior.)^ 8069** behavior. The exceptions are unix builds that set the
8070** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
8071** sqlite3_mutex_try() is required.)^
8000** 8072**
8001** ^The sqlite3_mutex_leave() routine exits a mutex that was 8073** ^The sqlite3_mutex_leave() routine exits a mutex that was
8002** previously entered by the same thread. The behavior 8074** previously entered by the same thread. The behavior
@@ -8255,6 +8327,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8255#define SQLITE_TESTCTRL_ASSERT 12 8327#define SQLITE_TESTCTRL_ASSERT 12
8256#define SQLITE_TESTCTRL_ALWAYS 13 8328#define SQLITE_TESTCTRL_ALWAYS 13
8257#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */ 8329#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
8330#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
8258#define SQLITE_TESTCTRL_OPTIMIZATIONS 15 8331#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
8259#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */ 8332#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
8260#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */ 8333#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
@@ -8290,7 +8363,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
8290** The sqlite3_keyword_count() interface returns the number of distinct 8363** The sqlite3_keyword_count() interface returns the number of distinct
8291** keywords understood by SQLite. 8364** keywords understood by SQLite.
8292** 8365**
8293** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and 8366** The sqlite3_keyword_name(N,Z,L) interface finds the 0-based N-th keyword and
8294** makes *Z point to that keyword expressed as UTF8 and writes the number 8367** makes *Z point to that keyword expressed as UTF8 and writes the number
8295** of bytes in the keyword into *L. The string that *Z points to is not 8368** of bytes in the keyword into *L. The string that *Z points to is not
8296** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns 8369** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
@@ -9869,24 +9942,45 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
9869** <li value="2"><p> 9942** <li value="2"><p>
9870** ^(If the sqlite3_vtab_distinct() interface returns 2, that means 9943** ^(If the sqlite3_vtab_distinct() interface returns 2, that means
9871** that the query planner does not need the rows returned in any particular 9944** that the query planner does not need the rows returned in any particular
9872** order, as long as rows with the same values in all "aOrderBy" columns 9945** order, as long as rows with the same values in all columns identified
9873** are adjacent.)^ ^(Furthermore, only a single row for each particular 9946** by "aOrderBy" are adjacent.)^ ^(Furthermore, when two or more rows
9874** combination of values in the columns identified by the "aOrderBy" field 9947** contain the same values for all columns identified by "colUsed", all but
9875** needs to be returned.)^ ^It is always ok for two or more rows with the same 9948** one such row may optionally be omitted from the result.)^
9876** values in all "aOrderBy" columns to be returned, as long as all such rows 9949** The virtual table is not required to omit rows that are duplicates
9877** are adjacent. ^The virtual table may, if it chooses, omit extra rows 9950** over the "colUsed" columns, but if the virtual table can do that without
9878** that have the same value for all columns identified by "aOrderBy". 9951** too much extra effort, it could potentially help the query to run faster.
9879** ^However omitting the extra rows is optional.
9880** This mode is used for a DISTINCT query. 9952** This mode is used for a DISTINCT query.
9881** <li value="3"><p> 9953** <li value="3"><p>
9882** ^(If the sqlite3_vtab_distinct() interface returns 3, that means 9954** ^(If the sqlite3_vtab_distinct() interface returns 3, that means the
9883** that the query planner needs only distinct rows but it does need the 9955** virtual table must return rows in the order defined by "aOrderBy" as
9884** rows to be sorted.)^ ^The virtual table implementation is free to omit 9956** if the sqlite3_vtab_distinct() interface had returned 0. However if
9885** rows that are identical in all aOrderBy columns, if it wants to, but 9957** two or more rows in the result have the same values for all columns
9886** it is not required to omit any rows. This mode is used for queries 9958** identified by "colUsed", then all but one such row may optionally be
9959** omitted.)^ Like when the return value is 2, the virtual table
9960** is not required to omit rows that are duplicates over the "colUsed"
9961** columns, but if the virtual table can do that without
9962** too much extra effort, it could potentially help the query to run faster.
9963** This mode is used for queries
9887** that have both DISTINCT and ORDER BY clauses. 9964** that have both DISTINCT and ORDER BY clauses.
9888** </ol> 9965** </ol>
9889** 9966**
9967** <p>The following table summarizes the conditions under which the
9968** virtual table is allowed to set the "orderByConsumed" flag based on
9969** the value returned by sqlite3_vtab_distinct(). This table is a
9970** restatement of the previous four paragraphs:
9971**
9972** <table border=1 cellspacing=0 cellpadding=10 width="90%">
9973** <tr>
9974** <td valign="top">sqlite3_vtab_distinct() return value
9975** <td valign="top">Rows are returned in aOrderBy order
9976** <td valign="top">Rows with the same value in all aOrderBy columns are adjacent
9977** <td valign="top">Duplicates over all colUsed columns may be omitted
9978** <tr><td>0<td>yes<td>yes<td>no
9979** <tr><td>1<td>no<td>yes<td>no
9980** <tr><td>2<td>no<td>yes<td>yes
9981** <tr><td>3<td>yes<td>yes<td>yes
9982** </table>
9983**
9890** ^For the purposes of comparing virtual table output values to see if the 9984** ^For the purposes of comparing virtual table output values to see if the
9891** values are same value for sorting purposes, two NULL values are considered 9985** values are same value for sorting purposes, two NULL values are considered
9892** to be the same. In other words, the comparison operator is "IS" 9986** to be the same. In other words, the comparison operator is "IS"
@@ -11932,6 +12026,30 @@ SQLITE_API int sqlite3changegroup_schema(sqlite3_changegroup*, sqlite3*, const c
11932SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); 12026SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
11933 12027
11934/* 12028/*
12029** CAPI3REF: Add A Single Change To A Changegroup
12030** METHOD: sqlite3_changegroup
12031**
12032** This function adds the single change currently indicated by the iterator
12033** passed as the second argument to the changegroup object. The rules for
12034** adding the change are just as described for [sqlite3changegroup_add()].
12035**
12036** If the change is successfully added to the changegroup, SQLITE_OK is
12037** returned. Otherwise, an SQLite error code is returned.
12038**
12039** The iterator must point to a valid entry when this function is called.
12040** If it does not, SQLITE_ERROR is returned and no change is added to the
12041** changegroup. Additionally, the iterator must not have been opened with
12042** the SQLITE_CHANGESETAPPLY_INVERT flag. In this case SQLITE_ERROR is also
12043** returned.
12044*/
12045SQLITE_API int sqlite3changegroup_add_change(
12046 sqlite3_changegroup*,
12047 sqlite3_changeset_iter*
12048);
12049
12050
12051
12052/*
11935** CAPI3REF: Obtain A Composite Changeset From A Changegroup 12053** CAPI3REF: Obtain A Composite Changeset From A Changegroup
11936** METHOD: sqlite3_changegroup 12054** METHOD: sqlite3_changegroup
11937** 12055**
@@ -12735,8 +12853,8 @@ struct Fts5PhraseIter {
12735** EXTENSION API FUNCTIONS 12853** EXTENSION API FUNCTIONS
12736** 12854**
12737** xUserData(pFts): 12855** xUserData(pFts):
12738** Return a copy of the context pointer the extension function was 12856** Return a copy of the pUserData pointer passed to the xCreateFunction()
12739** registered with. 12857** API when the extension function was registered.
12740** 12858**
12741** xColumnTotalSize(pFts, iCol, pnToken): 12859** xColumnTotalSize(pFts, iCol, pnToken):
12742** If parameter iCol is less than zero, set output variable *pnToken 12860** If parameter iCol is less than zero, set output variable *pnToken
@@ -12768,8 +12886,11 @@ struct Fts5PhraseIter {
12768** created with the "columnsize=0" option. 12886** created with the "columnsize=0" option.
12769** 12887**
12770** xColumnText: 12888** xColumnText:
12771** This function attempts to retrieve the text of column iCol of the 12889** If parameter iCol is less than zero, or greater than or equal to the
12772** current document. If successful, (*pz) is set to point to a buffer 12890** number of columns in the table, SQLITE_RANGE is returned.
12891**
12892** Otherwise, this function attempts to retrieve the text of column iCol of
12893** the current document. If successful, (*pz) is set to point to a buffer
12773** containing the text in utf-8 encoding, (*pn) is set to the size in bytes 12894** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
12774** (not characters) of the buffer and SQLITE_OK is returned. Otherwise, 12895** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
12775** if an error occurs, an SQLite error code is returned and the final values 12896** if an error occurs, an SQLite error code is returned and the final values
@@ -12779,8 +12900,10 @@ struct Fts5PhraseIter {
12779** Returns the number of phrases in the current query expression. 12900** Returns the number of phrases in the current query expression.
12780** 12901**
12781** xPhraseSize: 12902** xPhraseSize:
12782** Returns the number of tokens in phrase iPhrase of the query. Phrases 12903** If parameter iCol is less than zero, or greater than or equal to the
12783** are numbered starting from zero. 12904** number of phrases in the current query, as returned by xPhraseCount,
12905** 0 is returned. Otherwise, this function returns the number of tokens in
12906** phrase iPhrase of the query. Phrases are numbered starting from zero.
12784** 12907**
12785** xInstCount: 12908** xInstCount:
12786** Set *pnInst to the total number of occurrences of all phrases within 12909** Set *pnInst to the total number of occurrences of all phrases within
@@ -12796,12 +12919,13 @@ struct Fts5PhraseIter {
12796** Query for the details of phrase match iIdx within the current row. 12919** Query for the details of phrase match iIdx within the current row.
12797** Phrase matches are numbered starting from zero, so the iIdx argument 12920** Phrase matches are numbered starting from zero, so the iIdx argument
12798** should be greater than or equal to zero and smaller than the value 12921** should be greater than or equal to zero and smaller than the value
12799** output by xInstCount(). 12922** output by xInstCount(). If iIdx is less than zero or greater than
12923** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
12800** 12924**
12801** Usually, output parameter *piPhrase is set to the phrase number, *piCol 12925** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
12802** to the column in which it occurs and *piOff the token offset of the 12926** to the column in which it occurs and *piOff the token offset of the
12803** first token of the phrase. Returns SQLITE_OK if successful, or an error 12927** first token of the phrase. SQLITE_OK is returned if successful, or an
12804** code (i.e. SQLITE_NOMEM) if an error occurs. 12928** error code (i.e. SQLITE_NOMEM) if an error occurs.
12805** 12929**
12806** This API can be quite slow if used with an FTS5 table created with the 12930** This API can be quite slow if used with an FTS5 table created with the
12807** "detail=none" or "detail=column" option. 12931** "detail=none" or "detail=column" option.
@@ -12827,6 +12951,10 @@ struct Fts5PhraseIter {
12827** Invoking Api.xUserData() returns a copy of the pointer passed as 12951** Invoking Api.xUserData() returns a copy of the pointer passed as
12828** the third argument to pUserData. 12952** the third argument to pUserData.
12829** 12953**
12954** If parameter iPhrase is less than zero, or greater than or equal to
12955** the number of phrases in the query, as returned by xPhraseCount(),
12956** this function returns SQLITE_RANGE.
12957**
12830** If the callback function returns any value other than SQLITE_OK, the 12958** If the callback function returns any value other than SQLITE_OK, the
12831** query is abandoned and the xQueryPhrase function returns immediately. 12959** query is abandoned and the xQueryPhrase function returns immediately.
12832** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK. 12960** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
@@ -12941,9 +13069,42 @@ struct Fts5PhraseIter {
12941** 13069**
12942** xPhraseNextColumn() 13070** xPhraseNextColumn()
12943** See xPhraseFirstColumn above. 13071** See xPhraseFirstColumn above.
13072**
13073** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
13074** This is used to access token iToken of phrase iPhrase of the current
13075** query. Before returning, output parameter *ppToken is set to point
13076** to a buffer containing the requested token, and *pnToken to the
13077** size of this buffer in bytes.
13078**
13079** If iPhrase or iToken are less than zero, or if iPhrase is greater than
13080** or equal to the number of phrases in the query as reported by
13081** xPhraseCount(), or if iToken is equal to or greater than the number of
13082** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
13083 are both zeroed.
13084**
13085** The output text is not a copy of the query text that specified the
13086** token. It is the output of the tokenizer module. For tokendata=1
13087** tables, this includes any embedded 0x00 and trailing data.
13088**
13089** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
13090** This is used to access token iToken of phrase hit iIdx within the
13091** current row. If iIdx is less than zero or greater than or equal to the
13092** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
13093** output variable (*ppToken) is set to point to a buffer containing the
13094** matching document token, and (*pnToken) to the size of that buffer in
13095** bytes. This API is not available if the specified token matches a
13096** prefix query term. In that case both output variables are always set
13097** to 0.
13098**
13099** The output text is not a copy of the document text that was tokenized.
13100** It is the output of the tokenizer module. For tokendata=1 tables, this
13101** includes any embedded 0x00 and trailing data.
13102**
13103** This API can be quite slow if used with an FTS5 table created with the
13104** "detail=none" or "detail=column" option.
12944*/ 13105*/
12945struct Fts5ExtensionApi { 13106struct Fts5ExtensionApi {
12946 int iVersion; /* Currently always set to 2 */ 13107 int iVersion; /* Currently always set to 3 */
12947 13108
12948 void *(*xUserData)(Fts5Context*); 13109 void *(*xUserData)(Fts5Context*);
12949 13110
@@ -12978,6 +13139,13 @@ struct Fts5ExtensionApi {
12978 13139
12979 int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*); 13140 int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
12980 void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol); 13141 void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
13142
13143 /* Below this point are iVersion>=3 only */
13144 int (*xQueryToken)(Fts5Context*,
13145 int iPhrase, int iToken,
13146 const char **ppToken, int *pnToken
13147 );
13148 int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
12981}; 13149};
12982 13150
12983/* 13151/*