1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Merge in the untrusted-schema enhancements.

See [/doc/87aea3ab1cdda453/doc/trusted-schema.md|doc/trusted-schema.md]
for details.

FossilOrigin-Name: 5720924cb07766cd54fb042da58f4b4acf12b60029fba86a23a606ad0d0f7c68
This commit is contained in:
drh
2020-01-09 20:44:37 +00:00
53 changed files with 993 additions and 233 deletions

142
doc/trusted-schema.md Normal file
View File

@@ -0,0 +1,142 @@
# The new-security-options branch
## The problem that the [new-security-options](/timeline?r=new-security-options) branch tries to solve
An attacker might modify the schema of an SQLite database by adding
structures that cause code to run when some other application opens and
reads the database. For example, the attacker might replace a table
definition with a view. Or the attacker might add triggers to tables
or views, or add new CHECK constraints or generated columns or indexes
with expressions in the index list or in the WHERE clause. If the
added features invoke SQL functions or virtual tables with side effects,
that might cause harm to the system if run by a high-privilege victim.
Or, the added features might exfiltrate information if the database is
read by a high-privilege victim.
The changes in this branch strive to make it easier for high-privilege
applications to safely read SQLite database files that might have been
maliciously corrupted by an attacker.
## Overview of changes in [new-security-options](/timeline?r=new-security-options)
The basic idea is to tag every SQL function and virtual table with one
of three risk levels:
1. Innocuous
2. Normal
3. Direct-Only
Innocuous functions/vtabs are safe and can be used at any time.
Direct-only elements, in contrast, might have cause side-effects and
should only be used from top-level SQL, not from within triggers or views nor
in elements of the schema such as CHECK constraint, DEFAULT values,
generated columns, index expressions, or in the WHERE clause of a
partial index that are potentially under the control of an attacker.
Normal elements behave like Innocuous if TRUSTED\_SCHEMA=on
and behave like direct-only if TRUSTED\_SCHEMA=off.
Application-defined functions and virtual tables go in as Normal unless
the application takes deliberate steps to change the risk level.
For backwards compatibility, the default is TRUSTED\_SCHEMA=on. Documentation
will be updated to recommend applications turn TRUSTED\_SCHEMA to off.
An innocuous function or virtual table is one that can only read content
from the database file in which it resides, and can only alter the database
in which it resides. Most SQL functions are innocuous. For example, there
is no harm in an attacker running the abs() function.
Direct-only elements that have side-effects that go outside the database file
in which it lives, or return information from outside of the database file.
Examples of direct-only elements include:
1. The fts3\_tokenizer() function
2. The writefile() function
3. The readfile() function
4. The zipvfs virtual table
5. The csv virtual table
We do not want an attacker to be able to add these kinds of things to
the database schema and possibly trick a high-privilege application
from performing any of these actions. Therefore, functions and vtabs
with side-effects are marked as Direct-Only.
Legacy applications might add other risky functions or vtabs. Those will
go in as "Normal" by default. For optimal security, we want those risky
app-defined functions and vtabs to be direct-only, but making that the
default might break some legacy applications. Hence, all app-defined
functions and vtabs go in as Normal, but the application can switch them
over to "Direct-Only" behavior using a single pragma.
The restrictions on the use of functions and virtual tables do not apply
to TEMP. A TEMP VIEW or a TEMP TRIGGER can use any valid SQL function
or virtual table. The idea is that TEMP views and triggers must be
directly created by the application and are thus under the control of the
application. TEMP views and triggers cannot be created by an attacker who
corrupts the schema of a persistent database file. Hence TEMP views and
triggers are safe.
## Specific changes
1. New sqlite3\_db\_config() option SQLITE\_DBCONFIG\_TRUSTED\_SCHEMA for
turning TRUSTED\_SCHEMA on and off. It defaults to ON.
2. Compile-time option -DSQLITE\_TRUSTED\_SCHEMA=0 causes the default
TRUSTED\_SCHEMA setting to be off.
3. New pragma "PRAGMA trusted\_schema=(ON\|OFF);". This provides access
to the TRUSTED_SCHEMA setting for application coded using scripting
languages or other secondary languages where they are unable to make
calls to sqlite3\_db\_config().
4. New options for the "enc" parameter to sqlite3\_create\_function() and
its kin:
<ol type="a">
<li> _SQLITE\_INNOCUOUS_ &rarr; tags the new functions as Innocuous
<li> _SQLITE\_DIRECTONLY_ &rarr; tags the new functions as Direct-Only
</ol>
5. New options to sqlite3\_vtab\_config():
<ol type="a">
<li> _SQLITE\_VTAB\_INNOCUOUS_ &rarr; tags the vtab as Innocuous
<li> _SQLITE\_VTAB\_DIRECTONLY_ &rarr; tags the vtab as Direct-Only
</ol>
6. Change many of the functions and virtual tables in the SQLite source
tree to use one of the tags above.
7. Enhanced PRAGMA function\_list and virtual-table "pragma\_function\_list"
with additional columns. The columns now are:
<ul>
<li> _name_ &rarr; Name of the function
<li> _builtin_ &rarr; 1 for built-in functions. 0 otherwise.
<li> _type_ &rarr; 's'=Scalar, 'a'=Aggregate, 'w'=Window
<li> _enc_ &rarr; 'utf8', 'utf16le', or 'utf16be'
<li> _narg_ &rarr; number of argument
<li> _flags_ &rarr; Bitmask of SQLITE\_INNOCUOUS, SQLITE\_DIRECTONLY,
SQLITE\_DETERMINISTIC, SQLITE\_SUBTYPE, and
SQLITE\_FUNC\_INTERNAL flags.
</ul>
<p>The last four columns are new.
8. The function\_list PRAGMA now also shows all entries for each function.
So, for example, if a function can take either 2 or 3 arguments,
there are separate rows for the 2-argument and 3-argument versions of
the function.
## Additional Notes
The function_list enhancements allow the application to query the set
of SQL functions that meet various criteria. For example, to see all
SQL functions that are never allowed to be used in the schema or in
trigger or views:
~~~
SELECT DISTINCT name FROM pragma_function_list
WHERE (flags & 0x80000)!=0
ORDER BY name;
~~~
Doing the same is not possible for virtual tables, as a virtual table
might be Innocuous, Normal, or Direct-Only depending on the arguments
passed into the xConnect method.

View File

@@ -499,26 +499,27 @@ static void icuLoadCollation(
** Register the ICU extension functions with database db. ** Register the ICU extension functions with database db.
*/ */
int sqlite3IcuInit(sqlite3 *db){ int sqlite3IcuInit(sqlite3 *db){
# define SQLITEICU_EXTRAFLAGS (SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS)
static const struct IcuScalar { static const struct IcuScalar {
const char *zName; /* Function name */ const char *zName; /* Function name */
unsigned char nArg; /* Number of arguments */ unsigned char nArg; /* Number of arguments */
unsigned short enc; /* Optimal text encoding */ unsigned int enc; /* Optimal text encoding */
unsigned char iContext; /* sqlite3_user_data() context */ unsigned char iContext; /* sqlite3_user_data() context */
void (*xFunc)(sqlite3_context*,int,sqlite3_value**); void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
} scalars[] = { } scalars[] = {
{"icu_load_collation", 2, SQLITE_UTF8, 1, icuLoadCollation}, {"icu_load_collation",2,SQLITE_UTF8|SQLITE_DIRECTONLY,1, icuLoadCollation},
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU)
{"regexp", 2, SQLITE_ANY|SQLITE_DETERMINISTIC, 0, icuRegexpFunc}, {"regexp", 2, SQLITE_ANY|SQLITEICU_EXTRAFLAGS, 0, icuRegexpFunc},
{"lower", 1, SQLITE_UTF16|SQLITE_DETERMINISTIC, 0, icuCaseFunc16}, {"lower", 1, SQLITE_UTF16|SQLITEICU_EXTRAFLAGS, 0, icuCaseFunc16},
{"lower", 2, SQLITE_UTF16|SQLITE_DETERMINISTIC, 0, icuCaseFunc16}, {"lower", 2, SQLITE_UTF16|SQLITEICU_EXTRAFLAGS, 0, icuCaseFunc16},
{"upper", 1, SQLITE_UTF16|SQLITE_DETERMINISTIC, 1, icuCaseFunc16}, {"upper", 1, SQLITE_UTF16|SQLITEICU_EXTRAFLAGS, 1, icuCaseFunc16},
{"upper", 2, SQLITE_UTF16|SQLITE_DETERMINISTIC, 1, icuCaseFunc16}, {"upper", 2, SQLITE_UTF16|SQLITEICU_EXTRAFLAGS, 1, icuCaseFunc16},
{"lower", 1, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuCaseFunc16}, {"lower", 1, SQLITE_UTF8|SQLITEICU_EXTRAFLAGS, 0, icuCaseFunc16},
{"lower", 2, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuCaseFunc16}, {"lower", 2, SQLITE_UTF8|SQLITEICU_EXTRAFLAGS, 0, icuCaseFunc16},
{"upper", 1, SQLITE_UTF8|SQLITE_DETERMINISTIC, 1, icuCaseFunc16}, {"upper", 1, SQLITE_UTF8|SQLITEICU_EXTRAFLAGS, 1, icuCaseFunc16},
{"upper", 2, SQLITE_UTF8|SQLITE_DETERMINISTIC, 1, icuCaseFunc16}, {"upper", 2, SQLITE_UTF8|SQLITEICU_EXTRAFLAGS, 1, icuCaseFunc16},
{"like", 2, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuLikeFunc}, {"like", 2, SQLITE_UTF8|SQLITEICU_EXTRAFLAGS, 0, icuLikeFunc},
{"like", 3, SQLITE_UTF8|SQLITE_DETERMINISTIC, 0, icuLikeFunc}, {"like", 3, SQLITE_UTF8|SQLITEICU_EXTRAFLAGS, 0, icuLikeFunc},
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) */
}; };
int rc = SQLITE_OK; int rc = SQLITE_OK;

View File

@@ -900,6 +900,7 @@ static int amatchConnect(
rc = amatchLoadRules(db, pNew, pzErr); rc = amatchLoadRules(db, pNew, pzErr);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
rc = sqlite3_declare_vtab(db, rc = sqlite3_declare_vtab(db,
"CREATE TABLE x(word,distance,language," "CREATE TABLE x(word,distance,language,"
"command HIDDEN,nword HIDDEN)" "command HIDDEN,nword HIDDEN)"

View File

@@ -118,6 +118,7 @@ static int completionConnect(
#define COMPLETION_COLUMN_WHOLELINE 2 /* Entire line seen so far */ #define COMPLETION_COLUMN_WHOLELINE 2 /* Entire line seen so far */
#define COMPLETION_COLUMN_PHASE 3 /* ePhase - used for debugging only */ #define COMPLETION_COLUMN_PHASE 3 /* ePhase - used for debugging only */
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
rc = sqlite3_declare_vtab(db, rc = sqlite3_declare_vtab(db,
"CREATE TABLE x(" "CREATE TABLE x("
" candidate TEXT," " candidate TEXT,"

View File

@@ -119,11 +119,13 @@ int sqlite3_compress_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "compress", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "compress", 1,
compressFunc, 0, 0); SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
0, compressFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "uncompress", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "uncompress", 1,
uncompressFunc, 0, 0); SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
0, uncompressFunc, 0, 0);
} }
return rc; return rc;
} }

View File

@@ -632,6 +632,15 @@ static int csvtabConnect(
for(i=0; i<sizeof(azPValue)/sizeof(azPValue[0]); i++){ for(i=0; i<sizeof(azPValue)/sizeof(azPValue[0]); i++){
sqlite3_free(azPValue[i]); sqlite3_free(azPValue[i]);
} }
/* Rationale for DIRECTONLY:
** An attacker who controls a database schema could use this vtab
** to exfiltrate sensitive data from other files in the filesystem.
** And, recommended practice is to put all CSV virtual tables in the
** TEMP namespace, so they should still be usable from within TEMP
** views, so there shouldn't be a serious loss of functionality by
** prohibiting the use of this vtab from persistent triggers and views.
*/
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
return SQLITE_OK; return SQLITE_OK;
csvtab_connect_oom: csvtab_connect_oom:

View File

@@ -113,10 +113,12 @@ int sqlite3_eval_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "eval", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "eval", 1,
SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
sqlEvalFunc, 0, 0); sqlEvalFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "eval", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "eval", 2,
SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
sqlEvalFunc, 0, 0); sqlEvalFunc, 0, 0);
} }
return rc; return rc;

View File

@@ -585,6 +585,7 @@ static int fsdirConnect(
pNew = (fsdir_tab*)sqlite3_malloc( sizeof(*pNew) ); pNew = (fsdir_tab*)sqlite3_malloc( sizeof(*pNew) );
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM;
memset(pNew, 0, sizeof(*pNew)); memset(pNew, 0, sizeof(*pNew));
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
} }
*ppVtab = (sqlite3_vtab*)pNew; *ppVtab = (sqlite3_vtab*)pNew;
return rc; return rc;
@@ -978,10 +979,12 @@ int sqlite3_fileio_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "readfile", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "readfile", 1,
SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
readfileFunc, 0, 0); readfileFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "writefile", -1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "writefile", -1,
SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
writefileFunc, 0, 0); writefileFunc, 0, 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){

View File

@@ -822,6 +822,7 @@ static int deltaparsevtabConnect(
*ppVtab = (sqlite3_vtab*)pNew; *ppVtab = (sqlite3_vtab*)pNew;
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM;
memset(pNew, 0, sizeof(*pNew)); memset(pNew, 0, sizeof(*pNew));
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
} }
return rc; return rc;
} }
@@ -1070,17 +1071,18 @@ int sqlite3_fossildelta_init(
char **pzErrMsg, char **pzErrMsg,
const sqlite3_api_routines *pApi const sqlite3_api_routines *pApi
){ ){
static const enc = SQLITE_UTF8|SQLITE_INNOCUOUS;
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "delta_create", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "delta_create", 2, enc, 0,
deltaCreateFunc, 0, 0); deltaCreateFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "delta_apply", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "delta_apply", 2, enc, 0,
deltaApplyFunc, 0, 0); deltaApplyFunc, 0, 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "delta_output_size", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "delta_output_size", 1, enc, 0,
deltaOutputSizeFunc, 0, 0); deltaOutputSizeFunc, 0, 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){

View File

@@ -540,6 +540,8 @@ static int fuzzerConnect(
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
fuzzerDisconnect((sqlite3_vtab *)pNew); fuzzerDisconnect((sqlite3_vtab *)pNew);
pNew = 0; pNew = 0;
}else{
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
} }
} }
} }

View File

@@ -121,10 +121,12 @@ int sqlite3_ieee_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "ieee754", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "ieee754", 1,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
ieee754func, 0, 0); ieee754func, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "ieee754", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "ieee754", 2,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
ieee754func, 0, 0); ieee754func, 0, 0);
} }
return rc; return rc;

View File

@@ -2091,6 +2091,7 @@ static int jsonEachConnect(
pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) ); pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM;
memset(pNew, 0, sizeof(*pNew)); memset(pNew, 0, sizeof(*pNew));
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
} }
return rc; return rc;
} }
@@ -2581,16 +2582,19 @@ int sqlite3Json1Init(sqlite3 *db){
{ "json_tree", &jsonTreeModule }, { "json_tree", &jsonTreeModule },
}; };
#endif #endif
static const int enc =
SQLITE_UTF8 |
SQLITE_DETERMINISTIC |
SQLITE_INNOCUOUS;
for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){ for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, enc,
SQLITE_UTF8 | SQLITE_DETERMINISTIC,
(void*)&aFunc[i].flag, (void*)&aFunc[i].flag,
aFunc[i].xFunc, 0, 0); aFunc[i].xFunc, 0, 0);
} }
#ifndef SQLITE_OMIT_WINDOWFUNC #ifndef SQLITE_OMIT_WINDOWFUNC
for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){ for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg, rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg,
SQLITE_SUBTYPE | SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, SQLITE_SUBTYPE | enc, 0,
aAgg[i].xStep, aAgg[i].xFinal, aAgg[i].xStep, aAgg[i].xFinal,
aAgg[i].xValue, jsonGroupInverse, 0); aAgg[i].xValue, jsonGroupInverse, 0);
} }

