Fossil SCM

Update the built-in SQLite to the latest 3.35.0 alpha which features faster startup time.

drh 2021-01-01 22:07 trunk
Commit 67d79d23e1929ee60c6b06689a6bc97ce367b03e3e866313413664125e647c2b
2 files changed +70 -36 +1 -1
+70 -36
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1186,11 +1186,11 @@
11861186
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11871187
** [sqlite_version()] and [sqlite_source_id()].
11881188
*/
11891189
#define SQLITE_VERSION "3.35.0"
11901190
#define SQLITE_VERSION_NUMBER 3035000
1191
-#define SQLITE_SOURCE_ID "2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124d8d7f"
1191
+#define SQLITE_SOURCE_ID "2021-01-01 22:06:17 d01e9f2d00dc439c529cd8885a219fcddbaad73b9f471b020e2a0c18e2add69b"
11921192
11931193
/*
11941194
** CAPI3REF: Run-Time Library Version Numbers
11951195
** KEYWORDS: sqlite3_version sqlite3_sourceid
11961196
**
@@ -20025,10 +20025,11 @@
2002520025
SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr);
2002620026
SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
2002720027
SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
2002820028
SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
2002920029
SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
20030
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*);
2003020031
SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
2003120032
SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
2003220033
SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
2003320034
SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
2003420035
@@ -31452,10 +31453,20 @@
3145231453
SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
3145331454
assert( db!=0 );
3145431455
db->errCode = err_code;
3145531456
if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
3145631457
}
31458
+
31459
+/*
31460
+** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
31461
+** and error message.
31462
+*/
31463
+SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
31464
+ assert( db!=0 );
31465
+ db->errCode = SQLITE_OK;
31466
+ if( db->pErr ) sqlite3ValueSetNull(db->pErr);
31467
+}
3145731468
3145831469
/*
3145931470
** Load the sqlite3.iSysErrno field if that is an appropriate thing
3146031471
** to do based on the SQLite error code in rc.
3146131472
*/
@@ -80554,10 +80565,12 @@
8055480565
assert( p!=0 );
8055580566
assert( p->nOp>0 );
8055680567
assert( pParse!=0 );
8055780568
assert( p->magic==VDBE_MAGIC_INIT );
8055880569
assert( pParse==p->pParse );
80570
+ p->pVList = pParse->pVList;
80571
+ pParse->pVList = 0;
8055980572
db = p->db;
8056080573
assert( db->mallocFailed==0 );
8056180574
nVar = pParse->nVar;
8056280575
nMem = pParse->nMem;
8056380576
nCursor = pParse->nTab;
@@ -80638,12 +80651,10 @@
8063880651
p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
8063980652
#endif
8064080653
}
8064180654
}
8064280655
80643
- p->pVList = pParse->pVList;
80644
- pParse->pVList = 0;
8064580656
if( db->mallocFailed ){
8064680657
p->nVar = 0;
8064780658
p->nCursor = 0;
8064880659
p->nMem = 0;
8064980660
}else{
@@ -106877,15 +106888,18 @@
106877106888
u32 savedDbFlags = db->mDbFlags;
106878106889
while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
106879106890
*zEnd-- = '\0';
106880106891
}
106881106892
db->mDbFlags |= DBFLAG_PreferBuiltin;
106893
+ /* substr() operations on characters, but addColOffset is in bytes. So we
106894
+ ** have to use printf() to translate between these units: */
106882106895
sqlite3NestedParse(pParse,
106883106896
"UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
106884
- "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
106897
+ "sql = printf('%%.%ds, ',sql) || %Q"
106898
+ " || substr(sql,1+length(printf('%%.%ds',sql))) "
106885106899
"WHERE type = 'table' AND name = %Q",
106886
- zDb, pNew->addColOffset, zCol, pNew->addColOffset+1,
106900
+ zDb, pNew->addColOffset, zCol, pNew->addColOffset,
106887106901
zTab
106888106902
);
106889106903
sqlite3DbFree(db, zCol);
106890106904
db->mDbFlags = savedDbFlags;
106891106905
}
@@ -111041,15 +111055,11 @@
111041111055
111042111056
/* Don't do any authorization checks if the database is initialising
111043111057
** or if the parser is being invoked from within sqlite3_declare_vtab.
111044111058
*/
111045111059
assert( !IN_RENAME_OBJECT || db->xAuth==0 );
111046
- if( db->init.busy || IN_SPECIAL_PARSE ){
111047
- return SQLITE_OK;
111048
- }
111049
-
111050
- if( db->xAuth==0 ){
111060
+ if( db->xAuth==0 || db->init.busy || IN_SPECIAL_PARSE ){
111051111061
return SQLITE_OK;
111052111062
}
111053111063
111054111064
/* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the
111055111065
** callback are either NULL pointers or zero-terminated strings that
@@ -111251,10 +111261,14 @@
111251111261
}
111252111262
111253111263
/* Begin by generating some termination code at the end of the
111254111264
** vdbe program
111255111265
*/
111266
+ if( pParse->pVdbe==0 && db->init.busy ){
111267
+ pParse->rc = SQLITE_DONE;
111268
+ return;
111269
+ }
111256111270
v = sqlite3GetVdbe(pParse);
111257111271
assert( !pParse->isMultiWrite
111258111272
|| sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
111259111273
if( v ){
111260111274
sqlite3VdbeAddOp0(v, OP_Halt);
@@ -112363,10 +112377,12 @@
112363112377
int i;
112364112378
char *z;
112365112379
char *zType;
112366112380
Column *pCol;
112367112381
sqlite3 *db = pParse->db;
112382
+ u8 hName;
112383
+
112368112384
if( (p = pParse->pNewTable)==0 ) return;
112369112385
if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
112370112386
sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
112371112387
return;
112372112388
}
@@ -112374,12 +112390,13 @@
112374112390
if( z==0 ) return;
112375112391
if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName);
112376112392
memcpy(z, pName->z, pName->n);
112377112393
z[pName->n] = 0;
112378112394
sqlite3Dequote(z);
112395
+ hName = sqlite3StrIHash(z);
112379112396
for(i=0; i<p->nCol; i++){
112380
- if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){
112397
+ if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zName)==0 ){
112381112398
sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
112382112399
sqlite3DbFree(db, z);
112383112400
return;
112384112401
}
112385112402
}
@@ -112393,11 +112410,11 @@
112393112410
p->aCol = aNew;
112394112411
}
112395112412
pCol = &p->aCol[p->nCol];
112396112413
memset(pCol, 0, sizeof(p->aCol[0]));
112397112414
pCol->zName = z;
112398
- pCol->hName = sqlite3StrIHash(z);
112415
+ pCol->hName = hName;
112399112416
sqlite3ColumnPropertiesFromName(p, pCol);
112400112417
112401112418
if( pType->n==0 ){
112402112419
/* If there is no type specified, columns have the default affinity
112403112420
** 'BLOB' with a default size of 4 bytes. */
@@ -113669,11 +113686,11 @@
113669113686
assert( !pSelect && pCons && pEnd );
113670113687
if( pCons->z==0 ){
113671113688
pCons = pEnd;
113672113689
}
113673113690
nName = (int)((const char *)pCons->z - zName);
113674
- p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
113691
+ p->addColOffset = 13 + nName;
113675113692
}
113676113693
#endif
113677113694
}
113678113695
}
113679113696
@@ -119732,10 +119749,18 @@
119732119749
break;
119733119750
}
119734119751
}
119735119752
}
119736119753
119754
+/*
119755
+** On some systems, ceil() and floor() are intrinsic function. You are
119756
+** unable to take a pointer to this functions. Hence, we here wrap them
119757
+** in our own actual functions.
119758
+*/
119759
+static double xCeil(double x){ return ceil(x); }
119760
+static double xFloor(double x){ return floor(x); }
119761
+
119737119762
/*
119738119763
** Implementation of SQL functions:
119739119764
**
119740119765
** ln(X) - natural logarithm
119741119766
** log(X) - log X base 10
@@ -119992,13 +120017,13 @@
119992120017
FUNCTION(unknown, -1, 0, 0, unknownFunc ),
119993120018
#endif
119994120019
FUNCTION(coalesce, 1, 0, 0, 0 ),
119995120020
FUNCTION(coalesce, 0, 0, 0, 0 ),
119996120021
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
119997
- MFUNCTION(ceil, 1, ceil, ceilingFunc ),
119998
- MFUNCTION(ceiling, 1, ceil, ceilingFunc ),
119999
- MFUNCTION(floor, 1, floor, ceilingFunc ),
120022
+ MFUNCTION(ceil, 1, xCeil, ceilingFunc ),
120023
+ MFUNCTION(ceiling, 1, xCeil, ceilingFunc ),
120024
+ MFUNCTION(floor, 1, xFloor, ceilingFunc ),
120000120025
#if SQLITE_HAVE_C99_MATH_FUNCS
120001120026
MFUNCTION(trunc, 1, trunc, ceilingFunc ),
120002120027
#endif
120003120028
FUNCTION(ln, 1, 0, 0, logFunc ),
120004120029
FUNCTION(log, 1, 1, 0, logFunc ),
@@ -129554,15 +129579,22 @@
129554129579
129555129580
assert( iDb>=0 && iDb<db->nDb );
129556129581
if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
129557129582
if( argv[3]==0 ){
129558129583
corruptSchema(pData, argv[1], 0);
129559
- }else if( sqlite3_strnicmp(argv[4],"create ",7)==0 ){
129584
+ }else if( argv[4]
129585
+ && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
129586
+ && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
129560129587
/* Call the parser to process a CREATE TABLE, INDEX or VIEW.
129561129588
** But because db->init.busy is set to 1, no VDBE code is generated
129562129589
** or executed. All the parser does is build the internal data
129563129590
** structures that describe the table, index, or view.
129591
+ **
129592
+ ** No other valid SQL statement, other than the variable CREATE statements,
129593
+ ** can begin with the letters "C" and "R". Thus, it is not possible run
129594
+ ** any other kind of statement while parsing the schema, even a corrupt
129595
+ ** schema.
129564129596
*/
129565129597
int rc;
129566129598
u8 saved_iDb = db->init.iDb;
129567129599
sqlite3_stmt *pStmt;
129568129600
TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
@@ -130123,16 +130155,10 @@
130123130155
}else{
130124130156
sqlite3RunParser(&sParse, zSql, &zErrMsg);
130125130157
}
130126130158
assert( 0==sParse.nQueryLoop );
130127130159
130128
- if( sParse.rc==SQLITE_DONE ){
130129
- sParse.rc = SQLITE_OK;
130130
- }
130131
- if( sParse.checkSchema ){
130132
- schemaIsValid(&sParse);
130133
- }
130134130160
if( pzTail ){
130135130161
*pzTail = sParse.zTail;
130136130162
}
130137130163
130138130164
if( db->init.busy==0 ){
@@ -130139,24 +130165,32 @@
130139130165
sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
130140130166
}
130141130167
if( db->mallocFailed ){
130142130168
sParse.rc = SQLITE_NOMEM_BKPT;
130143130169
}
130144
- rc = sParse.rc;
130145
- if( rc!=SQLITE_OK ){
130146
- if( sParse.pVdbe ) sqlite3VdbeFinalize(sParse.pVdbe);
130147
- assert(!(*ppStmt));
130170
+ if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){
130171
+ if( sParse.checkSchema ){
130172
+ schemaIsValid(&sParse);
130173
+ }
130174
+ if( sParse.pVdbe ){
130175
+ sqlite3VdbeFinalize(sParse.pVdbe);
130176
+ }
130177
+ assert( 0==(*ppStmt) );
130178
+ rc = sParse.rc;
130179
+ if( zErrMsg ){
130180
+ sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
130181
+ sqlite3DbFree(db, zErrMsg);
130182
+ }else{
130183
+ sqlite3Error(db, rc);
130184
+ }
130148130185
}else{
130186
+ assert( zErrMsg==0 );
130149130187
*ppStmt = (sqlite3_stmt*)sParse.pVdbe;
130188
+ rc = SQLITE_OK;
130189
+ sqlite3ErrorClear(db);
130150130190
}
130151130191
130152
- if( zErrMsg ){
130153
- sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
130154
- sqlite3DbFree(db, zErrMsg);
130155
- }else{
130156
- sqlite3Error(db, rc);
130157
- }
130158130192
130159130193
/* Delete any TriggerPrg structures allocated while parsing this statement. */
130160130194
while( sParse.pTriggerPrg ){
130161130195
TriggerPrg *pT = sParse.pTriggerPrg;
130162130196
sParse.pTriggerPrg = pT->pNext;
@@ -227684,11 +227718,11 @@
227684227718
int nArg, /* Number of args */
227685227719
sqlite3_value **apUnused /* Function arguments */
227686227720
){
227687227721
assert( nArg==0 );
227688227722
UNUSED_PARAM2(nArg, apUnused);
227689
- sqlite3_result_text(pCtx, "fts5: 2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124d8d7f", -1, SQLITE_TRANSIENT);
227723
+ sqlite3_result_text(pCtx, "fts5: 2021-01-01 18:32:15 5ac939e0adc923378173297e934c3664254a4fefbcddcc842bf4cc42dbaacf4f", -1, SQLITE_TRANSIENT);
227690227724
}
227691227725
227692227726
/*
227693227727
** Return true if zName is the extension on one of the shadow tables used
227694227728
** by this module.
@@ -232610,12 +232644,12 @@
232610232644
}
232611232645
#endif /* SQLITE_CORE */
232612232646
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
232613232647
232614232648
/************** End of stmt.c ************************************************/
232615
-#if __LINE__!=232615
232649
+#if __LINE__!=232649
232616232650
#undef SQLITE_SOURCE_ID
232617
-#define SQLITE_SOURCE_ID "2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124dalt2"
232651
+#define SQLITE_SOURCE_ID "2021-01-01 22:06:17 d01e9f2d00dc439c529cd8885a219fcddbaad73b9f471b020e2a0c18e2adalt2"
232618232652
#endif
232619232653
/* Return the source-id for this library */
232620232654
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
232621232655
/************************** End of sqlite3.c ******************************/
232622232656
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1186,11 +1186,11 @@
1186 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1187 ** [sqlite_version()] and [sqlite_source_id()].
1188 */
1189 #define SQLITE_VERSION "3.35.0"
1190 #define SQLITE_VERSION_NUMBER 3035000
1191 #define SQLITE_SOURCE_ID "2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124d8d7f"
1192
1193 /*
1194 ** CAPI3REF: Run-Time Library Version Numbers
1195 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1196 **
@@ -20025,10 +20025,11 @@
20025 SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr);
20026 SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
20027 SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
20028 SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
20029 SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
 
20030 SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
20031 SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
20032 SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
20033 SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
20034
@@ -31452,10 +31453,20 @@
31452 SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
31453 assert( db!=0 );
31454 db->errCode = err_code;
31455 if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
31456 }
 
 
 
 
 
 
 
 
 
 
31457
31458 /*
31459 ** Load the sqlite3.iSysErrno field if that is an appropriate thing
31460 ** to do based on the SQLite error code in rc.
31461 */
@@ -80554,10 +80565,12 @@
80554 assert( p!=0 );
80555 assert( p->nOp>0 );
80556 assert( pParse!=0 );
80557 assert( p->magic==VDBE_MAGIC_INIT );
80558 assert( pParse==p->pParse );
 
 
80559 db = p->db;
80560 assert( db->mallocFailed==0 );
80561 nVar = pParse->nVar;
80562 nMem = pParse->nMem;
80563 nCursor = pParse->nTab;
@@ -80638,12 +80651,10 @@
80638 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
80639 #endif
80640 }
80641 }
80642
80643 p->pVList = pParse->pVList;
80644 pParse->pVList = 0;
80645 if( db->mallocFailed ){
80646 p->nVar = 0;
80647 p->nCursor = 0;
80648 p->nMem = 0;
80649 }else{
@@ -106877,15 +106888,18 @@
106877 u32 savedDbFlags = db->mDbFlags;
106878 while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
106879 *zEnd-- = '\0';
106880 }
106881 db->mDbFlags |= DBFLAG_PreferBuiltin;
 
 
106882 sqlite3NestedParse(pParse,
106883 "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
106884 "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
 
106885 "WHERE type = 'table' AND name = %Q",
106886 zDb, pNew->addColOffset, zCol, pNew->addColOffset+1,
106887 zTab
106888 );
106889 sqlite3DbFree(db, zCol);
106890 db->mDbFlags = savedDbFlags;
106891 }
@@ -111041,15 +111055,11 @@
111041
111042 /* Don't do any authorization checks if the database is initialising
111043 ** or if the parser is being invoked from within sqlite3_declare_vtab.
111044 */
111045 assert( !IN_RENAME_OBJECT || db->xAuth==0 );
111046 if( db->init.busy || IN_SPECIAL_PARSE ){
111047 return SQLITE_OK;
111048 }
111049
111050 if( db->xAuth==0 ){
111051 return SQLITE_OK;
111052 }
111053
111054 /* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the
111055 ** callback are either NULL pointers or zero-terminated strings that
@@ -111251,10 +111261,14 @@
111251 }
111252
111253 /* Begin by generating some termination code at the end of the
111254 ** vdbe program
111255 */
 
 
 
 
111256 v = sqlite3GetVdbe(pParse);
111257 assert( !pParse->isMultiWrite
111258 || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
111259 if( v ){
111260 sqlite3VdbeAddOp0(v, OP_Halt);
@@ -112363,10 +112377,12 @@
112363 int i;
112364 char *z;
112365 char *zType;
112366 Column *pCol;
112367 sqlite3 *db = pParse->db;
 
 
112368 if( (p = pParse->pNewTable)==0 ) return;
112369 if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
112370 sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
112371 return;
112372 }
@@ -112374,12 +112390,13 @@
112374 if( z==0 ) return;
112375 if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName);
112376 memcpy(z, pName->z, pName->n);
112377 z[pName->n] = 0;
112378 sqlite3Dequote(z);
 
