Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 8605495

Browse files
Merge pull request #132 from livecode/bugfix-22042
[[ Bug 22042 ]] Update SQLite to v3.28.0
2 parents b844848 + 04a38b0 commit 8605495

File tree

4 files changed

+8414
-6003
lines changed

4 files changed

+8414
-6003
lines changed

libsqlite/ORIGIN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Files in this folder are based on sqlitedataset-0.1.0 and sqlite-3.26.0.
1+
Files in this folder are based on sqlitedataset-0.1.0 and sqlite-3.28.0.
22

33
Original source archives are available from <http://sqlitedataset.sourceforge.net/> and <http://sqlite.org/>

libsqlite/include/sqlite3.h

Lines changed: 98 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ extern "C" {
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126-
#define SQLITE_VERSION "3.26.0"
127-
#define SQLITE_VERSION_NUMBER 3026000
128-
#define SQLITE_SOURCE_ID "2018-12-01 12:34:55 bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9"
126+
#define SQLITE_VERSION "3.28.0"
127+
#define SQLITE_VERSION_NUMBER 3028000
128+
#define SQLITE_SOURCE_ID "2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50"
129129

130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
@@ -189,6 +189,9 @@ SQLITE_API int sqlite3_libversion_number(void);
189189
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
190190
SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
191191
SQLITE_API const char *sqlite3_compileoption_get(int N);
192+
#else
193+
# define sqlite3_compileoption_used(X) 0
194+
# define sqlite3_compileoption_get(X) ((void*)0)
192195
#endif
193196

194197
/*
@@ -823,6 +826,15 @@ struct sqlite3_io_methods {
823826
** file space based on this hint in order to help writes to the database
824827
** file run faster.
825828
**
829+
** <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
830+
** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
831+
** implements [sqlite3_deserialize()] to set an upper bound on the size
832+
** of the in-memory database. The argument is a pointer to a [sqlite3_int64].
833+
** If the integer pointed to is negative, then it is filled in with the
834+
** current limit. Otherwise the limit is set to the larger of the value
835+
** of the integer pointed to and the current database size. The integer
836+
** pointed to is set to the new limit.
837+
**
826838
** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
827839
** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
828840
** extends and truncates the database file in chunks of a size specified
@@ -1131,6 +1143,7 @@ struct sqlite3_io_methods {
11311143
#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
11321144
#define SQLITE_FCNTL_LOCK_TIMEOUT 34
11331145
#define SQLITE_FCNTL_DATA_VERSION 35
1146+
#define SQLITE_FCNTL_SIZE_LIMIT 36
11341147

11351148
/* deprecated names */
11361149
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -1972,6 +1985,17 @@ struct sqlite3_mem_methods {
19721985
** negative value for this option restores the default behaviour.
19731986
** This option is only available if SQLite is compiled with the
19741987
** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
1988+
**
1989+
** [[SQLITE_CONFIG_MEMDB_MAXSIZE]]
1990+
** <dt>SQLITE_CONFIG_MEMDB_MAXSIZE
1991+
** <dd>The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter
1992+
** [sqlite3_int64] parameter which is the default maximum size for an in-memory
1993+
** database created using [sqlite3_deserialize()]. This default maximum
1994+
** size can be adjusted up or down for individual databases using the
1995+
** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this
1996+
** configuration setting is never used, then the default maximum is determined
1997+
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
1998+
** compile-time option is not set, then the default maximum is 1073741824.
19751999
** </dl>
19762000
*/
19772001
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -2002,6 +2026,7 @@ struct sqlite3_mem_methods {
20022026
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
20032027
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
20042028
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
2029+
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
20052030

20062031
/*
20072032
** CAPI3REF: Database Connection Configuration Options
@@ -2064,8 +2089,8 @@ struct sqlite3_mem_methods {
20642089
**
20652090
** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
20662091
** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
2067-
** <dd> ^This option is used to enable or disable the two-argument
2068-
** version of the [fts3_tokenizer()] function which is part of the
2092+
** <dd> ^This option is used to enable or disable the
2093+
** [fts3_tokenizer()] function which is part of the
20692094
** [FTS3] full-text search engine extension.
20702095
** There should be two additional arguments.
20712096
** The first argument is an integer which is 0 to disable fts3_tokenizer() or
@@ -2177,6 +2202,17 @@ struct sqlite3_mem_methods {
21772202
** <li> Direct writes to [shadow tables].
21782203
** </ul>
21792204
** </dd>
2205+
**
2206+
** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
2207+
** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
2208+
** "writable_schema" flag. This has the same effect and is logically equivalent
2209+
** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
2210+
** The first argument to this setting is an integer which is 0 to disable
2211+
** the writable_schema, positive to enable writable_schema, or negative to
2212+
** leave the setting unchanged. The second parameter is a pointer to an
2213+
** integer into which is written 0 or 1 to indicate whether the writable_schema
2214+
** is enabled or disabled following this call.
2215+
** </dd>
21802216
** </dl>
21812217
*/
21822218
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
@@ -2190,7 +2226,8 @@ struct sqlite3_mem_methods {
21902226
#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */
21912227
#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */
21922228
#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */
2193-
#define SQLITE_DBCONFIG_MAX 1010 /* Largest DBCONFIG */
2229+
#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */
2230+
#define SQLITE_DBCONFIG_MAX 1011 /* Largest DBCONFIG */
21942231

21952232
/*
21962233
** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -2347,7 +2384,7 @@ SQLITE_API int sqlite3_changes(sqlite3*);
23472384
** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
23482385
** are not counted.
23492386
**
2350-
** This the [sqlite3_total_changes(D)] interface only reports the number
2387+
** The [sqlite3_total_changes(D)] interface only reports the number
23512388
** of rows that changed due to SQL statement run against database
23522389
** connection D. Any changes by other database connections are ignored.
23532390
** To detect changes against a database file from other database
@@ -2991,9 +3028,9 @@ SQLITE_API int sqlite3_set_authorizer(
29913028
** time is in units of nanoseconds, however the current implementation
29923029
** is only capable of millisecond resolution so the six least significant
29933030
** digits in the time are meaningless. Future versions of SQLite
2994-
** might provide greater resolution on the profiler callback. The
2995-
** sqlite3_profile() function is considered experimental and is
2996-
** subject to change in future versions of SQLite.
3031+
** might provide greater resolution on the profiler callback. Invoking
3032+
** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the
3033+
** profile callback.
29973034
*/
29983035
SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
29993036
void(*xTrace)(void*,const char*), void*);
@@ -3407,6 +3444,8 @@ SQLITE_API int sqlite3_open_v2(
34073444
** is not a database file pathname pointer that SQLite passed into the xOpen
34083445
** VFS method, then the behavior of this routine is undefined and probably
34093446
** undesirable.
3447+
**
3448+
** See the [URI filename] documentation for additional information.
34103449
*/
34113450
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
34123451
SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
@@ -3629,18 +3668,23 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
36293668
** deplete the limited store of lookaside memory. Future versions of
36303669
** SQLite may act on this hint differently.
36313670
**
3632-
** [[SQLITE_PREPARE_NORMALIZE]] ^(<dt>SQLITE_PREPARE_NORMALIZE</dt>
3633-
** <dd>The SQLITE_PREPARE_NORMALIZE flag indicates that a normalized
3634-
** representation of the SQL statement should be calculated and then
3635-
** associated with the prepared statement, which can be obtained via
3636-
** the [sqlite3_normalized_sql()] interface.)^ The semantics used to
3637-
** normalize a SQL statement are unspecified and subject to change.
3638-
** At a minimum, literal values will be replaced with suitable
3639-
** placeholders.
3671+
** [[SQLITE_PREPARE_NORMALIZE]] <dt>SQLITE_PREPARE_NORMALIZE</dt>
3672+
** <dd>The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used
3673+
** to be required for any prepared statement that wanted to use the
3674+
** [sqlite3_normalized_sql()] interface. However, the
3675+
** [sqlite3_normalized_sql()] interface is now available to all
3676+
** prepared statements, regardless of whether or not they use this
3677+
** flag.
3678+
**
3679+
** [[SQLITE_PREPARE_NO_VTAB]] <dt>SQLITE_PREPARE_NO_VTAB</dt>
3680+
** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
3681+
** to return an error (error code SQLITE_ERROR) if the statement uses
3682+
** any virtual tables.
36403683
** </dl>
36413684
*/
36423685
#define SQLITE_PREPARE_PERSISTENT 0x01
36433686
#define SQLITE_PREPARE_NORMALIZE 0x02
3687+
#define SQLITE_PREPARE_NO_VTAB 0x04
36443688

36453689
/*
36463690
** CAPI3REF: Compiling An SQL Statement
@@ -3865,6 +3909,18 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
38653909
*/
38663910
SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
38673911

3912+
/*
3913+
** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement
3914+
** METHOD: sqlite3_stmt
3915+
**
3916+
** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the
3917+
** prepared statement S is an EXPLAIN statement, or 2 if the
3918+
** statement S is an EXPLAIN QUERY PLAN.
3919+
** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is
3920+
** an ordinary statement or a NULL pointer.
3921+
*/
3922+
SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
3923+
38683924
/*
38693925
** CAPI3REF: Determine If A Prepared Statement Has Been Reset
38703926
** METHOD: sqlite3_stmt
@@ -4004,7 +4060,9 @@ typedef struct sqlite3_context sqlite3_context;
40044060
** ^The fifth argument to the BLOB and string binding interfaces
40054061
** is a destructor used to dispose of the BLOB or
40064062
** string after SQLite has finished with it. ^The destructor is called
4007-
** to dispose of the BLOB or string even if the call to bind API fails.
4063+
** to dispose of the BLOB or string even if the call to the bind API fails,
4064+
** except the destructor is not called if the third parameter is a NULL
4065+
** pointer or the fourth parameter is negative.
40084066
** ^If the fifth argument is
40094067
** the special value [SQLITE_STATIC], then SQLite assumes that the
40104068
** information is in static, unmanaged space and does not need to be freed.
@@ -4921,6 +4979,8 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
49214979
** <tr><td><b>sqlite3_value_nochange&nbsp;&nbsp;</b>
49224980
** <td>&rarr;&nbsp;&nbsp;<td>True if the column is unchanged in an UPDATE
49234981
** against a virtual table.
4982+
** <tr><td><b>sqlite3_value_frombind&nbsp;&nbsp;</b>
4983+
** <td>&rarr;&nbsp;&nbsp;<td>True if value originated from a [bound parameter]
49244984
** </table></blockquote>
49254985
**
49264986
** <b>Details:</b>
@@ -4982,6 +5042,11 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
49825042
** than within an [xUpdate] method call for an UPDATE statement, then
49835043
** the return value is arbitrary and meaningless.
49845044
**
5045+
** ^The sqlite3_value_frombind(X) interface returns non-zero if the
5046+
** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
5047+
** interfaces. ^If X comes from an SQL literal value, or a table column,
5048+
** and expression, then sqlite3_value_frombind(X) returns zero.
5049+
**
49855050
** Please pay particular attention to the fact that the pointer returned
49865051
** from [sqlite3_value_blob()], [sqlite3_value_text()], or
49875052
** [sqlite3_value_text16()] can be invalidated by a subsequent call to
@@ -5027,6 +5092,7 @@ SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
50275092
SQLITE_API int sqlite3_value_type(sqlite3_value*);
50285093
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
50295094
SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
5095+
SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
50305096

50315097
/*
50325098
** CAPI3REF: Finding The Subtype Of SQL Values
@@ -5762,7 +5828,7 @@ SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
57625828
** associated with database N of connection D. ^The main database file
57635829
** has the name "main". If there is no attached database N on the database
57645830
** connection D, or if database N is a temporary or in-memory database, then
5765-
** a NULL pointer is returned.
5831+
** this function will return either a NULL pointer or an empty string.
57665832
**
57675833
** ^The filename returned by this function is the output of the
57685834
** xFullPathname method of the [VFS]. ^In other words, the filename
@@ -9996,7 +10062,7 @@ SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
999610062
** sqlite3changeset_next() is called on the iterator or until the
999710063
** conflict-handler function returns. If pnCol is not NULL, then *pnCol is
999810064
** set to the number of columns in the table affected by the change. If
9999-
** pbIncorrect is not NULL, then *pbIndirect is set to true (1) if the change
10065+
** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
1000010066
** is an indirect change, or false (0) otherwise. See the documentation for
1000110067
** [sqlite3session_indirect()] for a description of direct and indirect
1000210068
** changes. Finally, if pOp is not NULL, then *pOp is set to one of
@@ -10863,7 +10929,7 @@ SQLITE_API int sqlite3rebaser_configure(
1086310929
** in size. This function allocates and populates a buffer with a copy
1086410930
** of the changeset rebased rebased according to the configuration of the
1086510931
** rebaser object passed as the first argument. If successful, (*ppOut)
10866-
** is set to point to the new buffer containing the rebased changset and
10932+
** is set to point to the new buffer containing the rebased changeset and
1086710933
** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
1086810934
** responsibility of the caller to eventually free the new buffer using
1086910935
** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
@@ -11230,12 +11296,8 @@ struct Fts5PhraseIter {
1123011296
**
1123111297
** Usually, output parameter *piPhrase is set to the phrase number, *piCol
1123211298
** to the column in which it occurs and *piOff the token offset of the
11233-
** first token of the phrase. The exception is if the table was created
11234-
** with the offsets=0 option specified. In this case *piOff is always
11235-
** set to -1.
11236-
**
11237-
** Returns SQLITE_OK if successful, or an error code (i.e. SQLITE_NOMEM)
11238-
** if an error occurs.
11299+
** first token of the phrase. Returns SQLITE_OK if successful, or an error
11300+
** code (i.e. SQLITE_NOMEM) if an error occurs.
1123911301
**
1124011302
** This API can be quite slow if used with an FTS5 table created with the
1124111303
** "detail=none" or "detail=column" option.
@@ -11276,7 +11338,7 @@ struct Fts5PhraseIter {
1127611338
** Save the pointer passed as the second argument as the extension functions
1127711339
** "auxiliary data". The pointer may then be retrieved by the current or any
1127811340
** future invocation of the same fts5 extension function made as part of
11279-
** of the same MATCH query using the xGetAuxdata() API.
11341+
** the same MATCH query using the xGetAuxdata() API.
1128011342
**
1128111343
** Each extension function is allocated a single auxiliary data slot for
1128211344
** each FTS query (MATCH expression). If the extension function is invoked
@@ -11291,7 +11353,7 @@ struct Fts5PhraseIter {
1129111353
** The xDelete callback, if one is specified, is also invoked on the
1129211354
** auxiliary data pointer after the FTS5 query has finished.
1129311355
**
11294-
** If an error (e.g. an OOM condition) occurs within this function, an
11356+
** If an error (e.g. an OOM condition) occurs within this function,
1129511357
** the auxiliary data is set to NULL and an error code returned. If the
1129611358
** xDelete parameter was not NULL, it is invoked on the auxiliary data
1129711359
** pointer before returning.
@@ -11524,11 +11586,11 @@ struct Fts5ExtensionApi {
1152411586
** the tokenizer substitutes "first" for "1st" and the query works
1152511587
** as expected.
1152611588
**
11527-
** <li> By adding multiple synonyms for a single term to the FTS index.
11528-
** In this case, when tokenizing query text, the tokenizer may
11529-
** provide multiple synonyms for a single term within the document.
11530-
** FTS5 then queries the index for each synonym individually. For
11531-
** example, faced with the query:
11589+
** <li> By querying the index for all synonyms of each query term
11590+
** separately. In this case, when tokenizing query text, the
11591+
** tokenizer may provide multiple synonyms for a single term
11592+
** within the document. FTS5 then queries the index for each
11593+
** synonym individually. For example, faced with the query:
1153211594
**
1153311595
** <codeblock>
1153411596
** ... MATCH 'first place'</codeblock>
@@ -11552,7 +11614,7 @@ struct Fts5ExtensionApi {
1155211614
** "place".
1155311615
**
1155411616
** This way, even if the tokenizer does not provide synonyms
11555-
** when tokenizing query text (it should not - to do would be
11617+
** when tokenizing query text (it should not - to do so would be
1155611618
** inefficient), it doesn't matter if the user queries for
1155711619
** 'first + place' or '1st + place', as there are entries in the
1155811620
** FTS index corresponding to both forms of the first token.

libsqlite/include/sqlite3ext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,9 @@ struct sqlite3_api_routines {
319319
void(*xDestroy)(void*));
320320
/* Version 3.26.0 and later */
321321
const char *(*normalized_sql)(sqlite3_stmt*);
322+
/* Version 3.28.0 and later */
323+
int (*stmt_isexplain)(sqlite3_stmt*);
324+
int (*value_frombind)(sqlite3_value*);
322325
};
323326

324327
/*
@@ -608,6 +611,9 @@ typedef int (*sqlite3_loadext_entry)(
608611
#define sqlite3_create_window_function sqlite3_api->create_window_function
609612
/* Version 3.26.0 and later */
610613
#define sqlite3_normalized_sql sqlite3_api->normalized_sql
614+
/* Version 3.28.0 and later */
615+
#define sqlite3_stmt_isexplain sqlite3_api->isexplain
616+
#define sqlite3_value_frombind sqlite3_api->frombind
611617
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
612618

613619
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)

0 commit comments

Comments
 (0)