View File

@@ -297,14 +297,17 @@ int sqlite3_nextchar_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "next_char", 3, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "next_char", 3,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
nextCharFunc, 0, 0); nextCharFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "next_char", 4, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "next_char", 4,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
nextCharFunc, 0, 0); nextCharFunc, 0, 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "next_char", 5, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "next_char", 5,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
nextCharFunc, 0, 0); nextCharFunc, 0, 0);
} }
return rc; return rc;

57
ext/misc/noop.c Normal file
View File

@@ -0,0 +1,57 @@
/*
** 2020-01-08
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
******************************************************************************
**
** This SQLite extension implements a noop() function used for testing.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
/*
** Implementation of the noop() function.
**
** The function returns its argument, unchanged.
*/
static void noopfunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
assert( argc==1 );
sqlite3_result_value(context, argv[0]);
}
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_noop_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "noop", 1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC,
0, noopfunc, 0, 0);
if( rc ) return rc;
rc = sqlite3_create_function(db, "noop_i", 1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS,
0, noopfunc, 0, 0);
if( rc ) return rc;
rc = sqlite3_create_function(db, "noop_do", 1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_DIRECTONLY,
0, noopfunc, 0, 0);
return rc;
}

View File

@@ -213,7 +213,8 @@ int sqlite3_percentile_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "percentile", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "percentile", 2,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
0, percentStep, percentFinal); 0, percentStep, percentFinal);
return rc; return rc;
} }

View File

@@ -79,6 +79,7 @@ static int prefixesConnect(
*ppVtab = (sqlite3_vtab*)pNew; *ppVtab = (sqlite3_vtab*)pNew;
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM;
memset(pNew, 0, sizeof(*pNew)); memset(pNew, 0, sizeof(*pNew));
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
} }
return rc; return rc;
} }

View File

@@ -754,7 +754,7 @@ int sqlite3_regexp_init(
){ ){
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8|SQLITE_INNOCUOUS,
re_sql_func, 0, 0); 0, re_sql_func, 0, 0);
return rc; return rc;
} }

View File

@@ -105,8 +105,9 @@ int sqlite3_rot_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "rot13", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "rot13", 1,
rot13func, 0, 0); SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
0, rot13func, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_collation(db, "rot13", SQLITE_UTF8, 0, rot13CollFunc); rc = sqlite3_create_collation(db, "rot13", SQLITE_UTF8, 0, rot13CollFunc);
} }

View File

@@ -126,6 +126,7 @@ static int seriesConnect(
pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) ); pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM;
memset(pNew, 0, sizeof(*pNew)); memset(pNew, 0, sizeof(*pNew));
sqlite3_vtab_config(db, SQLITE_INNOCUOUS);
} }
return rc; return rc;
} }

View File

@@ -381,10 +381,11 @@ int sqlite3_sha_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "sha1", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sha1", 1, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
sha1Func, 0, 0); sha1Func, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sha1_query", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sha1_query", 1,
SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
sha1QueryFunc, 0, 0); sha1QueryFunc, 0, 0);
} }
return rc; return rc;

View File

@@ -696,19 +696,23 @@ int sqlite3_shathree_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "sha3", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sha3", 1,
sha3Func, 0, 0); SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
0, sha3Func, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sha3", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sha3", 2,
sha3Func, 0, 0); SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
0, sha3Func, 0, 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sha3_query", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sha3_query", 1,
sha3QueryFunc, 0, 0); SQLITE_UTF8 | SQLITE_DIRECTONLY,
0, sha3QueryFunc, 0, 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sha3_query", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sha3_query", 2,
sha3QueryFunc, 0, 0); SQLITE_UTF8 | SQLITE_DIRECTONLY,
0, sha3QueryFunc, 0, 0);
} }
return rc; return rc;
} }

View File

@@ -2069,6 +2069,7 @@ static int spellfix1Init(
if( pNew->zTableName==0 ){ if( pNew->zTableName==0 ){
rc = SQLITE_NOMEM; rc = SQLITE_NOMEM;
}else{ }else{
sqlite3_vtab_config(db, SQLITE_INNOCUOUS);
rc = sqlite3_declare_vtab(db, rc = sqlite3_declare_vtab(db,
"CREATE TABLE x(word,rank,distance,langid, " "CREATE TABLE x(word,rank,distance,langid, "
"score, matchlen, phonehash HIDDEN, " "score, matchlen, phonehash HIDDEN, "

View File

@@ -111,10 +111,12 @@ int sqlite3_sqlar_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "sqlar_compress", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sqlar_compress", 1,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
sqlarCompressFunc, 0, 0); sqlarCompressFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "sqlar_uncompress", 2, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "sqlar_uncompress", 2,
SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
sqlarUncompressFunc, 0, 0); sqlarUncompressFunc, 0, 0);
} }
return rc; return rc;

View File

@@ -503,11 +503,11 @@ int sqlite3_totype_init(
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "tointeger", 1, rc = sqlite3_create_function(db, "tointeger", 1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
tointegerFunc, 0, 0); tointegerFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "toreal", 1, rc = sqlite3_create_function(db, "toreal", 1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0, SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
torealFunc, 0, 0); torealFunc, 0, 0);
} }
return rc; return rc;

View File

@@ -217,15 +217,17 @@ int sqlite3_uuid_init(
int rc = SQLITE_OK; int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi); SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */ (void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "uuid", 0, SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
sqlite3UuidFunc, 0, 0); sqlite3UuidFunc, 0, 0);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "uuid_str", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "uuid_str", 1,
sqlite3UuidStrFunc, 0, 0); SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
0, sqlite3UuidStrFunc, 0, 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "uuid_blob", 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, "uuid_blob", 1,
sqlite3UuidBlobFunc, 0, 0); SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
0, sqlite3UuidBlobFunc, 0, 0);
} }
return rc; return rc;
} }

View File

@@ -50,6 +50,7 @@ static int wholenumberConnect(
pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) ); pNew = *ppVtab = sqlite3_malloc( sizeof(*pNew) );
if( pNew==0 ) return SQLITE_NOMEM; if( pNew==0 ) return SQLITE_NOMEM;
sqlite3_declare_vtab(db, "CREATE TABLE x(value)"); sqlite3_declare_vtab(db, "CREATE TABLE x(value)");
sqlite3_vtab_config(db, SQLITE_VTAB_INNOCUOUS);
memset(pNew, 0, sizeof(*pNew)); memset(pNew, 0, sizeof(*pNew));
return SQLITE_OK; return SQLITE_OK;
} }

View File

@@ -369,6 +369,7 @@ static int zipfileConnect(
zipfileDequote(pNew->zFile); zipfileDequote(pNew->zFile);
} }
} }
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
*ppVtab = (sqlite3_vtab*)pNew; *ppVtab = (sqlite3_vtab*)pNew;
return rc; return rc;
} }

View File