112379 for(i=0; i<p->nCol; i++){
112380 if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){
112381 sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
112382 sqlite3DbFree(db, z);
112383 return;
112384 }
112385 }
@@ -112393,11 +112410,11 @@
112393 p->aCol = aNew;
112394 }
112395 pCol = &p->aCol[p->nCol];
112396 memset(pCol, 0, sizeof(p->aCol[0]));
112397 pCol->zName = z;
112398 pCol->hName = sqlite3StrIHash(z);
112399 sqlite3ColumnPropertiesFromName(p, pCol);
112400
112401 if( pType->n==0 ){
112402 /* If there is no type specified, columns have the default affinity
112403 ** 'BLOB' with a default size of 4 bytes. */
@@ -113669,11 +113686,11 @@
113669 assert( !pSelect && pCons && pEnd );
113670 if( pCons->z==0 ){
113671 pCons = pEnd;
113672 }
113673 nName = (int)((const char *)pCons->z - zName);
113674 p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
113675 }
113676 #endif
113677 }
113678 }
113679
@@ -119732,10 +119749,18 @@
119732 break;
119733 }
119734 }
119735 }
119736
 
 
 
 
 
 
 
 
119737 /*
119738 ** Implementation of SQL functions:
119739 **
119740 ** ln(X) - natural logarithm
119741 ** log(X) - log X base 10
@@ -119992,13 +120017,13 @@
119992 FUNCTION(unknown, -1, 0, 0, unknownFunc ),
119993 #endif
119994 FUNCTION(coalesce, 1, 0, 0, 0 ),
119995 FUNCTION(coalesce, 0, 0, 0, 0 ),
119996 #ifdef SQLITE_ENABLE_MATH_FUNCTIONS
119997 MFUNCTION(ceil, 1, ceil, ceilingFunc ),
119998 MFUNCTION(ceiling, 1, ceil, ceilingFunc ),
119999 MFUNCTION(floor, 1, floor, ceilingFunc ),
120000 #if SQLITE_HAVE_C99_MATH_FUNCS
120001 MFUNCTION(trunc, 1, trunc, ceilingFunc ),
120002 #endif
120003 FUNCTION(ln, 1, 0, 0, logFunc ),
120004 FUNCTION(log, 1, 1, 0, logFunc ),
@@ -129554,15 +129579,22 @@
129554
129555 assert( iDb>=0 && iDb<db->nDb );
129556 if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
129557 if( argv[3]==0 ){
129558 corruptSchema(pData, argv[1], 0);
129559 }else if( sqlite3_strnicmp(argv[4],"create ",7)==0 ){
 
 
129560 /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
129561 ** But because db->init.busy is set to 1, no VDBE code is generated
129562 ** or executed. All the parser does is build the internal data
129563 ** structures that describe the table, index, or view.
 
 
 
 
 
129564 */
129565 int rc;
129566 u8 saved_iDb = db->init.iDb;
129567 sqlite3_stmt *pStmt;
129568 TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
@@ -130123,16 +130155,10 @@
130123 }else{
130124 sqlite3RunParser(&sParse, zSql, &zErrMsg);
130125 }
130126 assert( 0==sParse.nQueryLoop );
130127
130128 if( sParse.rc==SQLITE_DONE ){
130129 sParse.rc = SQLITE_OK;
130130 }
130131 if( sParse.checkSchema ){
130132 schemaIsValid(&sParse);
130133 }
130134 if( pzTail ){
130135 *pzTail = sParse.zTail;
130136 }
130137
130138 if( db->init.busy==0 ){
@@ -130139,24 +130165,32 @@
130139 sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
130140 }
130141 if( db->mallocFailed ){
130142 sParse.rc = SQLITE_NOMEM_BKPT;
130143 }
130144 rc = sParse.rc;
130145 if( rc!=SQLITE_OK ){
130146 if( sParse.pVdbe ) sqlite3VdbeFinalize(sParse.pVdbe);
130147 assert(!(*ppStmt));
 
 
 
 
 
 
 
 
 
 
 
130148 }else{
 
130149 *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
 
 
130150 }
130151
130152 if( zErrMsg ){
130153 sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
130154 sqlite3DbFree(db, zErrMsg);
130155 }else{
130156 sqlite3Error(db, rc);
130157 }
130158
130159 /* Delete any TriggerPrg structures allocated while parsing this statement. */
130160 while( sParse.pTriggerPrg ){
130161 TriggerPrg *pT = sParse.pTriggerPrg;
130162 sParse.pTriggerPrg = pT->pNext;
@@ -227684,11 +227718,11 @@
227684 int nArg, /* Number of args */
227685 sqlite3_value **apUnused /* Function arguments */
227686 ){
227687 assert( nArg==0 );
227688 UNUSED_PARAM2(nArg, apUnused);
227689 sqlite3_result_text(pCtx, "fts5: 2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124d8d7f", -1, SQLITE_TRANSIENT);
227690 }
227691
227692 /*
227693 ** Return true if zName is the extension on one of the shadow tables used
227694 ** by this module.
@@ -232610,12 +232644,12 @@
232610 }
232611 #endif /* SQLITE_CORE */
232612 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
232613
232614 /************** End of stmt.c ************************************************/
232615 #if __LINE__!=232615
232616 #undef SQLITE_SOURCE_ID
232617 #define SQLITE_SOURCE_ID "2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124dalt2"
232618 #endif
232619 /* Return the source-id for this library */
232620 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
232621 /************************** End of sqlite3.c ******************************/
232622
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1186,11 +1186,11 @@
1186 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1187 ** [sqlite_version()] and [sqlite_source_id()].
1188 */
1189 #define SQLITE_VERSION "3.35.0"
1190 #define SQLITE_VERSION_NUMBER 3035000
1191 #define SQLITE_SOURCE_ID "2021-01-01 22:06:17 d01e9f2d00dc439c529cd8885a219fcddbaad73b9f471b020e2a0c18e2add69b"
1192
1193 /*
1194 ** CAPI3REF: Run-Time Library Version Numbers
1195 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1196 **
@@ -20025,10 +20025,11 @@
20025 SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr);
20026 SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8);
20027 SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*);
20028 SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...);
20029 SQLITE_PRIVATE void sqlite3Error(sqlite3*,int);
20030 SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3*);
20031 SQLITE_PRIVATE void sqlite3SystemError(sqlite3*,int);
20032 SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
20033 SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
20034 SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
20035
@@ -31452,10 +31453,20 @@
31453 SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
31454 assert( db!=0 );
31455 db->errCode = err_code;
31456 if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code);
31457 }
31458
31459 /*
31460 ** The equivalent of sqlite3Error(db, SQLITE_OK). Clear the error state
31461 ** and error message.
31462 */
31463 SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){
31464 assert( db!=0 );
31465 db->errCode = SQLITE_OK;
31466 if( db->pErr ) sqlite3ValueSetNull(db->pErr);
31467 }
31468
31469 /*
31470 ** Load the sqlite3.iSysErrno field if that is an appropriate thing
31471 ** to do based on the SQLite error code in rc.
31472 */
@@ -80554,10 +80565,12 @@
80565 assert( p!=0 );
80566 assert( p->nOp>0 );
80567 assert( pParse!=0 );
80568 assert( p->magic==VDBE_MAGIC_INIT );
80569 assert( pParse==p->pParse );
80570 p->pVList = pParse->pVList;
80571 pParse->pVList = 0;
80572 db = p->db;
80573 assert( db->mallocFailed==0 );
80574 nVar = pParse->nVar;
80575 nMem = pParse->nMem;
80576 nCursor = pParse->nTab;
@@ -80638,12 +80651,10 @@
80651 p->anExec = allocSpace(&x, p->anExec, p->nOp*sizeof(i64));
80652 #endif
80653 }
80654 }
80655
 
 
80656 if( db->mallocFailed ){
80657 p->nVar = 0;
80658 p->nCursor = 0;
80659 p->nMem = 0;
80660 }else{
@@ -106877,15 +106888,18 @@
106888 u32 savedDbFlags = db->mDbFlags;
106889 while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
106890 *zEnd-- = '\0';
106891 }
106892 db->mDbFlags |= DBFLAG_PreferBuiltin;
106893 /* substr() operations on characters, but addColOffset is in bytes. So we
106894 ** have to use printf() to translate between these units: */
106895 sqlite3NestedParse(pParse,
106896 "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET "
106897 "sql = printf('%%.%ds, ',sql) || %Q"
106898 " || substr(sql,1+length(printf('%%.%ds',sql))) "
106899 "WHERE type = 'table' AND name = %Q",
106900 zDb, pNew->addColOffset, zCol, pNew->addColOffset,
106901 zTab
106902 );
106903 sqlite3DbFree(db, zCol);
106904 db->mDbFlags = savedDbFlags;
106905 }
@@ -111041,15 +111055,11 @@
111055
111056 /* Don't do any authorization checks if the database is initialising
111057 ** or if the parser is being invoked from within sqlite3_declare_vtab.
111058 */
111059 assert( !IN_RENAME_OBJECT || db->xAuth==0 );
111060 if( db->xAuth==0 || db->init.busy || IN_SPECIAL_PARSE ){
 
 
 
 
111061 return SQLITE_OK;
111062 }
111063
111064 /* EVIDENCE-OF: R-43249-19882 The third through sixth parameters to the
111065 ** callback are either NULL pointers or zero-terminated strings that
@@ -111251,10 +111261,14 @@
111261 }
111262
111263 /* Begin by generating some termination code at the end of the
111264 ** vdbe program
111265 */
111266 if( pParse->pVdbe==0 && db->init.busy ){
111267 pParse->rc = SQLITE_DONE;
111268 return;
111269 }
111270 v = sqlite3GetVdbe(pParse);
111271 assert( !pParse->isMultiWrite
111272 || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort));
111273 if( v ){
111274 sqlite3VdbeAddOp0(v, OP_Halt);
@@ -112363,10 +112377,12 @@
112377 int i;
112378 char *z;
112379 char *zType;
112380 Column *pCol;
112381 sqlite3 *db = pParse->db;
112382 u8 hName;
112383
112384 if( (p = pParse->pNewTable)==0 ) return;
112385 if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
112386 sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
112387 return;
112388 }
@@ -112374,12 +112390,13 @@
112390 if( z==0 ) return;
112391 if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName);
112392 memcpy(z, pName->z, pName->n);
112393 z[pName->n] = 0;
112394 sqlite3Dequote(z);
112395 hName = sqlite3StrIHash(z);
112396 for(i=0; i<p->nCol; i++){
112397 if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zName)==0 ){
112398 sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
112399 sqlite3DbFree(db, z);
112400 return;
112401 }
112402 }
@@ -112393,11 +112410,11 @@
112410 p->aCol = aNew;
112411 }
112412 pCol = &p->aCol[p->nCol];
112413 memset(pCol, 0, sizeof(p->aCol[0]));
112414 pCol->zName = z;
112415 pCol->hName = hName;
112416 sqlite3ColumnPropertiesFromName(p, pCol);
112417
112418 if( pType->n==0 ){
112419 /* If there is no type specified, columns have the default affinity
112420 ** 'BLOB' with a default size of 4 bytes. */
@@ -113669,11 +113686,11 @@
113686 assert( !pSelect && pCons && pEnd );
113687 if( pCons->z==0 ){
113688 pCons = pEnd;
113689 }
113690 nName = (int)((const char *)pCons->z - zName);
113691 p->addColOffset = 13 + nName;
113692 }
113693 #endif
113694 }
113695 }
113696
@@ -119732,10 +119749,18 @@
119749 break;
119750 }
119751 }
119752 }
119753
119754 /*
119755 ** On some systems, ceil() and floor() are intrinsic function. You are
119756 ** unable to take a pointer to this functions. Hence, we here wrap them
119757 ** in our own actual functions.
119758 */
119759 static double xCeil(double x){ return ceil(x); }
119760 static double xFloor(double x){ return floor(x); }
119761
119762 /*
119763 ** Implementation of SQL functions:
119764 **
119765 ** ln(X) - natural logarithm
119766 ** log(X) - log X base 10
@@ -119992,13 +120017,13 @@
120017 FUNCTION(unknown, -1, 0, 0, unknownFunc ),
120018 #endif
120019 FUNCTION(coalesce, 1, 0, 0, 0 ),
120020 FUNCTION(coalesce, 0, 0, 0, 0 ),
120021 #ifdef SQLITE_ENABLE_MATH_FUNCTIONS
120022 MFUNCTION(ceil, 1, xCeil, ceilingFunc ),
120023 MFUNCTION(ceiling, 1, xCeil, ceilingFunc ),
120024 MFUNCTION(floor, 1, xFloor, ceilingFunc ),
120025 #if SQLITE_HAVE_C99_MATH_FUNCS
120026 MFUNCTION(trunc, 1, trunc, ceilingFunc ),
120027 #endif
120028 FUNCTION(ln, 1, 0, 0, logFunc ),
120029 FUNCTION(log, 1, 1, 0, logFunc ),
@@ -129554,15 +129579,22 @@
129579
129580 assert( iDb>=0 && iDb<db->nDb );
129581 if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */
129582 if( argv[3]==0 ){
129583 corruptSchema(pData, argv[1], 0);
129584 }else if( argv[4]
129585 && 'c'==sqlite3UpperToLower[(unsigned char)argv[4][0]]
129586 && 'r'==sqlite3UpperToLower[(unsigned char)argv[4][1]] ){
129587 /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
129588 ** But because db->init.busy is set to 1, no VDBE code is generated
129589 ** or executed. All the parser does is build the internal data
129590 ** structures that describe the table, index, or view.
129591 **
129592 ** No other valid SQL statement, other than the variable CREATE statements,
129593 ** can begin with the letters "C" and "R". Thus, it is not possible run
129594 ** any other kind of statement while parsing the schema, even a corrupt
129595 ** schema.
129596 */
129597 int rc;
129598 u8 saved_iDb = db->init.iDb;
129599 sqlite3_stmt *pStmt;
129600 TESTONLY(int rcp); /* Return code from sqlite3_prepare() */
@@ -130123,16 +130155,10 @@
130155 }else{
130156 sqlite3RunParser(&sParse, zSql, &zErrMsg);
130157 }
130158 assert( 0==sParse.nQueryLoop );
130159
 
 
 
 
 
 
130160 if( pzTail ){
130161 *pzTail = sParse.zTail;
130162 }
130163
130164 if( db->init.busy==0 ){
@@ -130139,24 +130165,32 @@
130165 sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
130166 }
130167 if( db->mallocFailed ){
130168 sParse.rc = SQLITE_NOMEM_BKPT;
130169 }
130170 if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){
130171 if( sParse.checkSchema ){
130172 schemaIsValid(&sParse);
130173 }
130174 if( sParse.pVdbe ){
130175 sqlite3VdbeFinalize(sParse.pVdbe);
130176 }
130177 assert( 0==(*ppStmt) );
130178 rc = sParse.rc;
130179 if( zErrMsg ){
130180 sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg);
130181 sqlite3DbFree(db, zErrMsg);
130182 }else{
130183 sqlite3Error(db, rc);
130184 }
130185 }else{
130186 assert( zErrMsg==0 );
130187 *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
130188 rc = SQLITE_OK;
130189 sqlite3ErrorClear(db);
130190 }
130191
 
 
 
 
 
 
130192
130193 /* Delete any TriggerPrg structures allocated while parsing this statement. */
130194 while( sParse.pTriggerPrg ){
130195 TriggerPrg *pT = sParse.pTriggerPrg;
130196 sParse.pTriggerPrg = pT->pNext;
@@ -227684,11 +227718,11 @@
227718 int nArg, /* Number of args */
227719 sqlite3_value **apUnused /* Function arguments */
227720 ){
227721 assert( nArg==0 );
227722 UNUSED_PARAM2(nArg, apUnused);
227723 sqlite3_result_text(pCtx, "fts5: 2021-01-01 18:32:15 5ac939e0adc923378173297e934c3664254a4fefbcddcc842bf4cc42dbaacf4f", -1, SQLITE_TRANSIENT);
227724 }
227725
227726 /*
227727 ** Return true if zName is the extension on one of the shadow tables used
227728 ** by this module.
@@ -232610,12 +232644,12 @@
232644 }
232645 #endif /* SQLITE_CORE */
232646 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
232647
232648 /************** End of stmt.c ************************************************/
232649 #if __LINE__!=232649
232650 #undef SQLITE_SOURCE_ID
232651 #define SQLITE_SOURCE_ID "2021-01-01 22:06:17 d01e9f2d00dc439c529cd8885a219fcddbaad73b9f471b020e2a0c18e2adalt2"
232652 #endif
232653 /* Return the source-id for this library */
232654 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
232655 /************************** End of sqlite3.c ******************************/
232656
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126126
#define SQLITE_VERSION "3.35.0"
127127
#define SQLITE_VERSION_NUMBER 3035000
128
-#define SQLITE_SOURCE_ID "2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124d8d7f"
128
+#define SQLITE_SOURCE_ID "2021-01-01 22:06:17 d01e9f2d00dc439c529cd8885a219fcddbaad73b9f471b020e2a0c18e2add69b"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
134134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.35.0"
127 #define SQLITE_VERSION_NUMBER 3035000
128 #define SQLITE_SOURCE_ID "2020-12-30 13:20:27 45f46317ab8bd92dcd346bf00ba3a33b0cfd030b790c04e19ef33cff124d8d7f"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -123,11 +123,11 @@
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.35.0"
127 #define SQLITE_VERSION_NUMBER 3035000
128 #define SQLITE_SOURCE_ID "2021-01-01 22:06:17 d01e9f2d00dc439c529cd8885a219fcddbaad73b9f471b020e2a0c18e2add69b"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button