@@ -1786,14 +1786,20 @@ static int sqlite3_geopoly_init(sqlite3 *db){
}; };
int i; int i;
for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){ for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){
int enc = aFunc[i].bPure ? SQLITE_UTF8|SQLITE_DETERMINISTIC : SQLITE_UTF8; int enc;
if( aFunc[i].bPure ){
enc = SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS;
}else{
enc = SQLITE_UTF8|SQLITE_DIRECTONLY;
}
rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg,
enc, 0, enc, 0,
aFunc[i].xFunc, 0, 0); aFunc[i].xFunc, 0, 0);
} }
for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){ for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){
rc = sqlite3_create_function(db, aAgg[i].zName, 1, SQLITE_UTF8, 0, rc = sqlite3_create_function(db, aAgg[i].zName, 1,
0, aAgg[i].xStep, aAgg[i].xFinal); SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS, 0,
0, aAgg[i].xStep, aAgg[i].xFinal);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3_create_module_v2(db, "geopoly", &geopolyModule, 0, 0); rc = sqlite3_create_module_v2(db, "geopoly", &geopolyModule, 0, 0);

110
manifest
View File

@@ -1,5 +1,5 @@
C Only\sregister\sthe\sfts3_tokenizer()\sfunction\susing\sa\ssingle\stext\sencoding. C Merge\sin\sthe\suntrusted-schema\senhancements.\nSee\s[/doc/87aea3ab1cdda453/doc/trusted-schema.md|doc/trusted-schema.md]\nfor\sdetails.
D 2020-01-09T20:33:36.080 D 2020-01-09T20:44:37.128
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -40,6 +40,7 @@ F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd F doc/F2FS.txt c1d4a0ae9711cfe0e1d8b019d154f1c29e0d3abfe820787ba1e9ed7691160fcd
F doc/lemon.html 24956ab2995e55fe171e55bdd04f22b553957dc8bb43501dbb9311e30187e0d3 F doc/lemon.html 24956ab2995e55fe171e55bdd04f22b553957dc8bb43501dbb9311e30187e0d3
F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
F doc/trusted-schema.md 33625008620e879c7bcfbbfa079587612c434fa094d338b08242288d358c3e8a
F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a F doc/vfs-shm.txt e101f27ea02a8387ce46a05be2b1a902a021d37a
F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd F ext/README.md fd5f78013b0a2bc6f0067afb19e6ad040e89a10179b4f6f03eee58fac5f169bd
F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91 F ext/async/README.txt e12275968f6fde133a80e04387d0e839b0c51f91
@@ -230,7 +231,7 @@ F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093
F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45 F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45
F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
F ext/icu/README.txt a295e91db742b153e8dce8f7efd31d28ad1eea4df31ef4daa3eedc85be2f5138 F ext/icu/README.txt a295e91db742b153e8dce8f7efd31d28ad1eea4df31ef4daa3eedc85be2f5138
F ext/icu/icu.c c2c7592574c08cd1270d909b8fb8797f6ea1f49e931e71dbcc25506b9b224580 F ext/icu/icu.c 7adfe8a72dd4f54b47684dc9b88523399c6ef119d733b73e17371445f7428dd1
F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37
F ext/lsm1/Makefile a553b728bba6c11201b795188c5708915cc4290f02b7df6ba7e8c4c943fd5cd9 F ext/lsm1/Makefile a553b728bba6c11201b795188c5708915cc4290f02b7df6ba7e8c4c943fd5cd9
F ext/lsm1/Makefile.msc f8c878b467232226de288da320e1ac71c131f5ec91e08b21f502303347260013 F ext/lsm1/Makefile.msc f8c878b467232226de288da320e1ac71c131f5ec91e08b21f502303347260013
@@ -278,54 +279,55 @@ F ext/lsm1/test/lsm1_common.tcl 5ed4bab07c93be2e4f300ebe46007ecf4b3e20bc5fbe1ded
F ext/lsm1/test/lsm1_simple.test a04d08e8661ae6fc53786c67f0bd102c6692f003e859dde03ed9ac3f12e066e5 F ext/lsm1/test/lsm1_simple.test a04d08e8661ae6fc53786c67f0bd102c6692f003e859dde03ed9ac3f12e066e5
F ext/lsm1/tool/mklsm1c.tcl f31561bbee5349f0a554d1ad7236ac1991fc09176626f529f6078e07335398b0 F ext/lsm1/tool/mklsm1c.tcl f31561bbee5349f0a554d1ad7236ac1991fc09176626f529f6078e07335398b0
F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240 F ext/misc/README.md d6dd0fe1d8af77040216798a6a2b0c46c73054d2f0ea544fbbcdccf6f238c240
F ext/misc/amatch.c 50a9ef2d38dabfa371f8c1904097d493271e63d58ccb0e9b79a4fa4a94e66660 F ext/misc/amatch.c e3ad5532799cee9a97647f483f67f43b38796b84b5a8c60594fe782a4338f358
F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb F ext/misc/anycollseq.c 5ffdfde9829eeac52219136ad6aa7cd9a4edb3b15f4f2532de52f4a22525eddb
F ext/misc/appendvfs.c 3777f22ec1057dc4e5fd89f2fbddcc7a29fbeef1ad038c736c54411bb1967af7 F ext/misc/appendvfs.c 3777f22ec1057dc4e5fd89f2fbddcc7a29fbeef1ad038c736c54411bb1967af7
F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a F ext/misc/blobio.c a867c4c4617f6ec223a307ebfe0eabb45e0992f74dd47722b96f3e631c0edb2a
F ext/misc/btreeinfo.c 4f0ebf278f46e68e6306c667917766cebc5550fd35d5de17847988e22892d4d2 F ext/misc/btreeinfo.c 4f0ebf278f46e68e6306c667917766cebc5550fd35d5de17847988e22892d4d2
F ext/misc/carray.c 91e9a7f512fda934894bed30464552fffa7d3073b5be04189ae0bd0c59f26bfd F ext/misc/carray.c 91e9a7f512fda934894bed30464552fffa7d3073b5be04189ae0bd0c59f26bfd
F ext/misc/closure.c dbfd8543b2a017ae6b1a5843986b22ddf99ff126ec9634a2f4047cd14c85c243 F ext/misc/closure.c dbfd8543b2a017ae6b1a5843986b22ddf99ff126ec9634a2f4047cd14c85c243
F ext/misc/completion.c cec672d40604075bb341a7f11ac48393efdcd90a979269b8fe7977ea62d0547f F ext/misc/completion.c a0efe03edfdc4f717c61e6c9b0bfe2708ff7878010dae3174980a68fdf76aabc
F ext/misc/compress.c dd4f8a6d0baccff3c694757db5b430f3bbd821d8686d1fc24df55cf9f035b189 F ext/misc/compress.c 3ed77691a3ce9e50921ae2b133dc176bb4d5587fdb57bde5872c4e5c348ce0bc
F ext/misc/csv.c 7f047aeb68f5802e7ce6639292095d622a488bb43526ed04810e0649faa71ceb F ext/misc/csv.c 3ed979c1eb35e35a98b30ef545a2facf62994594217681d9138b4b75faf6b0d7
F ext/misc/dbdata.c e316fba936571584e55abd5b974a32a191727a6b746053a0c9d439bd2cf93940 F ext/misc/dbdata.c e316fba936571584e55abd5b974a32a191727a6b746053a0c9d439bd2cf93940
F ext/misc/dbdump.c baf6e37447c9d6968417b1cd34cbedb0b0ab3f91b5329501d8a8d5be3287c336 F ext/misc/dbdump.c baf6e37447c9d6968417b1cd34cbedb0b0ab3f91b5329501d8a8d5be3287c336
F ext/misc/eval.c 4b4757592d00fd32e44c7a067e6a0e4839c81a4d57abc4131ee7806d1be3104e F ext/misc/eval.c 04bc9aada78c888394204b4ed996ab834b99726fb59603b0ee3ed6e049755dc1
F ext/misc/explain.c d5c12962d79913ef774b297006872af1fccda388f61a11d37758f9179a09551f F ext/misc/explain.c d5c12962d79913ef774b297006872af1fccda388f61a11d37758f9179a09551f
F ext/misc/fileio.c 288e7230e0fe464d71b0694e2d8bdd3a353118ac2e31da3964b95f460f09915f F ext/misc/fileio.c bfa11a207da4eed8e5f84a1e3954608492f25f8850f9f00d0d2076f4648d7608
F ext/misc/fossildelta.c 7708651072eb5620ab21bbfb518d184f27b2c29c0131b09b9a2d8852a8016430 F ext/misc/fossildelta.c 3761bc206e1d52b6c43fd86efbf94d9f800d32c8323cf2b5d51104262bdd4dc0
F ext/misc/fuzzer.c c4e27daf41433a64cad5265cd27dbcb891147e9994d0422200ce81ce9a54b625 F ext/misc/fuzzer.c eae560134f66333e9e1ca4c8ffea75df42056e2ce8456734565dbe1c2a92bf3d
F ext/misc/ieee754.c f190d0cc5182529acb15babd177781be1ac1718c F ext/misc/ieee754.c eaffd9b364d7c8371727e9c43fc8bec38cdacc4d11fc26beffaa3ca05a0ea9d6
F ext/misc/json1.c 760107d0b97ab422952591b0d7519327dcb482954a7706ee387a54c135f8aabf F ext/misc/json1.c 2d44e3fa37f958b42cbcd41651f9f0a0eaaf3bac3f1f4b8eb456431623cb3bd8
F ext/misc/memstat.c 3017a0832c645c0f8c773435620d663855f04690172316bd127270d1a7523d4d F ext/misc/memstat.c 3017a0832c645c0f8c773435620d663855f04690172316bd127270d1a7523d4d
F ext/misc/memtrace.c 7c0d115d2ef716ad0ba632c91e05bd119cb16c1aedf3bec9f06196ead2d5537b F ext/misc/memtrace.c 7c0d115d2ef716ad0ba632c91e05bd119cb16c1aedf3bec9f06196ead2d5537b
F ext/misc/memvfs.c ab36f49e02ebcdf85a1e08dc4d8599ea8f343e073ac9e0bca18a98b7e1ec9567 F ext/misc/memvfs.c ab36f49e02ebcdf85a1e08dc4d8599ea8f343e073ac9e0bca18a98b7e1ec9567
F ext/misc/mmapwarm.c 8c5fe90d807a23e44a8b93e96e8b812b19b300d5fd8c1d40a4fd1d8224e33f46 F ext/misc/mmapwarm.c 8c5fe90d807a23e44a8b93e96e8b812b19b300d5fd8c1d40a4fd1d8224e33f46
F ext/misc/nextchar.c 279f80fe8ef5ba413242e2704e246503ac601f005eefb180d19e6c920338a0ba F ext/misc/nextchar.c 7877914c2a80c2f181dd04c3dbef550dfb54c93495dc03da2403b5dd58f34edd
F ext/misc/noop.c 05e8263fb9998d675b5714a3d280b284b19ffe65256d6856fec807948485f6f0
F ext/misc/normalize.c b4290464f542bae7a97b43f15bd197949b833ffd668b7c313631bd5d4610212c F ext/misc/normalize.c b4290464f542bae7a97b43f15bd197949b833ffd668b7c313631bd5d4610212c
F ext/misc/percentile.c 148dd07286b16e50f232bb638a47850085ad37d51f270429905bd865e595d1ca F ext/misc/percentile.c b9086e223d583bdaf8cb73c98a6539d501a2fc4282654adbfea576453d82e691
F ext/misc/prefixes.c 7be86d17525cfae6ed462fc3c519efc44488ac329890f77491c8f82871f57e17 F ext/misc/prefixes.c 0f4f8cff5aebc00a7e3ac4021fd59cfe1a8e17c800ceaf592859ecb9cbc38196
F ext/misc/regexp.c be064ad9478361e40c7b8ca460f78b3d3c9b96080d5f391126c95e14bd362fae F ext/misc/regexp.c 246244c714267f303df76acf73dcf110cf2eaf076896aaaba8db6d6d21a129db
F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c F ext/misc/remember.c add730f0f7e7436cd15ea3fd6a90fd83c3f706ab44169f7f048438b7d6baa69c
F ext/misc/rot13.c 540a169cb0d74f15522a8930b0cccdcb37a4fd071d219a5a083a319fc6e8db77 F ext/misc/rot13.c 51ac5f51e9d5fd811db58a9c23c628ad5f333c173f1fc53c8491a3603d38556c
F ext/misc/scrub.c db9fff56fed322ca587d73727c6021b11ae79ce3f31b389e1d82891d144f22ad F ext/misc/scrub.c db9fff56fed322ca587d73727c6021b11ae79ce3f31b389e1d82891d144f22ad
F ext/misc/series.c 0c97f63378fddc9f425e82ba139b9aaf902211f24ced115c2b6ae12b425f7334 F ext/misc/series.c a733a77d152983cc5d337c9df7b358ad17cfb44965476843cd03e2f571054914
F ext/misc/sha1.c d8125a88ee9023bc17d6f87ea8850db33f906d5701b30d4fd9bddb57f231e60a F ext/misc/sha1.c 1190aec0d9d886d9f5ffdf891142a626812327d11472c0cade3489db3b7b140a
F ext/misc/shathree.c 22ba7ca84a433d6466a7d05dcc876910b435a715da8cc462517db9351412b8c8 F ext/misc/shathree.c 135b7c145db4a09b1650c3e7aff9cb538763a9a361e834c015dd1aaf8d5c9a00
F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52
F ext/misc/spellfix.c f88ecb2c0294453ce8b7704b211f5350c41b085b38c8e056852e3a08b0f5e484 F ext/misc/spellfix.c 5cb7e1876925508aeef0e5ecd5ec8dab6089e09fa44cbf4322d5cb7a821a53f9
F ext/misc/sqlar.c 57d5bc45cd5492208e451f697404be88f8612527d64c9d42f96b325b64983d74 F ext/misc/sqlar.c c9e5d58544e1506135806a1e0f525f92d4bb6bb125348dce469d778fb334fbce
F ext/misc/stmt.c 8a8dc4675042e4551e4afe99b8d0cc7a4a2fc1a8dacc0a9ce1b1bbff145da93d F ext/misc/stmt.c 8a8dc4675042e4551e4afe99b8d0cc7a4a2fc1a8dacc0a9ce1b1bbff145da93d
F ext/misc/templatevtab.c 8a16a91a5ceaccfcbd6aaaa56d46828806e460dd194965b3f77bf38f14b942c4 F ext/misc/templatevtab.c 8a16a91a5ceaccfcbd6aaaa56d46828806e460dd194965b3f77bf38f14b942c4
F ext/misc/totype.c 5b6b1eafaa993e29f8df843319b3292b029f1b5cbbbf11c8a88e05d3f714159f F ext/misc/totype.c fa4aedeb07f66169005dffa8de3b0a2b621779fd44f85c103228a42afa71853b
F ext/misc/unionvtab.c 36237f0607ca954ac13a4a0e2d2ac40c33bc6e032a5f55f431713061ef1625f9 F ext/misc/unionvtab.c 36237f0607ca954ac13a4a0e2d2ac40c33bc6e032a5f55f431713061ef1625f9
F ext/misc/uuid.c db4db81e8c6a92ad6176ebd9f81dcb6870e331e1a286d0452f4319e3ba3df812 F ext/misc/uuid.c 5bb2264c1b64d163efa46509544fd7500cb8769cb7c16dd52052da8d961505cf
F ext/misc/vfslog.c 3b25c2f56ba60788db247287be6ab024b53c4afffd412b4876db563389be0d35 F ext/misc/vfslog.c 3b25c2f56ba60788db247287be6ab024b53c4afffd412b4876db563389be0d35
F ext/misc/vfsstat.c 77b5b4235c9f7f11eddf82487c0a422944ac2f132dafd5af3be7a68a057b1cdb F ext/misc/vfsstat.c 77b5b4235c9f7f11eddf82487c0a422944ac2f132dafd5af3be7a68a057b1cdb
F ext/misc/vtablog.c 5538acd0c8ddaae372331bee11608d76973436b77d6a91e8635cfc9432fba5ae F ext/misc/vtablog.c 5538acd0c8ddaae372331bee11608d76973436b77d6a91e8635cfc9432fba5ae
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212 F ext/misc/wholenumber.c 520f34c3099e5b7d546f13708607dc2fa173c46b68952eecf0d19cd675fec85e
F ext/misc/zipfile.c 529c6e962e7dd39aa6f6aa6859f8c86af8af36833de270f27fa60135bb16c5d9 F ext/misc/zipfile.c b09f38ccd4b9666b8e152f71c33ee381c8c2d6939203ac896c174e4c6fc6bc4a
F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64 F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64
F ext/rbu/rbu.c 8681f6157db6adc82c34af24b14ea8a3be0146ad2a3b6c1d5da6cb8a5796c8ce F ext/rbu/rbu.c 8681f6157db6adc82c34af24b14ea8a3be0146ad2a3b6c1d5da6cb8a5796c8ce
F ext/rbu/rbu1.test 221d9c18a5e600ac9ac6b1810d99d9f99163a7909ba61597876ab6e4d4beb3d6 F ext/rbu/rbu1.test 221d9c18a5e600ac9ac6b1810d99d9f99163a7909ba61597876ab6e4d4beb3d6
@@ -380,7 +382,7 @@ F ext/repair/test/checkfreelist01.test 3e8aa6aeb4007680c94a8d07b41c339aa635cc782
F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c335096108c12c01bddbadcec F ext/repair/test/checkindex01.test b530f141413b587c9eb78ff734de6bb79bc3515c335096108c12c01bddbadcec
F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c F ext/repair/test/test.tcl 686d76d888dffd021f64260abf29a55c57b2cedfa7fc69150b42b1d6119aac3c
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
F ext/rtree/geopoly.c 4f176fa4d954997e8880f8b75e15b578765b4f471e359b73020b3d4e1defe958 F ext/rtree/geopoly.c cac70b5502742bd0ba8877a1329a74e86a379c78567546a2a18cf5f9c3787f73
F ext/rtree/rtree.c 84b939a9a558edd0461bb976b98f60012e3e574b3b17a0f44533d6f2a9aa2f2e F ext/rtree/rtree.c 84b939a9a558edd0461bb976b98f60012e3e574b3b17a0f44533d6f2a9aa2f2e
F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412 F ext/rtree/rtree.h 4a690463901cb5e6127cf05eb8e642f127012fd5003830dbc974eca5802d9412
F ext/rtree/rtree1.test 4092a8bd2b5eafc4fafe4fe9024249c12b13e4bab23c2c3eaff57412fdf805fa F ext/rtree/rtree1.test 4092a8bd2b5eafc4fafe4fe9024249c12b13e4bab23c2c3eaff57412fdf805fa
@@ -464,7 +466,7 @@ F sqlite3.1 fc7ad8990fc8409983309bb80de8c811a7506786
F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
F src/alter.c f48a4423c8f198d7f1ae4940f74b606707d05384ac79fb219be8e3323af2a2de F src/alter.c f48a4423c8f198d7f1ae4940f74b606707d05384ac79fb219be8e3323af2a2de
F src/analyze.c b3ceec3fc052df8a96ca8a8c858d455dc5029ba681b4be98bb5c5a9162cfa58c F src/analyze.c b3ceec3fc052df8a96ca8a8c858d455dc5029ba681b4be98bb5c5a9162cfa58c
F src/attach.c b30c44333d55a68c0a12920b5b9d40b254cbd3d4509bda77417209eeed8b3d80 F src/attach.c df0ead9091042c68964856ecc08dba55d5403ad5f3ca865d9d396d71528c511a
F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06 F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06
F src/backup.c f70077d40c08b7787bfe934e4d1da8030cb0cc57d46b345fba2294b7d1be23ab F src/backup.c f70077d40c08b7787bfe934e4d1da8030cb0cc57d46b345fba2294b7d1be23ab
F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33 F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33
@@ -472,15 +474,15 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
F src/btree.c d70000b51523138582663b578b7f8a13e5d03c73c7c7ef18fdeafe1c234bbc3c F src/btree.c d70000b51523138582663b578b7f8a13e5d03c73c7c7ef18fdeafe1c234bbc3c
F src/btree.h 6111552f19ed7a40f029cf4b33badc6fef9880314fffd80a945f0b7f43ab7471 F src/btree.h 6111552f19ed7a40f029cf4b33badc6fef9880314fffd80a945f0b7f43ab7471
F src/btreeInt.h 6794084fad08c9750b45145743c0e3e5c27c94dee89f26dd8df7073314934fd2 F src/btreeInt.h 6794084fad08c9750b45145743c0e3e5c27c94dee89f26dd8df7073314934fd2
F src/build.c 67b1a8d3ac700747687dbdc49ded847a3c17fef450a8c919ac0399b44cbd4215 F src/build.c bd2f382562b08f14748d54402220be1082c2f8ff8973fad47e45a381c438f9bf
F src/callback.c 88615dfc0a82167b65b452b4b305dbf86be77200b3343c6ffc6d03e92a01d181 F src/callback.c c547d00963ae28100117b4fb1f0f32242109b5804374ee3bfe01138a54da7f76
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 1b0724e66f95f33b160b1af85caaf9cceb325d22abf39bd24df4f54a73982251 F src/ctime.c 1b0724e66f95f33b160b1af85caaf9cceb325d22abf39bd24df4f54a73982251
F src/date.c e1d8ac7102f3f283e63e13867acb0efa33861cf34f0faf4cdbaf9fa7a1eb7041 F src/date.c e1d8ac7102f3f283e63e13867acb0efa33861cf34f0faf4cdbaf9fa7a1eb7041
F src/dbpage.c 135eb3b5e74f9ef74bde5cec2571192c90c86984fa534c88bf4a055076fa19b7 F src/dbpage.c 8a01e865bf8bc6d7b1844b4314443a6436c07c3efe1d488ed89e81719047833a
F src/dbstat.c 5125f559b33787a29f7ded750f2a69080f50a85bced98fe8ad02a99e543c4b44 F src/dbstat.c 0f55297469d4244ab7df395849e1af98eb5e95816af7c661e7d2d8402dea23da
F src/delete.c a5c59b9c0251cf7682bc52af0d64f09b1aefc6781a63592c8f1136f7b73c66e4 F src/delete.c a5c59b9c0251cf7682bc52af0d64f09b1aefc6781a63592c8f1136f7b73c66e4
F src/expr.c d8854187a79c7798184c15982a25f457badf35eb3942d40e13ac292670fe996d F src/expr.c 003c59158b33d7f3b198122cb0d1e13c06517cc3932e56b42283eb0e96696d66
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007 F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c 92a248ec0fa4ed8ab60c98d9b188ce173aaf218f32e7737ba77deb2a684f9847 F src/fkey.c 92a248ec0fa4ed8ab60c98d9b188ce173aaf218f32e7737ba77deb2a684f9847
F src/func.c 259496e4856bd0a3215d16804992f3339f3e8db29f129a5a7285c341488bbe9c F src/func.c 259496e4856bd0a3215d16804992f3339f3e8db29f129a5a7285c341488bbe9c
@@ -492,7 +494,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
F src/insert.c 5ba8fd376f539240939ae76b5bc9fa7ad9a0d86e9914ecd11eb7002204138c11 F src/insert.c 5ba8fd376f539240939ae76b5bc9fa7ad9a0d86e9914ecd11eb7002204138c11
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
F src/loadext.c d74f5e7bd51f3c9d283442473eb65aef359664efd6513591c03f01881c4ae2da F src/loadext.c d74f5e7bd51f3c9d283442473eb65aef359664efd6513591c03f01881c4ae2da
F src/main.c 07b5259e712bc479f0d7b51feaceab6ae3a4e08019a7ddad004562d56c317701 F src/main.c 6ba00f15f0e7d36a12136ac390a403de4c4b47b76733d1cad60c2b23b4a2cf1d
F src/malloc.c eaa4dc9602ce28b077f7de2eb275db2be270c5cc56d7fec5466301bd9b80e2f5 F src/malloc.c eaa4dc9602ce28b077f7de2eb275db2be270c5cc56d7fec5466301bd9b80e2f5
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
@@ -521,23 +523,23 @@ F src/parse.y c8d2de64db469fd56e0fa24da46cd8ec8523eb98626567d2708df371b47fdc3f
F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177 F src/pcache.c 385ff064bca69789d199a98e2169445dc16e4291fa807babd61d4890c3b34177
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586 F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a F src/pcache1.c 6596e10baf3d8f84cc1585d226cf1ab26564a5f5caf85a15757a281ff977d51a
F src/pragma.c 26e9ee514138b9697d4be6d8f9ca84655053026390cf10de838862238aa4aba9 F src/pragma.c 9145cc0d7309b49d383fe15deca9ab592830b8b532e7fb25e9e36b6f470cbf66
F src/pragma.h ec3b31eac9b1df040f1cc8cb3d89bc06605c3b4cb3d76f833de8d6d6c3f77f04 F src/pragma.h 9f86a3a3a0099e651189521c8ad03768df598974e7bbdc21c7f9bb6125592fbd
F src/prepare.c 6049beb71385f017af6fc320d2c75a4e50b75e280c54232442b785fbb83df057 F src/prepare.c 6049beb71385f017af6fc320d2c75a4e50b75e280c54232442b785fbb83df057
F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4 F src/printf.c 9be6945837c839ba57837b4bc3af349eba630920fa5532aa518816defe42a7d4
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c 31dc20837034491e5a043f411425a507b306ceedf40d666af5fc87b13020ff3d F src/resolve.c 1139e3157c710c6e6f04fe726f4e0d8bdb1ae89a276d3b0ca4975af163141c9c
F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93
F src/select.c c88a3597dac910ba647b9bf2777395df7efc2f90d928ce01ef6920a33df27b78 F src/select.c 924b61cef57033a8ca1ed3dcffd02445a7dd0c837cc849b2e4117251cac831f5
F src/shell.c.in 90b002bf0054399cbbfac62dd752a9b05770427ba141bcba75eefbb0098f4280 F src/shell.c.in 43d3cfbee97d78ca5782dc53e4c1e22d3cc15c91beff20889dc60551f47eab9f
F src/sqlite.h.in 172a88e0d1e42f7d10cb8865d6f51c3b8fcc024ac9206806057da7a8b0c646b8 F src/sqlite.h.in 06452043348e35cf6108345a35574a2faa4d1c2829beefb1e73c73d6bfb2fa80
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 72af51aa4e912e14cd495fb6e7fac65f0940db80ed950d90911aff292cc47ce2 F src/sqlite3ext.h 72af51aa4e912e14cd495fb6e7fac65f0940db80ed950d90911aff292cc47ce2
F src/sqliteInt.h a694b38db1748007390cbafcaba56d5379203c23ab5ae7d3a538f367e8638102 F src/sqliteInt.h ee242902766f9a96aeaca4315dbe1e204bbb2954cd455ffa085bba84fa47956b
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c 9ff2210207c6c3b4d9631a8241a7d45ab1b26a0e9c84cb07a9b5ce2de9a3b278 F src/status.c 9ff2210207c6c3b4d9631a8241a7d45ab1b26a0e9c84cb07a9b5ce2de9a3b278
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
F src/tclsqlite.c 8cd2600e8de23dff6cdf84d39f46ca57139b061b28f6f80b166bace17d52ab1c F src/tclsqlite.c f2dae14bfe7a35c94b6d515df88071014678ec39dafebdcf8e6bde91d62516c1
F src/test1.c 4d0ab2f67053a4fff87d1d3586ecc0e5322a1fc45dd4119ab11dc96de44f17a1 F src/test1.c 4d0ab2f67053a4fff87d1d3586ecc0e5322a1fc45dd4119ab11dc96de44f17a1
F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5 F src/test2.c 3efb99ab7f1fc8d154933e02ae1378bac9637da5
F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644 F src/test3.c 61798bb0d38b915067a8c8e03f5a534b431181f802659a6616f9b4ff7d872644
@@ -593,7 +595,7 @@ F src/test_window.c cdae419fdcea5bad6dcd9368c685abdad6deb59e9fc8b84b153de513d394
F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9
F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c F src/threads.c 4ae07fa022a3dc7c5beb373cf744a85d3c5c6c3c
F src/tokenize.c 7b17f6e2f20f6cbcb0b215025a86b7457c38451fc7622f705e553d7a488c572d F src/tokenize.c 7b17f6e2f20f6cbcb0b215025a86b7457c38451fc7622f705e553d7a488c572d
F src/treeview.c 2f712c821748dccced8977c33de83146e75a193afd17da3da8ad64e0225fee20 F src/treeview.c 438c1000587b33faba35e87596bebcf7f40638d98f33781cdd9e04711b18b09c
F src/trigger.c a40d50e88bd3355f1d2a73f0a3b2d6b42eae26ca4219001b82ef0d064439badc F src/trigger.c a40d50e88bd3355f1d2a73f0a3b2d6b42eae26ca4219001b82ef0d064439badc
F src/update.c 9ad19af96aff95dc02a923a99f97c1bc0b909009a29a2914b796f786b9ac0c60 F src/update.c 9ad19af96aff95dc02a923a99f97c1bc0b909009a29a2914b796f786b9ac0c60
F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78 F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78
@@ -609,7 +611,7 @@ F src/vdbeblob.c 253ed82894924c362a7fa3079551d3554cd1cdace39aa833da77d3bc67e7c1b
F src/vdbemem.c ad9e6217635f2b04df98bc57b12c98cefc9c0a1745cca47f4e8109119213253d F src/vdbemem.c ad9e6217635f2b04df98bc57b12c98cefc9c0a1745cca47f4e8109119213253d
F src/vdbesort.c a3be032cc3fee0e3af31773af4a7a6f931b7230a34f53282ccf1d9a2a72343be F src/vdbesort.c a3be032cc3fee0e3af31773af4a7a6f931b7230a34f53282ccf1d9a2a72343be
F src/vdbetrace.c fa3bf238002f0bbbdfb66cc8afb0cea284ff9f148d6439bc1f6f2b4c3b7143f0 F src/vdbetrace.c fa3bf238002f0bbbdfb66cc8afb0cea284ff9f148d6439bc1f6f2b4c3b7143f0
F src/vtab.c a2fead3e97fca54fcf3f3db784e17c9ee2d39a0c5ad323e9d514855106300a86 F src/vtab.c 7b704a90515a239c6cdba6a66b1bb3a385e62326cceb5ecb05ec7a091d6b8515
F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
F src/wal.c 15a2845769f51ba132f9cf0b2c7a6887a91fc8437892dbcce9fcdc68b66d60a1 F src/wal.c 15a2845769f51ba132f9cf0b2c7a6887a91fc8437892dbcce9fcdc68b66d60a1
F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a
@@ -929,7 +931,7 @@ F test/fts3al.test 07d64326e79bbdbab20ee87fc3328fbf01641c9f
F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8 F test/fts3am.test 218aa6ba0dfc50c7c16b2022aac5c6be593d08d8
F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18 F test/fts3an.test a49ccadc07a2f7d646ec1b81bc09da2d85a85b18
F test/fts3ao.test 266989148fec6d9f1bb6c5382f7aa3dcea0e9cd444576e28dd2b9287ac7dd220 F test/fts3ao.test 266989148fec6d9f1bb6c5382f7aa3dcea0e9cd444576e28dd2b9287ac7dd220
F test/fts3atoken.test 2b2b0d7943eccf76e7a4887b557d4abcbb9279fbbb88e2bc2eba31c1817d11c7 F test/fts3atoken.test dc2078ce464914efe3a8dfc545dd034a0fc14f2ab425c240471d5a5f1c721400
F test/fts3auto.test bfe0857bd0b69d68dd685a931b58486411a69f5794a7f6d6fe808bfa31a99614 F test/fts3auto.test bfe0857bd0b69d68dd685a931b58486411a69f5794a7f6d6fe808bfa31a99614
F test/fts3aux1.test 7a170e172afdbceb67f5baa05941fd4fbf56af42f61daa3d140f4b4bf4cb68f6 F test/fts3aux1.test 7a170e172afdbceb67f5baa05941fd4fbf56af42f61daa3d140f4b4bf4cb68f6
F test/fts3aux2.test 2459e7fa3e22734aed237d1e2ae192f5541c4d8b218956ad2d90754977bf907f F test/fts3aux2.test 2459e7fa3e22734aed237d1e2ae192f5541c4d8b218956ad2d90754977bf907f
@@ -997,7 +999,7 @@ F test/fts4rename.test 15fd9985c2bce6dea20da2245b22029ec89bd4710ed317c4c53abbe3c
F test/fts4umlaut.test fcaca4471de7e78c9d1f7e8976e3e8704d7d8ad979d57a739d00f3f757380429 F test/fts4umlaut.test fcaca4471de7e78c9d1f7e8976e3e8704d7d8ad979d57a739d00f3f757380429
F test/fts4unicode.test ceca76422abc251818cb25dabe33d3c3970da5f7c90e1540f190824e6b3a7c95 F test/fts4unicode.test ceca76422abc251818cb25dabe33d3c3970da5f7c90e1540f190824e6b3a7c95
F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d F test/full.test 6b3c8fb43c6beab6b95438c1675374b95fab245d
F test/func.test 7d425f9a6eaa2c50baa751bef6b0c6c6af1751e0e0e1eb4863d426bb4c886788 F test/func.test 93d692f6427bd01b39c6ddb1e2d728f5264abefdbdd56e2f95c9dc1fa7dbcb53
F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f F test/func2.test 772d66227e4e6684b86053302e2d74a2500e1e0f
F test/func3.test 2bb0f31ab7baaed690b962a88544d7be6b34fa389364bc36a44e441ed3e3f1e6 F test/func3.test 2bb0f31ab7baaed690b962a88544d7be6b34fa389364bc36a44e441ed3e3f1e6
F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f F test/func4.test 6beacdfcb0e18c358e6c2dcacf1b65d1fa80955f
@@ -1232,7 +1234,7 @@ F test/pragma.test 59becdfd720b80d463ab750f69f7118fde10dfd556aa5d554f3bf6b7e5ea7
F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f F test/pragma2.test e5d5c176360c321344249354c0c16aec46214c9f
F test/pragma3.test 92a46bbea12322dd94a404f49edcfbfc913a2c98115f0d030a7459bb4712ef31 F test/pragma3.test 92a46bbea12322dd94a404f49edcfbfc913a2c98115f0d030a7459bb4712ef31
F test/pragma4.test 10c624e45a83c0096a82a7579a5ff658542391d3b77355192da6572c8c17c00b F test/pragma4.test 10c624e45a83c0096a82a7579a5ff658542391d3b77355192da6572c8c17c00b
F test/pragma5.test 2be6a44c91e8585ccb4c71c5f221ccebe0692a49557215a912916ed391188959 F test/pragma5.test 7b33fc43e2e41abf17f35fb73f71b49671a380ea92a6c94b6ce530a25f8d9102
F test/pragmafault.test 275edaf3161771d37de60e5c2b412627ac94cef11739236bec12ed1258b240f8 F test/pragmafault.test 275edaf3161771d37de60e5c2b412627ac94cef11739236bec12ed1258b240f8
F test/prefixes.test b524a1c44bffec225b9aec98bd728480352aa8532ac4c15771fb85e8beef65d9 F test/prefixes.test b524a1c44bffec225b9aec98bd728480352aa8532ac4c15771fb85e8beef65d9
F test/printf.test 0300699733e53101b2ce48800518427249edd4053bb50fa0621c6607482f0fdb F test/printf.test 0300699733e53101b2ce48800518427249edd4053bb50fa0621c6607482f0fdb
@@ -1401,7 +1403,7 @@ F test/tabfunc01.test 5ca6d004157a3e886a55a9387b960cc0db41acd88753eb597ff409ec6c
F test/table.test eb3463b7add9f16a5bb836badf118cf391b809d09fdccd1f79684600d07ec132 F test/table.test eb3463b7add9f16a5bb836badf118cf391b809d09fdccd1f79684600d07ec132
F test/tableapi.test ecbcc29c4ab62c1912c3717c48ea5c5e59f7d64e4a91034e6148bd2b82f177f4 F test/tableapi.test ecbcc29c4ab62c1912c3717c48ea5c5e59f7d64e4a91034e6148bd2b82f177f4
F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930 F test/tableopts.test dba698ba97251017b7c80d738c198d39ab747930
F test/tclsqlite.test c4a5f5af3672fbe28a0aa322b88d9d1ce2225b6b1284ea11ede2e6d38e7c812c F test/tclsqlite.test 6f8705d09377e2f2ff482ab181a1388773953a280623fff2ccab0e87d2bc10a2
F test/tempdb.test 4cdaa23ddd8acb4d79cbb1b68ccdfd09b0537aaba909ca69a876157c2a2cbd08 F test/tempdb.test 4cdaa23ddd8acb4d79cbb1b68ccdfd09b0537aaba909ca69a876157c2a2cbd08
F test/tempdb2.test 353864e96fd3ae2f70773d0ffbf8b1fe48589b02c2ec05013b540879410c3440 F test/tempdb2.test 353864e96fd3ae2f70773d0ffbf8b1fe48589b02c2ec05013b540879410c3440
F test/tempfault.test 0c0d349c9a99bf5f374655742577f8712c647900 F test/tempfault.test 0c0d349c9a99bf5f374655742577f8712c647900
@@ -1591,6 +1593,7 @@ F test/triggerD.test 8e7f3921a92a5797d472732108109e44575fa650
F test/triggerE.test ede2e4bce4ba802337bd69d39447fa04a938e06d84a8bfc53c76850fc36ed86d F test/triggerE.test ede2e4bce4ba802337bd69d39447fa04a938e06d84a8bfc53c76850fc36ed86d
F test/triggerF.test 5d76f0a8c428ff87a4d5ed52da06f6096a2c787a1e21b846111dfac4123de3ad F test/triggerF.test 5d76f0a8c428ff87a4d5ed52da06f6096a2c787a1e21b846111dfac4123de3ad
F test/triggerG.test d5caeef6144ede2426dd13211fd72248241ff2ebc68e12a4c0bf30f5faa21499 F test/triggerG.test d5caeef6144ede2426dd13211fd72248241ff2ebc68e12a4c0bf30f5faa21499
F test/trustschema1.test 4e970aef0bfe0cee139703cc7209d0e0f07725d999b180ba50770f49edef1494
F test/tt3_checkpoint.c 9e75cf7c1c364f52e1c47fd0f14c4340a9db0fe1 F test/tt3_checkpoint.c 9e75cf7c1c364f52e1c47fd0f14c4340a9db0fe1
F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a F test/tt3_index.c 39eec10a35f57672225be4d182862152896dee4a
F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9 F test/tt3_lookaside1.c 0377e202c3c2a50d688cb65ba203afeda6fafeb9
@@ -1786,7 +1789,7 @@ F tool/mkmsvcmin.tcl 6ecab9fe22c2c8de4d82d4c46797bda3d2deac8e763885f5a38d0c44a89
F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c F tool/mkopcodec.tcl d1b6362bd3aa80d5520d4d6f3765badf01f6c43c
F tool/mkopcodeh.tcl 352a4319c0ad869eb26442bf7c3b015aa15594c21f1cce5a6420dbe999367c21 F tool/mkopcodeh.tcl 352a4319c0ad869eb26442bf7c3b015aa15594c21f1cce5a6420dbe999367c21
F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa F tool/mkopts.tcl 680f785fdb09729fd9ac50632413da4eadbdf9071535e3f26d03795828ab07fa
F tool/mkpragmatab.tcl 70269c7013dab01c5d366b1bb4cee6e42fa1a3a8d179a052d14d6b31f11ad77f F tool/mkpragmatab.tcl ca12b1c718ececdab2d3aacb437bc3c81ebf68467f19d7974e17f18844a3a48f
F tool/mkshellc.tcl 70a9978e363b0f3280ca9ce1c46d72563ff479c1930a12a7375e3881b7325712 F tool/mkshellc.tcl 70a9978e363b0f3280ca9ce1c46d72563ff479c1930a12a7375e3881b7325712
F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9 F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b079b9
F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
@@ -1853,7 +1856,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P edbf911fdeda14bd63cd752f6237896400eb5a65ef486abe7b91433621d21b5c P 966964af1021feebc56cfda7b08bc787be7f447d682299f7958463aca30a73af 318ff7720bc60c30c0826becce424226e9cec25c1d59cb2cdb75793739322760
R 5de0c500f4348137cfdd6d83ca68c4d0 R ec8956333831ac4459fab3e97cbd448b
T +closed 318ff7720bc60c30c0826becce424226e9cec25c1d59cb2cdb75793739322760
U drh U drh
Z 5f03761b5ba3e6acc7ad4fa15e74a7e4 Z 4b9d0a450dea6d3979baa9a1ef60417a

View File

@@ -1 +1 @@
966964af1021feebc56cfda7b08bc787be7f447d682299f7958463aca30a73af 5720924cb07766cd54fb042da58f4b4acf12b60029fba86a23a606ad0d0f7c68

View File

@@ -477,7 +477,7 @@ void sqlite3FixInit(
pFix->pSchema = db->aDb[iDb].pSchema; pFix->pSchema = db->aDb[iDb].pSchema;
pFix->zType = zType; pFix->zType = zType;
pFix->pName = pName; pFix->pName = pName;
pFix->bVarOnly = (iDb==1); pFix->bTemp = (iDb==1);
} }
/* /*
@@ -505,7 +505,7 @@ int sqlite3FixSrcList(
if( NEVER(pList==0) ) return 0; if( NEVER(pList==0) ) return 0;
zDb = pFix->zDb; zDb = pFix->zDb;
for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){ for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
if( pFix->bVarOnly==0 ){ if( pFix->bTemp==0 ){
if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){ if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){
sqlite3ErrorMsg(pFix->pParse, sqlite3ErrorMsg(pFix->pParse,
"%s %T cannot reference objects in database %s", "%s %T cannot reference objects in database %s",
@@ -515,6 +515,7 @@ int sqlite3FixSrcList(
sqlite3DbFree(pFix->pParse->db, pItem->zDatabase); sqlite3DbFree(pFix->pParse->db, pItem->zDatabase);
pItem->zDatabase = 0; pItem->zDatabase = 0;
pItem->pSchema = pFix->pSchema; pItem->pSchema = pFix->pSchema;
pItem->fg.fromDDL = 1;
} }
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1; if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
@@ -570,7 +571,7 @@ int sqlite3FixExpr(
Expr *pExpr /* The expression to be fixed to one database */ Expr *pExpr /* The expression to be fixed to one database */
){ ){
while( pExpr ){ while( pExpr ){
ExprSetProperty(pExpr, EP_Indirect); if( !pFix->bTemp ) ExprSetProperty(pExpr, EP_FromDDL);
if( pExpr->op==TK_VARIABLE ){ if( pExpr->op==TK_VARIABLE ){
if( pFix->pParse->db->init.busy ){ if( pFix->pParse->db->init.busy ){
pExpr->op = TK_NULL; pExpr->op = TK_NULL;

View File

@@ -1404,8 +1404,9 @@ void sqlite3AddDefaultValue(
sqlite3 *db = pParse->db; sqlite3 *db = pParse->db;
p = pParse->pNewTable; p = pParse->pNewTable;
if( p!=0 ){ if( p!=0 ){
int isInit = db->init.busy && db->init.iDb!=1;
pCol = &(p->aCol[p->nCol-1]); pCol = &(p->aCol[p->nCol-1]);
if( !sqlite3ExprIsConstantOrFunction(pExpr, db->init.busy) ){ if( !sqlite3ExprIsConstantOrFunction(pExpr, isInit) ){
sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant",
pCol->zName); pCol->zName);
#ifndef SQLITE_OMIT_GENERATED_COLUMNS #ifndef SQLITE_OMIT_GENERATED_COLUMNS

View File

@@ -288,12 +288,13 @@ static int matchQuality(
u8 enc /* Desired text encoding */ u8 enc /* Desired text encoding */
){ ){
int match; int match;
assert( p->nArg>=-1 );
/* nArg of -2 is a special case */
if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH;
/* Wrong number of arguments means "no match" */ /* Wrong number of arguments means "no match" */
if( p->nArg!=nArg && p->nArg>=0 ) return 0; if( p->nArg!=nArg ){
if( nArg==(-2) ) return (p->xSFunc==0) ? 0 : FUNC_PERFECT_MATCH;
if( p->nArg>=0 ) return 0;
}
/* Give a better score to a function with a specific number of arguments /* Give a better score to a function with a specific number of arguments
** than to function that accepts any number of arguments. */ ** than to function that accepts any number of arguments. */

View File

@@ -73,6 +73,7 @@ static int dbpageConnect(
DbpageTable *pTab = 0; DbpageTable *pTab = 0;
int rc = SQLITE_OK; int rc = SQLITE_OK;
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
rc = sqlite3_declare_vtab(db, rc = sqlite3_declare_vtab(db,
"CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)"); "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){

View File

@@ -167,6 +167,7 @@ static int statConnect(
}else{ }else{
iDb = 0; iDb = 0;
} }
sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY);
rc = sqlite3_declare_vtab(db, zDbstatSchema); rc = sqlite3_declare_vtab(db, zDbstatSchema);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable)); pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable));

View File

@@ -973,6 +973,40 @@ Expr *sqlite3ExprFunction(
return pNew; return pNew;
} }
/*
** Check to see if a function is usable according to current access
** rules:
**
** SQLITE_FUNC_DIRECT - Only usable from top-level SQL
**
** SQLITE_FUNC_UNSAFE - Usable if TRUSTED_SCHEMA or from
** top-level SQL
**
** If the function is not usable, create an error.
*/
void sqlite3ExprFunctionUsable(
Parse *pParse, /* Parsing and code generating context */
Expr *pExpr, /* The function invocation */
FuncDef *pDef /* The function being invoked */
){
assert( !IN_RENAME_OBJECT );
assert( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 );
if( ExprHasProperty(pExpr, EP_FromDDL) ){
if( (pDef->funcFlags & SQLITE_FUNC_DIRECT)!=0
|| (pParse->db->flags & SQLITE_TrustedSchema)==0
){
/* Functions prohibited in triggers and views if:
** (1) tagged with SQLITE_DIRECTONLY
** (2) not tagged with SQLITE_INNOCUOUS (which means it
** is tagged with SQLITE_FUNC_UNSAFE) and
** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning
** that the schema is possibly tainted).
*/
sqlite3ErrorMsg(pParse, "unsafe use of %s()", pDef->zName);
}
}
}
/* /*
** Assign a variable number to an expression that encodes a wildcard ** Assign a variable number to an expression that encodes a wildcard
** in the original SQL statement. ** in the original SQL statement.
@@ -1937,10 +1971,11 @@ Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){
** In all cases, the callbacks set Walker.eCode=0 and abort if the expression ** In all cases, the callbacks set Walker.eCode=0 and abort if the expression
** is found to not be a constant. ** is found to not be a constant.
** **
** The sqlite3ExprIsConstantOrFunction() is used for evaluating expressions ** The sqlite3ExprIsConstantOrFunction() is used for evaluating DEFAULT
** in a CREATE TABLE statement. The Walker.eCode value is 5 when parsing ** expressions in a CREATE TABLE statement. The Walker.eCode value is 5
** an existing schema and 4 when processing a new statement. A bound ** when parsing an existing schema out of the sqlite_master table and 4
** parameter raises an error for new statements, but is silently converted ** when processing a new CREATE TABLE statement. A bound parameter raises
** an error for new statements, but is silently converted
** to NULL for existing schemas. This allows sqlite_master tables that ** to NULL for existing schemas. This allows sqlite_master tables that
** contain a bound parameter because they were generated by older versions ** contain a bound parameter because they were generated by older versions
** of SQLite to be parsed by newer versions of SQLite without raising a ** of SQLite to be parsed by newer versions of SQLite without raising a
@@ -1964,6 +1999,7 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
if( (pWalker->eCode>=4 || ExprHasProperty(pExpr,EP_ConstFunc)) if( (pWalker->eCode>=4 || ExprHasProperty(pExpr,EP_ConstFunc))
&& !ExprHasProperty(pExpr, EP_WinFunc) && !ExprHasProperty(pExpr, EP_WinFunc)
){ ){
if( pWalker->eCode==5 ) ExprSetProperty(pExpr, EP_FromDDL);
return WRC_Continue; return WRC_Continue;
}else{ }else{
pWalker->eCode = 0; pWalker->eCode = 0;
@@ -2127,9 +2163,21 @@ int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprList *pGroupBy){
} }
/* /*
** Walk an expression tree. Return non-zero if the expression is constant ** Walk an expression tree for the DEFAULT field of a column definition
** or a function call with constant arguments. Return and 0 if there ** in a CREATE TABLE statement. Return non-zero if the expression is
** are any variables. ** acceptable for use as a DEFAULT. That is to say, return non-zero if
** the expression is constant or a function call with constant arguments.
** Return and 0 if there are any variables.
**
** isInit is true when parsing from sqlite_master. isInit is false when
** processing a new CREATE TABLE statement. When isInit is true, parameters
** (such as ? or $abc) in the expression are converted into NULL. When
** isInit is false, parameters raise an error. Parameters should not be
** allowed in a CREATE TABLE statement, but some legacy versions of SQLite
** allowed it, so we need to support it when reading sqlite_master for
** backwards compatibility.
**
** If isInit is true, set EP_FromDDL on every TK_FUNCTION node.
** **
** For the purposes of this function, a double-quoted string (ex: "abc") ** For the purposes of this function, a double-quoted string (ex: "abc")
** is considered a variable but a single-quoted string (ex: 'abc') is ** is considered a variable but a single-quoted string (ex: 'abc') is
@@ -4073,8 +4121,12 @@ expr_code_doover:
break; break;
} }
if( pDef->funcFlags & SQLITE_FUNC_INLINE ){ if( pDef->funcFlags & SQLITE_FUNC_INLINE ){
assert( (pDef->funcFlags & SQLITE_FUNC_UNSAFE)==0 );
assert( (pDef->funcFlags & SQLITE_FUNC_DIRECT)==0 );
return exprCodeInlineFunction(pParse, pFarg, return exprCodeInlineFunction(pParse, pFarg,
SQLITE_PTR_TO_INT(pDef->pUserData), target); SQLITE_PTR_TO_INT(pDef->pUserData), target);
}else if( pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE) ){
sqlite3ExprFunctionUsable(pParse, pExpr, pDef);
} }
for(i=0; i<nFarg; i++){ for(i=0; i<nFarg; i++){

View File

@@ -887,6 +887,7 @@ int sqlite3_db_config(sqlite3 *db, int op, ...){
{ SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL }, { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
{ SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML }, { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
{ SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt }, { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
{ SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
}; };
unsigned int i; unsigned int i;
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
@@ -1758,9 +1759,16 @@ int sqlite3CreateFunc(
assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC ); assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC );
assert( SQLITE_FUNC_DIRECT==SQLITE_DIRECTONLY ); assert( SQLITE_FUNC_DIRECT==SQLITE_DIRECTONLY );
extraFlags = enc & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY|SQLITE_SUBTYPE); extraFlags = enc & (SQLITE_DETERMINISTIC|SQLITE_DIRECTONLY|
SQLITE_SUBTYPE|SQLITE_INNOCUOUS);
enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY); enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY);
/* The SQLITE_INNOCUOUS flag is the same bit as SQLITE_FUNC_UNSAFE. But
** the meaning is inverted. So flip the bit. */
assert( SQLITE_FUNC_UNSAFE==SQLITE_INNOCUOUS );
extraFlags ^= SQLITE_FUNC_UNSAFE;
#ifndef SQLITE_OMIT_UTF16 #ifndef SQLITE_OMIT_UTF16
/* If SQLITE_UTF16 is specified as the encoding type, transform this /* If SQLITE_UTF16 is specified as the encoding type, transform this
** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the
@@ -1773,11 +1781,13 @@ int sqlite3CreateFunc(
enc = SQLITE_UTF16NATIVE; enc = SQLITE_UTF16NATIVE;
}else if( enc==SQLITE_ANY ){ }else if( enc==SQLITE_ANY ){
int rc; int rc;
rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8|extraFlags, rc = sqlite3CreateFunc(db, zFunctionName, nArg,
(SQLITE_UTF8|extraFlags)^SQLITE_FUNC_UNSAFE,
pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor); pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE|extraFlags, rc = sqlite3CreateFunc(db, zFunctionName, nArg,
pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor); (SQLITE_UTF16LE|extraFlags)^SQLITE_FUNC_UNSAFE,
pUserData, xSFunc, xStep, xFinal, xValue, xInverse, pDestructor);
} }
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
return rc; return rc;
@@ -3117,7 +3127,9 @@ static int openDatabase(
| SQLITE_EnableTrigger | SQLITE_EnableTrigger
| SQLITE_EnableView | SQLITE_EnableView
| SQLITE_CacheSpill | SQLITE_CacheSpill
#if !defined(SQLITE_TRUSTED_SCHEMA) || SQLITE_TRUSTED_SCHEMA+0!=0
| SQLITE_TrustedSchema
#endif
/* The SQLITE_DQS compile-time option determines the default settings /* The SQLITE_DQS compile-time option determines the default settings
** for SQLITE_DBCONFIG_DQS_DDL and SQLITE_DBCONFIG_DQS_DML. ** for SQLITE_DBCONFIG_DQS_DDL and SQLITE_DBCONFIG_DQS_DML.
** **

View File

@@ -295,6 +295,55 @@ static const PragmaName *pragmaLocate(const char *zName){
return lwr>upr ? 0 : &aPragmaName[mid]; return lwr>upr ? 0 : &aPragmaName[mid];
} }
/*
** Create zero or more entries in the output for the SQL functions
** defined by FuncDef p.
*/
static void pragmaFunclistLine(
Vdbe *v, /* The prepared statement being created */
FuncDef *p, /* A particular function definition */
int isBuiltin, /* True if this is a built-in function */
int showInternFuncs /* True if showing internal functions */
){
for(; p; p=p->pNext){
const char *zType;
static const u32 mask =
SQLITE_DETERMINISTIC |
SQLITE_DIRECTONLY |
SQLITE_SUBTYPE |
SQLITE_INNOCUOUS |
SQLITE_FUNC_INTERNAL
;
static const char *azEnc[] = { 0, "utf8", "utf16le", "utf16be" };
assert( SQLITE_FUNC_ENCMASK==0x3 );
assert( strcmp(azEnc[SQLITE_UTF8],"utf8")==0 );
assert( strcmp(azEnc[SQLITE_UTF16LE],"utf16le")==0 );
assert( strcmp(azEnc[SQLITE_UTF16BE],"utf16be")==0 );
if( p->xSFunc==0 ) continue;
if( (p->funcFlags & SQLITE_FUNC_INTERNAL)!=0
&& showInternFuncs==0
){
continue;
}
if( p->xValue!=0 ){
zType = "w";
}else if( p->xFinalize!=0 ){
zType = "a";
}else{
zType = "s";
}
sqlite3VdbeMultiLoad(v, 1, "sissii",
p->zName, isBuiltin,
zType, azEnc[p->funcFlags&SQLITE_FUNC_ENCMASK],
p->nArg,
(p->funcFlags & mask) ^ SQLITE_INNOCUOUS
);
}
}
/* /*
** Helper subroutine for PRAGMA integrity_check: ** Helper subroutine for PRAGMA integrity_check:
** **
@@ -1259,16 +1308,16 @@ void sqlite3Pragma(
int i; int i;
HashElem *j; HashElem *j;
FuncDef *p; FuncDef *p;
pParse->nMem = 2; int showInternFunc = (db->mDbFlags & DBFLAG_InternalFunc)!=0;
pParse->nMem = 6;
for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){ for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){
for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){ for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){
if( p->funcFlags & SQLITE_FUNC_INTERNAL ) continue; pragmaFunclistLine(v, p, 1, showInternFunc);
sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 1);
} }
} }
for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){ for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){
p = (FuncDef*)sqliteHashData(j); p = (FuncDef*)sqliteHashData(j);
sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 0); pragmaFunclistLine(v, p, 0, showInternFunc);
} }
} }
break; break;

View File

@@ -88,35 +88,39 @@ static const char *const pragCName[] = {
/* 18 */ "desc", /* 18 */ "desc",
/* 19 */ "coll", /* 19 */ "coll",
/* 20 */ "key", /* 20 */ "key",
/* 21 */ "tbl", /* Used by: stats */ /* 21 */ "name", /* Used by: function_list */
/* 22 */ "idx", /* 22 */ "builtin",
/* 23 */ "wdth", /* 23 */ "type",
/* 24 */ "hght", /* 24 */ "enc",
/* 25 */ "flgs", /* 25 */ "narg",
/* 26 */ "seq", /* Used by: index_list */ /* 26 */ "flags",
/* 27 */ "name", /* 27 */ "tbl", /* Used by: stats */
/* 28 */ "unique", /* 28 */ "idx",
/* 29 */ "origin", /* 29 */ "wdth",
/* 30 */ "partial", /* 30 */ "hght",
/* 31 */ "table", /* Used by: foreign_key_check */ /* 31 */ "flgs",
/* 32 */ "rowid", /* 32 */ "seq", /* Used by: index_list */
/* 33 */ "parent", /* 33 */ "name",
/* 34 */ "fkid", /* 34 */ "unique",
/* 35 */ "origin",
/* 36 */ "partial",
/* 37 */ "table", /* Used by: foreign_key_check */
/* 38 */ "rowid",
/* 39 */ "parent",
/* 40 */ "fkid",
/* index_info reuses 15 */ /* index_info reuses 15 */
/* 35 */ "seq", /* Used by: database_list */ /* 41 */ "seq", /* Used by: database_list */
/* 36 */ "name", /* 42 */ "name",
/* 37 */ "file", /* 43 */ "file",
/* 38 */ "busy", /* Used by: wal_checkpoint */ /* 44 */ "busy", /* Used by: wal_checkpoint */
/* 39 */ "log", /* 45 */ "log",
/* 40 */ "checkpointed", /* 46 */ "checkpointed",
/* 41 */ "name", /* Used by: function_list */ /* collation_list reuses 32 */
/* 42 */ "builtin", /* 47 */ "database", /* Used by: lock_status */
/* collation_list reuses 26 */ /* 48 */ "status",
/* 43 */ "database", /* Used by: lock_status */ /* 49 */ "cache_size", /* Used by: default_cache_size */
/* 44 */ "status",
/* 45 */ "cache_size", /* Used by: default_cache_size */
/* module_list pragma_list reuses 9 */ /* module_list pragma_list reuses 9 */
/* 46 */ "timeout", /* Used by: busy_timeout */ /* 50 */ "timeout", /* Used by: busy_timeout */
}; };
/* Definitions of all built-in pragmas */ /* Definitions of all built-in pragmas */
@@ -162,7 +166,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "busy_timeout", {/* zName: */ "busy_timeout",
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT, /* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
/* ePragFlg: */ PragFlg_Result0, /* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 46, 1, /* ColNames: */ 50, 1,
/* iArg: */ 0 }, /* iArg: */ 0 },
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{/* zName: */ "cache_size", {/* zName: */ "cache_size",
@@ -201,7 +205,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "collation_list", {/* zName: */ "collation_list",
/* ePragTyp: */ PragTyp_COLLATION_LIST, /* ePragTyp: */ PragTyp_COLLATION_LIST,
/* ePragFlg: */ PragFlg_Result0, /* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 26, 2, /* ColNames: */ 32, 2,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS) #if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
@@ -236,14 +240,14 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "database_list", {/* zName: */ "database_list",
/* ePragTyp: */ PragTyp_DATABASE_LIST, /* ePragTyp: */ PragTyp_DATABASE_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
/* ColNames: */ 35, 3, /* ColNames: */ 41, 3,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED) #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
{/* zName: */ "default_cache_size", {/* zName: */ "default_cache_size",
/* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE, /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
/* ColNames: */ 45, 1, /* ColNames: */ 49, 1,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
@@ -273,7 +277,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "foreign_key_check", {/* zName: */ "foreign_key_check",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK, /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
/* ColNames: */ 31, 4, /* ColNames: */ 37, 4,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#if !defined(SQLITE_OMIT_FOREIGN_KEY) #if !defined(SQLITE_OMIT_FOREIGN_KEY)
@@ -316,7 +320,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "function_list", {/* zName: */ "function_list",
/* ePragTyp: */ PragTyp_FUNCTION_LIST, /* ePragTyp: */ PragTyp_FUNCTION_LIST,
/* ePragFlg: */ PragFlg_Result0, /* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 41, 2, /* ColNames: */ 21, 6,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#endif #endif
@@ -362,7 +366,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "index_list", {/* zName: */ "index_list",
/* ePragTyp: */ PragTyp_INDEX_LIST, /* ePragTyp: */ PragTyp_INDEX_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
/* ColNames: */ 26, 5, /* ColNames: */ 32, 5,
/* iArg: */ 0 }, /* iArg: */ 0 },
{/* zName: */ "index_xinfo", {/* zName: */ "index_xinfo",
/* ePragTyp: */ PragTyp_INDEX_INFO, /* ePragTyp: */ PragTyp_INDEX_INFO,
@@ -414,7 +418,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "lock_status", {/* zName: */ "lock_status",
/* ePragTyp: */ PragTyp_LOCK_STATUS, /* ePragTyp: */ PragTyp_LOCK_STATUS,
/* ePragFlg: */ PragFlg_Result0, /* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 43, 2, /* ColNames: */ 47, 2,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
@@ -562,7 +566,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "stats", {/* zName: */ "stats",
/* ePragTyp: */ PragTyp_STATS, /* ePragTyp: */ PragTyp_STATS,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
/* ColNames: */ 21, 5, /* ColNames: */ 27, 5,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
@@ -613,6 +617,13 @@ static const PragmaName aPragmaName[] = {
/* ePragFlg: */ PragFlg_Result0, /* ePragFlg: */ PragFlg_Result0,
/* ColNames: */ 0, 0, /* ColNames: */ 0, 0,
/* iArg: */ 0 }, /* iArg: */ 0 },
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{/* zName: */ "trusted_schema",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_TrustedSchema },
#endif
#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) #if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS)
{/* zName: */ "user_version", {/* zName: */ "user_version",
/* ePragTyp: */ PragTyp_HEADER_VALUE, /* ePragTyp: */ PragTyp_HEADER_VALUE,
@@ -658,7 +669,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "wal_checkpoint", {/* zName: */ "wal_checkpoint",
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT, /* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
/* ePragFlg: */ PragFlg_NeedSchema, /* ePragFlg: */ PragFlg_NeedSchema,
/* ColNames: */ 38, 3, /* ColNames: */ 44, 3,
/* iArg: */ 0 }, /* iArg: */ 0 },
#endif #endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
@@ -669,4 +680,4 @@ static const PragmaName aPragmaName[] = {
/* iArg: */ SQLITE_WriteSchema|SQLITE_NoSchemaError }, /* iArg: */ SQLITE_WriteSchema|SQLITE_NoSchemaError },
#endif #endif
}; };
/* Number of pragmas: 65 on by default, 81 total. */ /* Number of pragmas: 66 on by default, 82 total. */

View File

@@ -876,24 +876,23 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
}else{ }else{
assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */ assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */
pExpr->op2 = pNC->ncFlags & NC_SelfRef; pExpr->op2 = pNC->ncFlags & NC_SelfRef;
if( pNC->ncFlags & NC_FromDDL ) ExprSetProperty(pExpr, EP_FromDDL);
} }
if( (pDef->funcFlags & SQLITE_FUNC_INTERNAL)!=0 if( (pDef->funcFlags & SQLITE_FUNC_INTERNAL)!=0
&& pParse->nested==0 && pParse->nested==0
&& (pParse->db->mDbFlags & DBFLAG_InternalFunc)==0 && (pParse->db->mDbFlags & DBFLAG_InternalFunc)==0
){ ){
/* Internal-use-only functions are disallowed unless the /* Internal-use-only functions are disallowed unless the
** SQL is being compiled using sqlite3NestedParse() */ ** SQL is being compiled using sqlite3NestedParse() or
** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be
** used to activate internal functionsn for testing purposes */
no_such_func = 1; no_such_func = 1;
pDef = 0; pDef = 0;
}else }else
if( (pDef->funcFlags & SQLITE_FUNC_DIRECT)!=0 if( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0
&& ExprHasProperty(pExpr, EP_Indirect)
&& !IN_RENAME_OBJECT && !IN_RENAME_OBJECT
){ ){
/* Functions tagged with SQLITE_DIRECTONLY may not be used sqlite3ExprFunctionUsable(pParse, pExpr, pDef);
** inside of triggers and views */
sqlite3ErrorMsg(pParse, "%s() prohibited in triggers and views",
pDef->zName);
} }
} }
@@ -1885,6 +1884,11 @@ int sqlite3ResolveSelfReference(
sSrc.a[0].zName = pTab->zName; sSrc.a[0].zName = pTab->zName;
sSrc.a[0].pTab = pTab; sSrc.a[0].pTab = pTab;
sSrc.a[0].iCursor = -1; sSrc.a[0].iCursor = -1;
if( pTab->pSchema!=pParse->db->aDb[1].pSchema ){
/* Cause EP_FromDDL to be set on TK_FUNCTION nodes of non-TEMP
** schema elements */
type |= NC_FromDDL;
}
} }
sNC.pParse = pParse; sNC.pParse = pParse;
sNC.pSrcList = &sSrc; sNC.pSrcList = &sSrc;

View File

@@ -4970,7 +4970,15 @@ static int selectExpander(Walker *pWalker, Select *p){
assert( pFrom->pSelect==0 ); assert( pFrom->pSelect==0 );
if( pTab->pSelect && (db->flags & SQLITE_EnableView)==0 ){ if( pTab->pSelect && (db->flags & SQLITE_EnableView)==0 ){
sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited", sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited",
pTab->zName); pTab->zName);
}
if( IsVirtual(pTab)
&& pFrom->fg.fromDDL
&& ALWAYS(pTab->pVTable!=0)
&& pTab->pVTable->eVtabRisk > ((db->flags & SQLITE_TrustedSchema)!=0)
){
sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"",
pTab->zName);
} }
pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0);
nCol = pTab->nCol; nCol = pTab->nCol;

View File

@@ -7159,21 +7159,22 @@ static int do_meta_command(char *zLine, ShellState *p){
const char *zName; const char *zName;
int op; int op;
} aDbConfig[] = { } aDbConfig[] = {
{ "defensive", SQLITE_DBCONFIG_DEFENSIVE },
{ "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
{ "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
{ "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY }, { "enable_fkey", SQLITE_DBCONFIG_ENABLE_FKEY },
{ "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
{ "enable_trigger", SQLITE_DBCONFIG_ENABLE_TRIGGER }, { "enable_trigger", SQLITE_DBCONFIG_ENABLE_TRIGGER },
{ "enable_view", SQLITE_DBCONFIG_ENABLE_VIEW }, { "enable_view", SQLITE_DBCONFIG_ENABLE_VIEW },
{ "fts3_tokenizer", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER }, { "fts3_tokenizer", SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
{ "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
{ "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION }, { "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
{ "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE }, { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
{ "enable_qpsg", SQLITE_DBCONFIG_ENABLE_QPSG },
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
{ "reset_database", SQLITE_DBCONFIG_RESET_DATABASE }, { "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
{ "defensive", SQLITE_DBCONFIG_DEFENSIVE }, { "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
{ "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
{ "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA }, { "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
{ "dqs_dml", SQLITE_DBCONFIG_DQS_DML },
{ "dqs_ddl", SQLITE_DBCONFIG_DQS_DDL },
{ "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
}; };
int ii, v; int ii, v;
open_db(p, 0); open_db(p, 0);
@@ -7183,7 +7184,7 @@ static int do_meta_command(char *zLine, ShellState *p){
sqlite3_db_config(p->db, aDbConfig[ii].op, booleanValue(azArg[2]), 0); sqlite3_db_config(p->db, aDbConfig[ii].op, booleanValue(azArg[2]), 0);
} }
sqlite3_db_config(p->db, aDbConfig[ii].op, -1, &v); sqlite3_db_config(p->db, aDbConfig[ii].op, -1, &v);
utf8_printf(p->out, "%18s %s\n", aDbConfig[ii].zName, v ? "on" : "off"); utf8_printf(p->out, "%19s %s\n", aDbConfig[ii].zName, v ? "on" : "off");
if( nArg>1 ) break; if( nArg>1 ) break;
} }
if( nArg>1 && ii==ArraySize(aDbConfig) ){ if( nArg>1 && ii==ArraySize(aDbConfig) ){

View File

@@ -2265,6 +2265,25 @@ struct sqlite3_mem_methods {
** compile-time option. ** compile-time option.
** </dd> ** </dd>
** **
** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</td>
** <dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells the SQLite to
** assume that database schemas are untainted by malicious content.
** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
** takes additional defensive steps to protect the application from harm
** including, but not limited to, the following:
** <ul>
** <li> Prohibit the use of SQL functions inside triggers, views,
** CHECK constraints, DEFAULT VALUEs, index definitions, and/or
** generated columns unless those functions are tagged
** with [SQLITE_INNOCUOUS].
** <li> Pohibit the use of virtual tables inside of triggers and/or views
** unless those virtual tables are tagged with [SQLITE_VTAB_INNOCUOUS].
** </ul>
** This setting defaults to "on" for legacy compatibility, however
** all applications are advised to turn it off if possible.
** </dd>
**
** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]] ** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td> ** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td>
** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates ** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
@@ -2305,7 +2324,8 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */ #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
#define SQLITE_DBCONFIG_MAX 1016 /* Largest DBCONFIG */ #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
/* /*
** CAPI3REF: Enable Or Disable Extended Result Codes ** CAPI3REF: Enable Or Disable Extended Result Codes
@@ -4996,12 +5016,26 @@ int sqlite3_create_window_function(
** [sqlite3_create_function_v2()]. ** [sqlite3_create_function_v2()].
** **
** The SQLITE_DETERMINISTIC flag means that the new function always gives ** The SQLITE_DETERMINISTIC flag means that the new function always gives
** the same output when the input parameters are the same. The abs() function ** the same output when the input parameters are the same.
** is deterministic, for example, but randomblob() is not. Functions must ** The [abs|abs() function] is deterministic, for example, but
** [randomblob|randomblob()] is not. Functions must
** be deterministic in order to be used in certain contexts such as ** be deterministic in order to be used in certain contexts such as
** [CHECK constraints] or [generated columns]. SQLite might also optimize ** [CHECK constraints] or [generated columns]. SQLite might also optimize
** deterministic functions by factoring them out of inner loops. ** deterministic functions by factoring them out of inner loops.
** **
** The SQLITE_INNOCUOUS flag means that the new function is unlikely
** to cause problems even if misused. An innocuous function should have
** no side effects and consume few resources. The [abs|abs() function]
** is an example of an innocuous function.
** The [load_extension() SQL function] is not innocuous because of its
** side effects. Some heightened security settings
** ([SQLITE_DBCONFIG_UNSAFE_FUNC_IN_VIEW])
** disable the use of SQLlfunctions inside views and triggers unless
** the function is tagged with SQLITE_INNOCUOUS. Most built-in functions
** are innocuous. Developers are advised to avoid using the
** SQLITE_INNOCUOUS flag for application-defined functions unless the
** function is specifically intended for use inside of views and triggers.
**
** The SQLITE_DIRECTONLY flag means that the function may only be invoked ** The SQLITE_DIRECTONLY flag means that the function may only be invoked
** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is ** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is
** a security feature which is recommended for all ** a security feature which is recommended for all
@@ -5021,6 +5055,7 @@ int sqlite3_create_window_function(
#define SQLITE_DETERMINISTIC 0x000000800 #define SQLITE_DETERMINISTIC 0x000000800
#define SQLITE_DIRECTONLY 0x000080000 #define SQLITE_DIRECTONLY 0x000080000
#define SQLITE_SUBTYPE 0x000100000 #define SQLITE_SUBTYPE 0x000100000
#define SQLITE_INNOCUOUS 0x000200000
/* /*
** CAPI3REF: Deprecated Functions ** CAPI3REF: Deprecated Functions
@@ -8869,7 +8904,7 @@ int sqlite3_vtab_config(sqlite3*, int op, ...);
** **
** <dl> ** <dl>
** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]] ** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]]
** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT ** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT</dt>
** <dd>Calls of the form ** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, ** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,
** where X is an integer. If X is zero, then the [virtual table] whose ** where X is an integer. If X is zero, then the [virtual table] whose
@@ -8898,9 +8933,31 @@ int sqlite3_vtab_config(sqlite3*, int op, ...);
** return SQLITE_OK. Or, if this is not possible, it may return ** return SQLITE_OK. Or, if this is not possible, it may return
** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT ** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT
** constraint handling. ** constraint handling.
** </dd>
**
** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
** identify that virtual table as being safe to use from within triggers
** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
** virtual table can do no serious harm even if it is controlled by a
** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
** flag unless absolutely necessary.
** </dd>
**
** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
** <dd>Calls of the form
** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
** prohibits that virtual table from being used from within triggers and
** views.
** </dd>
** </dl> ** </dl>
*/ */
#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
#define SQLITE_VTAB_INNOCUOUS 2
#define SQLITE_VTAB_DIRECTONLY 3
/* /*
** CAPI3REF: Determine The Virtual Table Conflict Policy ** CAPI3REF: Determine The Virtual Table Conflict Policy

View File

@@ -1142,6 +1142,7 @@ typedef struct With With;
** A bit in a Bitmask ** A bit in a Bitmask
*/ */
#define MASKBIT(n) (((Bitmask)1)<<(n)) #define MASKBIT(n) (((Bitmask)1)<<(n))
#define MASKBIT64(n) (((u64)1)<<(n))
#define MASKBIT32(n) (((unsigned int)1)<<(n)) #define MASKBIT32(n) (((unsigned int)1)<<(n))
#define ALLBITS ((Bitmask)-1) #define ALLBITS ((Bitmask)-1)
@@ -1558,6 +1559,13 @@ struct sqlite3 {
#define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc) #define SCHEMA_ENC(db) ((db)->aDb[0].pSchema->enc)
#define ENC(db) ((db)->enc) #define ENC(db) ((db)->enc)
/*
** A u64 constant where the lower 32 bits are all zeros. Only the
** upper 32 bits are included in the argument. Necessary because some
** C-compilers still do not accept LL integer literals.
*/
#define HI(X) ((u64)(X)<<32)
/* /*
** Possible values for the sqlite3.flags. ** Possible values for the sqlite3.flags.
** **
@@ -1573,9 +1581,8 @@ struct sqlite3 {
#define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */ #define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */
#define SQLITE_CacheSpill 0x00000020 /* OK to spill pager cache */ #define SQLITE_CacheSpill 0x00000020 /* OK to spill pager cache */
#define SQLITE_ShortColNames 0x00000040 /* Show short columns names */ #define SQLITE_ShortColNames 0x00000040 /* Show short columns names */
#define SQLITE_CountRows 0x00000080 /* Count rows changed by INSERT, */ #define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
/* DELETE, or UPDATE and return */ ** vtabs in the schema definition */
/* the count using a callback. */
#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */ #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
/* result set is empty */ /* result set is empty */
#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */ #define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
@@ -1601,9 +1608,11 @@ struct sqlite3 {
#define SQLITE_DqsDDL 0x20000000 /* dbl-quoted strings allowed in DDL*/ #define SQLITE_DqsDDL 0x20000000 /* dbl-quoted strings allowed in DDL*/
#define SQLITE_DqsDML 0x40000000 /* dbl-quoted strings allowed in DML*/ #define SQLITE_DqsDML 0x40000000 /* dbl-quoted strings allowed in DML*/
#define SQLITE_EnableView 0x80000000 /* Enable the use of views */ #define SQLITE_EnableView 0x80000000 /* Enable the use of views */
#define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
/* DELETE, or UPDATE and return */
/* the count using a callback. */
/* Flags used only if debugging */ /* Flags used only if debugging */
#define HI(X) ((u64)(X)<<32)
#ifdef SQLITE_DEBUG #ifdef SQLITE_DEBUG
#define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */ #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
#define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */ #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -1729,6 +1738,7 @@ struct FuncDestructor {
** SQLITE_FUNC_TYPEOF == OPFLAG_TYPEOFARG ** SQLITE_FUNC_TYPEOF == OPFLAG_TYPEOFARG
** SQLITE_FUNC_CONSTANT == SQLITE_DETERMINISTIC from the API ** SQLITE_FUNC_CONSTANT == SQLITE_DETERMINISTIC from the API
** SQLITE_FUNC_DIRECT == SQLITE_DIRECTONLY from the API ** SQLITE_FUNC_DIRECT == SQLITE_DIRECTONLY from the API
** SQLITE_FUNC_UNSAFE == SQLITE_INNOCUOUS
** SQLITE_FUNC_ENCMASK depends on SQLITE_UTF* macros in the API ** SQLITE_FUNC_ENCMASK depends on SQLITE_UTF* macros in the API
*/ */
#define SQLITE_FUNC_ENCMASK 0x0003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */ #define SQLITE_FUNC_ENCMASK 0x0003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */
@@ -1751,7 +1761,8 @@ struct FuncDestructor {
#define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */ #define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */
#define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */ #define SQLITE_FUNC_DIRECT 0x00080000 /* Not for use in TRIGGERs or VIEWs */
#define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */ #define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */
#define SQLITE_FUNC_INLINE 0x00200000 /* Functions implemented in-line */ #define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */
#define SQLITE_FUNC_INLINE 0x00400000 /* Functions implemented in-line */
/* Identifier numbers for each in-line function */ /* Identifier numbers for each in-line function */
#define INLINEFUNC_coalesce 0 #define INLINEFUNC_coalesce 0
@@ -1831,7 +1842,7 @@ struct FuncDestructor {
{nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \ #define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
{nArg, SQLITE_UTF8|SQLITE_DIRECTONLY, \ {nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \ #define INLINE_FUNC(zName, nArg, iArg, mFlags) \
{nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \ {nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
@@ -2056,10 +2067,17 @@ struct VTable {
sqlite3_vtab *pVtab; /* Pointer to vtab instance */ sqlite3_vtab *pVtab; /* Pointer to vtab instance */
int nRef; /* Number of pointers to this structure */ int nRef; /* Number of pointers to this structure */
u8 bConstraint; /* True if constraints are supported */ u8 bConstraint; /* True if constraints are supported */
u8 eVtabRisk; /* Riskiness of allowing hacker access */
int iSavepoint; /* Depth of the SAVEPOINT stack */ int iSavepoint; /* Depth of the SAVEPOINT stack */
VTable *pNext; /* Next in linked list (see above) */ VTable *pNext; /* Next in linked list (see above) */
}; };
/* Allowed values for VTable.eVtabRisk
*/
#define SQLITE_VTABRISK_Low 0
#define SQLITE_VTABRISK_Normal 1
#define SQLITE_VTABRISK_High 2
/* /*
** The schema for each SQL table and view is represented in memory ** The schema for each SQL table and view is represented in memory
** by an instance of the following structure. ** by an instance of the following structure.
@@ -2660,7 +2678,7 @@ struct Expr {
#define EP_Static 0x8000000 /* Held in memory not obtained from malloc() */ #define EP_Static 0x8000000 /* Held in memory not obtained from malloc() */
#define EP_IsTrue 0x10000000 /* Always has boolean value of TRUE */ #define EP_IsTrue 0x10000000 /* Always has boolean value of TRUE */
#define EP_IsFalse 0x20000000 /* Always has boolean value of FALSE */ #define EP_IsFalse 0x20000000 /* Always has boolean value of FALSE */
#define EP_Indirect 0x40000000 /* Contained within a TRIGGER or a VIEW */ #define EP_FromDDL 0x40000000 /* Originates from sqlite_master */
/* /*
** The EP_Propagate mask is a set of properties that automatically propagate ** The EP_Propagate mask is a set of properties that automatically propagate
@@ -2829,6 +2847,7 @@ struct SrcList {
unsigned isCorrelated :1; /* True if sub-query is correlated */ unsigned isCorrelated :1; /* True if sub-query is correlated */
unsigned viaCoroutine :1; /* Implemented as a co-routine */ unsigned viaCoroutine :1; /* Implemented as a co-routine */
unsigned isRecursive :1; /* True for recursive reference in WITH */ unsigned isRecursive :1; /* True for recursive reference in WITH */
unsigned fromDDL :1; /* Comes from sqlite_master */
} fg; } fg;
int iCursor; /* The VDBE cursor number used to access this table */ int iCursor; /* The VDBE cursor number used to access this table */
Expr *pOn; /* The ON clause of a join */ Expr *pOn; /* The ON clause of a join */
@@ -2949,6 +2968,7 @@ struct NameContext {
#define NC_HasWin 0x08000 /* One or more window functions seen */ #define NC_HasWin 0x08000 /* One or more window functions seen */
#define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */ #define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */
#define NC_InAggFunc 0x20000 /* True if analyzing arguments to an agg func */ #define NC_InAggFunc 0x20000 /* True if analyzing arguments to an agg func */
#define NC_FromDDL 0x40000 /* SQL text comes from sqlite_master */
/* /*
** An instance of the following object describes a single ON CONFLICT ** An instance of the following object describes a single ON CONFLICT
@@ -3504,7 +3524,7 @@ typedef struct DbFixer DbFixer;
struct DbFixer { struct DbFixer {
Parse *pParse; /* The parsing context. Error messages written here */ Parse *pParse; /* The parsing context. Error messages written here */
Schema *pSchema; /* Fix items to this schema */ Schema *pSchema; /* Fix items to this schema */
int bVarOnly; /* Check for variable references only */ u8 bTemp; /* True for TEMP schema entries */
const char *zDb; /* Make sure all objects are contained in this database */ const char *zDb; /* Make sure all objects are contained in this database */
const char *zType; /* Type of the container - used for error messages */ const char *zType; /* Type of the container - used for error messages */
const Token *pName; /* Name of the container - used for error messages */ const Token *pName; /* Name of the container - used for error messages */
@@ -4037,6 +4057,7 @@ void sqlite3PExprAddSelect(Parse*, Expr*, Select*);
Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*); Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*);
Expr *sqlite3ExprSimplifiedAndOr(Expr*); Expr *sqlite3ExprSimplifiedAndOr(Expr*);
Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int); Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int);
void sqlite3ExprFunctionUsable(Parse*,Expr*,FuncDef*);
void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32);
void sqlite3ExprDelete(sqlite3*, Expr*); void sqlite3ExprDelete(sqlite3*, Expr*);
void sqlite3ExprUnmapAndDelete(Parse*, Expr*); void sqlite3ExprUnmapAndDelete(Parse*, Expr*);

View File

@@ -2818,6 +2818,7 @@ deserialize_error:
** --argcount N Function has exactly N arguments ** --argcount N Function has exactly N arguments
** --deterministic The function is pure ** --deterministic The function is pure
** --directonly Prohibit use inside triggers and views ** --directonly Prohibit use inside triggers and views
** --innocuous Has no side effects or information leaks
** --returntype TYPE Specify the return type of the function ** --returntype TYPE Specify the return type of the function
*/ */
case DB_FUNCTION: { case DB_FUNCTION: {
@@ -2854,6 +2855,9 @@ deserialize_error:
if( n>1 && strncmp(z, "-directonly",n)==0 ){ if( n>1 && strncmp(z, "-directonly",n)==0 ){
flags |= SQLITE_DIRECTONLY; flags |= SQLITE_DIRECTONLY;
}else }else
if( n>1 && strncmp(z, "-innocuous",n)==0 ){
flags |= SQLITE_INNOCUOUS;
}else
if( n>1 && strncmp(z, "-returntype", n)==0 ){ if( n>1 && strncmp(z, "-returntype", n)==0 ){
const char *azType[] = {"integer", "real", "text", "blob", "any", 0}; const char *azType[] = {"integer", "real", "text", "blob", "any", 0};
assert( SQLITE_INTEGER==1 && SQLITE_FLOAT==2 && SQLITE_TEXT==3 ); assert( SQLITE_INTEGER==1 && SQLITE_FLOAT==2 && SQLITE_TEXT==3 );
@@ -2870,7 +2874,7 @@ deserialize_error:
}else{ }else{
Tcl_AppendResult(interp, "bad option \"", z, Tcl_AppendResult(interp, "bad option \"", z,
"\": must be -argcount, -deterministic, -directonly," "\": must be -argcount, -deterministic, -directonly,"
" or -returntype", (char*)0 " -innocuous, or -returntype", (char*)0
); );
return TCL_ERROR; return TCL_ERROR;
} }

View File

@@ -147,6 +147,9 @@ void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc){
if( pItem->fg.jointype & JT_LEFT ){ if( pItem->fg.jointype & JT_LEFT ){
sqlite3_str_appendf(&x, " LEFT-JOIN"); sqlite3_str_appendf(&x, " LEFT-JOIN");
} }
if( pItem->fg.fromDDL ){
sqlite3_str_appendf(&x, " DDL");
}
sqlite3StrAccumFinish(&x); sqlite3StrAccumFinish(&x);
sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1); sqlite3TreeViewItem(pView, zLine, i<pSrc->nSrc-1);
if( pItem->pSelect ){ if( pItem->pSelect ){
@@ -403,14 +406,17 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
return; return;
} }
if( pExpr->flags || pExpr->affExpr ){ if( pExpr->flags || pExpr->affExpr ){
StrAccum x;
sqlite3StrAccumInit(&x, 0, zFlgs, sizeof(zFlgs), 0);
sqlite3_str_appendf(&x, " fg.af=%x.%c",
pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
if( ExprHasProperty(pExpr, EP_FromJoin) ){ if( ExprHasProperty(pExpr, EP_FromJoin) ){
sqlite3_snprintf(sizeof(zFlgs),zFlgs," fg.af=%x.%c iRJT=%d", sqlite3_str_appendf(&x, " iRJT=%d", pExpr->iRightJoinTable);
pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n',
pExpr->iRightJoinTable);
}else{
sqlite3_snprintf(sizeof(zFlgs),zFlgs," fg.af=%x.%c",
pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n');
} }
if( ExprHasProperty(pExpr, EP_FromDDL) ){
sqlite3_str_appendf(&x, " DDL");
}
sqlite3StrAccumFinish(&x);
}else{ }else{
zFlgs[0] = 0; zFlgs[0] = 0;
} }
@@ -566,7 +572,7 @@ void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 moreToFollow){
}else{ }else{
pFarg = pExpr->x.pList; pFarg = pExpr->x.pList;
#ifndef SQLITE_OMIT_WINDOWFUNC #ifndef SQLITE_OMIT_WINDOWFUNC
pWin = pExpr->y.pWin; pWin = ExprHasProperty(pExpr, EP_WinFunc) ? pExpr->y.pWin : 0;
#else #else
pWin = 0; pWin = 0;
#endif #endif

View File

@@ -587,6 +587,7 @@ static int vtabCallConstructor(
} }
pVTable->db = db; pVTable->db = db;
pVTable->pMod = pMod; pVTable->pMod = pMod;
pVTable->eVtabRisk = SQLITE_VTABRISK_Normal;
iDb = sqlite3SchemaToIndex(db, pTab->pSchema); iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
pTab->azModuleArg[1] = db->aDb[iDb].zDbSName; pTab->azModuleArg[1] = db->aDb[iDb].zDbSName;
@@ -1276,28 +1277,38 @@ int sqlite3_vtab_on_conflict(sqlite3 *db){
int sqlite3_vtab_config(sqlite3 *db, int op, ...){ int sqlite3_vtab_config(sqlite3 *db, int op, ...){
va_list ap; va_list ap;
int rc = SQLITE_OK; int rc = SQLITE_OK;
VtabCtx *p;
#ifdef SQLITE_ENABLE_API_ARMOR #ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT;
#endif #endif
sqlite3_mutex_enter(db->mutex); sqlite3_mutex_enter(db->mutex);
va_start(ap, op); p = db->pVtabCtx;
switch( op ){ if( !p ){
case SQLITE_VTAB_CONSTRAINT_SUPPORT: { rc = SQLITE_MISUSE_BKPT;
VtabCtx *p = db->pVtabCtx; }else{
if( !p ){ assert( p->pTab==0 || IsVirtual(p->pTab) );
rc = SQLITE_MISUSE_BKPT; va_start(ap, op);
}else{ switch( op ){
assert( p->pTab==0 || IsVirtual(p->pTab) ); case SQLITE_VTAB_CONSTRAINT_SUPPORT: {
p->pVTable->bConstraint = (u8)va_arg(ap, int); p->pVTable->bConstraint = (u8)va_arg(ap, int);
break;
}
case SQLITE_VTAB_INNOCUOUS: {
p->pVTable->eVtabRisk = SQLITE_VTABRISK_Low;
break;
}
case SQLITE_VTAB_DIRECTONLY: {
p->pVTable->eVtabRisk = SQLITE_VTABRISK_High;
break;
}
default: {
rc = SQLITE_MISUSE_BKPT;
break;
} }
break;
} }
default: va_end(ap);
rc = SQLITE_MISUSE_BKPT;
break;
} }
va_end(ap);
if( rc!=SQLITE_OK ) sqlite3Error(db, rc); if( rc!=SQLITE_OK ) sqlite3Error(db, rc);
sqlite3_mutex_leave(db->mutex); sqlite3_mutex_leave(db->mutex);

View File

@@ -138,7 +138,7 @@ do_catchsql_test fts3atoken-1.10 {
} {0 {}} } {0 {}}
do_catchsql_test fts3atoken-1.11 { do_catchsql_test fts3atoken-1.11 {
SELECT * FROM v110; SELECT * FROM v110;
} {1 {fts3_tokenizer() prohibited in triggers and views}} } {1 {unsafe use of fts3_tokenizer()}}
do_catchsql_test fts3atoken-1.12 { do_catchsql_test fts3atoken-1.12 {
CREATE TABLE t110(a,b); CREATE TABLE t110(a,b);
CREATE TRIGGER r110 AFTER INSERT ON t110 BEGIN CREATE TRIGGER r110 AFTER INSERT ON t110 BEGIN
@@ -147,7 +147,7 @@ do_catchsql_test fts3atoken-1.12 {
} {0 {}} } {0 {}}
do_catchsql_test fts3atoken-1.13 { do_catchsql_test fts3atoken-1.13 {
INSERT INTO t110(a,b) VALUES(1,2); INSERT INTO t110(a,b) VALUES(1,2);
} {1 {fts3_tokenizer() prohibited in triggers and views}} } {1 {unsafe use of fts3_tokenizer()}}
do_catchsql_test fts3atoken-1.14 { do_catchsql_test fts3atoken-1.14 {
SELECT * FROM t110; SELECT * FROM t110;
} {0 {}} } {0 {}}

View File

@@ -1430,7 +1430,7 @@ do_test func-33.1 {
do_catchsql_test func-33.2 { do_catchsql_test func-33.2 {
CREATE VIEW v33(y) AS SELECT testdirectonly(15); CREATE VIEW v33(y) AS SELECT testdirectonly(15);
SELECT * FROM v33; SELECT * FROM v33;
} {1 {testdirectonly() prohibited in triggers and views}} } {1 {unsafe use of testdirectonly()}}
do_execsql_test func-33.3 { do_execsql_test func-33.3 {
SELECT * FROM (SELECT testdirectonly(15)) AS v33; SELECT * FROM (SELECT testdirectonly(15)) AS v33;
} {30} } {30}
@@ -1441,7 +1441,7 @@ do_execsql_test func-33.4 {
do_catchsql_test func-33.5 { do_catchsql_test func-33.5 {
WITH c(x) AS (SELECT * FROM v33) WITH c(x) AS (SELECT * FROM v33)
SELECT * FROM c; SELECT * FROM c;
} {1 {testdirectonly() prohibited in triggers and views}} } {1 {unsafe use of testdirectonly()}}
do_execsql_test func-33.10 { do_execsql_test func-33.10 {
CREATE TABLE t33a(a,b); CREATE TABLE t33a(a,b);
CREATE TABLE t33b(x,y); CREATE TABLE t33b(x,y);
@@ -1451,7 +1451,7 @@ do_execsql_test func-33.10 {
} {} } {}
do_catchsql_test func-33.11 { do_catchsql_test func-33.11 {
INSERT INTO t33a VALUES(1,2); INSERT INTO t33a VALUES(1,2);
} {1 {testdirectonly() prohibited in triggers and views}} } {1 {unsafe use of testdirectonly()}}
do_execsql_test func-33.20 { do_execsql_test func-33.20 {
ALTER TABLE t33a RENAME COLUMN a TO aaa; ALTER TABLE t33a RENAME COLUMN a TO aaa;
SELECT sql FROM sqlite_master WHERE name='r1'; SELECT sql FROM sqlite_master WHERE name='r1';

View File

@@ -32,12 +32,18 @@ do_execsql_test 1.0 {
} { } {
0 name {} 0 {} 0 0 name {} 0 {} 0
1 builtin {} 0 {} 0 1 builtin {} 0 {} 0
2 type {} 0 {} 0
3 enc {} 0 {} 0
4 narg {} 0 {} 0
5 flags {} 0 {} 0
} }
do_execsql_test 1.1 { do_execsql_test 1.1 {
SELECT * FROM pragma_function_list WHERE name='upper' AND builtin SELECT DISTINCT name, builtin
FROM pragma_function_list WHERE name='upper' AND builtin
} {upper 1} } {upper 1}
do_execsql_test 1.2 { do_execsql_test 1.2 {
SELECT * FROM pragma_function_list WHERE name LIKE 'exter%'; SELECT DISTINCT name, builtin
FROM pragma_function_list WHERE name LIKE 'exter%';
} {external 0} } {external 0}
ifcapable fts5 { ifcapable fts5 {

View File

@@ -789,7 +789,7 @@ do_test 17.6.2 {
do_test 17.6.3 { do_test 17.6.3 {
list [catch { db function xyz -n object ret } msg] $msg list [catch { db function xyz -n object ret } msg] $msg
} {1 {bad option "-n": must be -argcount, -deterministic, -directonly, or -returntype}} } {1 {bad option "-n": must be -argcount, -deterministic, -directonly, -innocuous, or -returntype}}
# 2019-02-28: The "bind_fallback" command. # 2019-02-28: The "bind_fallback" command.
# #

251
test/trustschema1.test Normal file
View File

@@ -0,0 +1,251 @@
# 2020-01-08
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
#***********************************************************************
#
# Test cases for managing execution of code snippets found in untrusted
# schemas.
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix trustschema1
# edgy functions used in generated columns
#
proc f1 {x} {return $x}
do_test 1.100 {
db function f1 -innocuous -deterministic f1
db function f2 -deterministic f1
db function f3 -directonly -deterministic f1
db eval {
CREATE TABLE t1(a, b AS (f1(a+1)), c AS (f2(a+2)));
INSERT INTO t1 VALUES(100),(200);
}
} {}
do_catchsql_test 1.110 {
SELECT a, b, c FROM t1;
} {0 {100 101 102 200 201 202}}
do_execsql_test 1.120 {
PRAGMA trusted_schema=OFF;
} {}
do_catchsql_test 1.130 {
SELECT a, b FROM t1;
} {0 {100 101 200 201}}
do_catchsql_test 1.140 {
SELECT a, b, c FROM t1;
} {1 {unsafe use of f2()}}
do_catchsql_test 1.150 {
PRAGMA trusted_schema=ON;
DROP TABLE t1;
CREATE TABLE t1(a, b AS (f3(a+1)));
} {1 {unsafe use of f3()}}
do_execsql_test 1.160 {
PRAGMA trusted_schema=OFF;
CREATE TEMP TABLE temp1(a,b AS (f3(a+1)));
INSERT INTO temp1(a) VALUES(100),(900);
SELECT * FROM temp1;
} {100 101 900 901}
# edgy functions used in CHECK constraints
#
do_catchsql_test 1.200 {
PRAGMA trusted_schema=ON;
CREATE TABLE t2(a,b,c,CHECK(f3(c)==c));
} {1 {unsafe use of f3()}}
do_catchsql_test 1.210 {
PRAGMA trusted_schema=Off;
CREATE TABLE t2(a,b,c,CHECK(f2(c)==c));
} {1 {unsafe use of f2()}}
do_catchsql_test 1.211 {
PRAGMA trusted_schema=On;
CREATE TABLE t2(a,b,c,CHECK(f2(c)==c));
} {0 {}}
do_catchsql_test 1.220 {
INSERT INTO t2 VALUES(1,2,3);
SELECT * FROM t2;
} {0 {1 2 3}}
do_catchsql_test 1.230 {
PRAGMA trusted_schema=off;
INSERT INTO t2 VALUES(4,5,6);
} {1 {unsafe use of f2()}}
do_execsql_test 1.231 {
SELECT * FROM t2;
} {1 2 3}
# Ok to put as many edgy functions as you want in a
# TEMP table.
do_execsql_test 1.240 {
PRAGMA trusted_schema=OFF;
CREATE TEMP TABLE temp2(a, b, CHECK(f3(b)==b));
INSERT INTO temp2(a,b) VALUES(1,2),('x','y');
SELECT * FROM temp2;
} {1 2 x y}
# edgy functions used in DEFAULT constraints
#
do_catchsql_test 1.300 {
CREATE TABLE t3(a,b DEFAULT(f2(25)));
} {0 {}}
do_catchsql_test 1.310 {
PRAGMA trusted_schema=Off;
INSERT INTO t3(a) VALUES(1);
} {1 {unsafe use of f2()}}
do_catchsql_test 1.311 {
INSERT INTO t3(a,b) VALUES(1,2);
} {0 {}}
do_execsql_test 1.320 {
CREATE TEMP TABLE temp3(a, b DEFAULT(f3(31)));
INSERT INTO temp3(a) VALUES(22);
SELECT * FROM temp3;
} {22 31}
# edgy functions used in partial indexes.
#
do_execsql_test 1.400 {
CREATE TABLE t4(a,b,c);
INSERT INTO t4 VALUES(1,2,3),('a','b','c'),(4,'d',0);
SELECT * FROM t4;
CREATE TEMP TABLE temp4(a,b,c);
INSERT INTO temp4 SELECT * FROM t4;
} {1 2 3 a b c 4 d 0}
do_catchsql_test 1.410 {
CREATE INDEX t4a ON t4(a) WHERE f3(c);
} {1 {unsafe use of f3()}}
do_catchsql_test 1.420 {
PRAGMA trusted_schema=OFF;
CREATE INDEX t4a ON t4(a) WHERE f2(c);
} {1 {unsafe use of f2()}}
do_execsql_test 1.421 {
CREATE INDEX t4a ON t4(a) WHERE f1(c);
SELECT a FROM t4 WHERE f1(c) ORDER BY a;
} {1}
do_execsql_test 1.430 {
PRAGMA trusted_schema=ON;
CREATE INDEX t4b ON t4(b) WHERE f2(c);
SELECT b FROM t4 WHERE f2(c) ORDER BY b;
} {2}
do_execsql_test 1.440 {
PRAGMA trusted_schema=OFF;
CREATE INDEX temp4a ON temp4(a) WHERE f3(c);
SELECT a FROM temp4 WHERE f2(c) ORDER BY a;
} {1}
# edgy functions used in index expressions
#
do_execsql_test 1.500 {
CREATE TABLE t5(a,b,c);
INSERT INTO t5 VALUES(1,2,3),(4,5,6),(7,0,-3);
SELECT * FROM t5;
CREATE TEMP TABLE temp5(a,b,c);
INSERT INTO temp5 SELECT * FROM t5;
} {1 2 3 4 5 6 7 0 -3}
do_catchsql_test 1.510 {
CREATE INDEX t5x1 ON t5(a+f3(b));
} {1 {unsafe use of f3()}}
do_catchsql_test 1.520 {
PRAGMA trusted_schema=OFF;
CREATE INDEX t5x1 ON t5(a+f2(b));
} {1 {unsafe use of f2()}}
do_execsql_test 1.521 {
CREATE INDEX t5x1 ON t5(a+f1(b));
SELECT * FROM t5 INDEXED BY t5x1 WHERE a+f1(b)=3;
} {1 2 3}
do_execsql_test 1.530 {
PRAGMA trusted_schema=ON;
CREATE INDEX t5x2 ON t5(b+f2(c));
SELECT * FROM t5 INDEXED BY t5x2 WHERE b+f2(c)=11;
} {4 5 6}
do_execsql_test 1.540 {
PRAGMA trusted_schema=OFF;
CREATE INDEX temp5x1 ON temp5(a+f3(b));
SELECT * FROM temp5 INDEXED BY temp5x1 WHERE a+f3(b)=7;
} {7 0 -3}
# edgy functions in VIEWs
#
reset_db
db function f1 -innocuous -deterministic f1
db function f2 -deterministic f1
db function f3 -directonly -deterministic f1
do_execsql_test 2.100 {
CREATE TABLE t1(a,b,c);
INSERT INTO t1 VALUES(1,2,3),(100,50,75),(-11,22,-33);
CREATE VIEW v1a AS SELECT f3(a+b) FROM t1;
SELECT f3(a+b) FROM t1;
} {3 150 11}
do_catchsql_test 2.110 {
PRAGMA trusted_schema=ON;
SELECT * FROM v1a;
} {1 {unsafe use of f3()}}
do_catchsql_test 2.111 {
PRAGMA trusted_schema=OFF;
SELECT * FROM v1a;
} {1 {unsafe use of f3()}}
do_execsql_test 2.120 {
DROP VIEW v1a;
CREATE TEMP VIEW v1a AS SELECT f3(a+b) FROM t1;
SELECT * FROM v1a;
} {3 150 11}
do_execsql_test 2.130 {
CREATE VIEW v1b AS SELECT f2(b+c) FROM t1;
SELECT f2(b+c) FROM t1;
} {5 125 -11}
do_catchsql_test 2.140 {
PRAGMA trusted_schema=ON;
SELECT * FROM v1b;
} {0 {5 125 -11}}
do_catchsql_test 2.141 {
PRAGMA trusted_schema=OFF;
SELECT * FROM v1b;
} {1 {unsafe use of f2()}}
do_execsql_test 2.150 {
DROP VIEW v1b;
CREATE TEMP VIEW v1b AS SELECT f2(b+c) FROM t1;
SELECT * FROM v1b;
} {5 125 -11}
# edgy functions inside of triggers
#
do_execsql_test 3.100 {
DELETE FROM t1;
CREATE TABLE t2(x);
CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN
INSERT INTO t2(x) SELECT f3(new.a);
END;
} {}
do_catchsql_test 3.110 {
INSERT INTO t1 VALUES(7,6,5);
} {1 {unsafe use of f3()}}
do_execsql_test 3.111 {
SELECT * FROM t1;
SELECT * FROM t2;
} {}
do_execsql_test 3.120 {
DROP TRIGGER r1;
CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN
INSERT INTO t2(x) SELECT f2(new.a)+100;
END;
PRAGMA trusted_schema=ON;
INSERT INTO t1 VALUES(7,6,5);
SELECT * FROM t1, t2;
} {7 6 5 107}
do_catchsql_test 3.130 {
DELETE FROM t1;
DELETE FROM t2;
PRAGMA trusted_schema=OFF;
INSERT INTO t1 VALUES(7,6,5);
} {1 {unsafe use of f2()}}
do_execsql_test 3.131 {
SELECT * FROM t1;
SELECT * FROM t2;
} {}
finish_test

View File

@@ -128,6 +128,11 @@ set pragma_def {
ARG: SQLITE_RecTriggers ARG: SQLITE_RecTriggers
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS) IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
NAME: trusted_schema
TYPE: FLAG
ARG: SQLITE_TrustedSchema
IF: !defined(SQLITE_OMIT_FLAG_PRAGMAS)
NAME: foreign_keys NAME: foreign_keys
TYPE: FLAG TYPE: FLAG
ARG: SQLITE_ForeignKeys ARG: SQLITE_ForeignKeys
@@ -257,7 +262,7 @@ set pragma_def {
NAME: function_list NAME: function_list
FLAG: Result0 FLAG: Result0
COLS: name builtin COLS: name builtin type enc narg flags
IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) IF: !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
IF: !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS) IF: !defined(SQLITE_OMIT_INTROSPECTION_PRAGMAS)