Fossil SCM

Update the built-in SQLite to the latest 3.19.0 alpha that includes the authorizer callback enhancements.

drh 2017-05-10 16:19 trunk
Commit 094a498d9915689b6e9cb2a0ead3f8fbd3bad0cad5ec687f3d89718b94de27c4
3 files changed +5 -1 +80 -20 +1 -1
+5 -1
--- src/shell.c
+++ src/shell.c
@@ -436,11 +436,11 @@
436436
static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
437437
int i;
438438
int n;
439439
int aw = w<0 ? -w : w;
440440
char zBuf[1000];
441
- if( aw>sizeof(zBuf)/3 ) aw = sizeof(zBuf)/3;
441
+ if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3;
442442
for(i=n=0; zUtf[i]; i++){
443443
if( (zUtf[i]&0xc0)!=0x80 ){
444444
n++;
445445
if( n==aw ){
446446
do{ i++; }while( (zUtf[i]&0xc0)==0x80 );
@@ -741,10 +741,14 @@
741741
} u;
742742
unsigned nRate; /* Bytes of input accepted per Keccak iteration */
743743
unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */
744744
unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */
745745
};
746
+
747
+/* Allow the following routine to use the B0 variable, which is also
748
+** a macro in the termios.h header file */
749
+#undef B0
746750
747751
/*
748752
** A single step of the Keccak mixing function for a 1600-bit state
749753
*/
750754
static void KeccakF1600Step(SHA3Context *p){
751755
--- src/shell.c
+++ src/shell.c
@@ -436,11 +436,11 @@
436 static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
437 int i;
438 int n;
439 int aw = w<0 ? -w : w;
440 char zBuf[1000];
441 if( aw>sizeof(zBuf)/3 ) aw = sizeof(zBuf)/3;
442 for(i=n=0; zUtf[i]; i++){
443 if( (zUtf[i]&0xc0)!=0x80 ){
444 n++;
445 if( n==aw ){
446 do{ i++; }while( (zUtf[i]&0xc0)==0x80 );
@@ -741,10 +741,14 @@
741 } u;
742 unsigned nRate; /* Bytes of input accepted per Keccak iteration */
743 unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */
744 unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */
745 };
 
 
 
 
746
747 /*
748 ** A single step of the Keccak mixing function for a 1600-bit state
749 */
750 static void KeccakF1600Step(SHA3Context *p){
751
--- src/shell.c
+++ src/shell.c
@@ -436,11 +436,11 @@
436 static void utf8_width_print(FILE *pOut, int w, const char *zUtf){
437 int i;
438 int n;
439 int aw = w<0 ? -w : w;
440 char zBuf[1000];
441 if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3;
442 for(i=n=0; zUtf[i]; i++){
443 if( (zUtf[i]&0xc0)!=0x80 ){
444 n++;
445 if( n==aw ){
446 do{ i++; }while( (zUtf[i]&0xc0)==0x80 );
@@ -741,10 +741,14 @@
741 } u;
742 unsigned nRate; /* Bytes of input accepted per Keccak iteration */
743 unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */
744 unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */
745 };
746
747 /* Allow the following routine to use the B0 variable, which is also
748 ** a macro in the termios.h header file */
749 #undef B0
750
751 /*
752 ** A single step of the Keccak mixing function for a 1600-bit state
753 */
754 static void KeccakF1600Step(SHA3Context *p){
755
+80 -20
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -398,11 +398,11 @@
398398
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
399399
** [sqlite_version()] and [sqlite_source_id()].
400400
*/
401401
#define SQLITE_VERSION "3.19.0"
402402
#define SQLITE_VERSION_NUMBER 3019000
403
-#define SQLITE_SOURCE_ID "2017-05-02 18:00:31 430f539cbb3f806fb89191e0b759a5f8b49d9e5b6c95fe9a4b55a1aa0875762a"
403
+#define SQLITE_SOURCE_ID "2017-05-10 16:12:00 92ab1f7257d2866c69eaaf4cf85990677b911ef425e9c5a36a96978cccfb551c"
404404
405405
/*
406406
** CAPI3REF: Run-Time Library Version Numbers
407407
** KEYWORDS: sqlite3_version sqlite3_sourceid
408408
**
@@ -17272,13 +17272,20 @@
1727217272
** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
1727317273
**
1727417274
** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally
1727517275
** disabled. The default value may be changed by compiling with the
1727617276
** SQLITE_USE_URI symbol defined.
17277
+**
17278
+** URI filenames are enabled by default if SQLITE_HAS_CODEC is
17279
+** enabled.
1727717280
*/
1727817281
#ifndef SQLITE_USE_URI
17279
-# define SQLITE_USE_URI 0
17282
+# ifdef SQLITE_HAS_CODEC
17283
+# define SQLITE_USE_URI 1
17284
+# else
17285
+# define SQLITE_USE_URI 0
17286
+# endif
1728017287
#endif
1728117288
1728217289
/* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
1728317290
** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
1728417291
** that compile-time option is omitted.
@@ -28348,10 +28355,11 @@
2834828355
}else{
2834928356
return 0;
2835028357
}
2835128358
}
2835228359
#endif
28360
+ if( !sqlite3Isdigit(zNum[0]) ) return 0;
2835328361
while( zNum[0]=='0' ) zNum++;
2835428362
for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
2835528363
v = v*10 + c;
2835628364
}
2835728365
@@ -49153,10 +49161,15 @@
4915349161
Pgno pgno; /* The page number of a page in journal */
4915449162
u32 cksum; /* Checksum used for sanity checking */
4915549163
char *aData; /* Temporary storage for the page */
4915649164
sqlite3_file *jfd; /* The file descriptor for the journal file */
4915749165
int isSynced; /* True if journal page is synced */
49166
+#ifdef SQLITE_HAS_CODEC
49167
+ /* The jrnlEnc flag is true if Journal pages should be passed through
49168
+ ** the codec. It is false for pure in-memory journals. */
49169
+ const int jrnlEnc = (isMainJrnl || pPager->subjInMemory==0);
49170
+#endif
4915849171
4915949172
assert( (isMainJrnl&~1)==0 ); /* isMainJrnl is 0 or 1 */
4916049173
assert( (isSavepnt&~1)==0 ); /* isSavepnt is 0 or 1 */
4916149174
assert( isMainJrnl || pDone ); /* pDone always used on sub-journals */
4916249175
assert( isSavepnt || pDone==0 ); /* pDone never used on non-savepoint */
@@ -49276,18 +49289,38 @@
4927649289
&& isSynced
4927749290
){
4927849291
i64 ofst = (pgno-1)*(i64)pPager->pageSize;
4927949292
testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 );
4928049293
assert( !pagerUseWal(pPager) );
49294
+
49295
+ /* Write the data read from the journal back into the database file.
49296
+ ** This is usually safe even for an encrypted database - as the data
49297
+ ** was encrypted before it was written to the journal file. The exception
49298
+ ** is if the data was just read from an in-memory sub-journal. In that
49299
+ ** case it must be encrypted here before it is copied into the database
49300
+ ** file. */
49301
+#ifdef SQLITE_HAS_CODEC
49302
+ if( !jrnlEnc ){
49303
+ CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData);
49304
+ rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst);
49305
+ CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
49306
+ }else
49307
+#endif
4928149308
rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst);
49309
+
4928249310
if( pgno>pPager->dbFileSize ){
4928349311
pPager->dbFileSize = pgno;
4928449312
}
4928549313
if( pPager->pBackup ){
49286
- CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
49314
+#ifdef SQLITE_HAS_CODEC
49315
+ if( jrnlEnc ){
49316
+ CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
49317
+ sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
49318
+ CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT,aData);
49319
+ }else
49320
+#endif
4928749321
sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
49288
- CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData);
4928949322
}
4929049323
}else if( !isMainJrnl && pPg==0 ){
4929149324
/* If this is a rollback of a savepoint and data was not written to
4929249325
** the database and the page is not in-memory, there is a potential
4929349326
** problem. When the page is next fetched by the b-tree layer, it
@@ -49335,11 +49368,13 @@
4933549368
if( pgno==1 ){
4933649369
memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers));
4933749370
}
4933849371
4933949372
/* Decode the page just read from disk */
49340
- CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT);
49373
+#if SQLITE_HAS_CODEC
49374
+ if( jrnlEnc ){ CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT); }
49375
+#endif
4934149376
sqlite3PcacheRelease(pPg);
4934249377
}
4934349378
return rc;
4934449379
}
4934549380
@@ -51347,12 +51382,17 @@
5134751382
** write the journal record into the file. */
5134851383
if( rc==SQLITE_OK ){
5134951384
void *pData = pPg->pData;
5135051385
i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
5135151386
char *pData2;
51352
-
51353
- CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
51387
+
51388
+#if SQLITE_HAS_CODEC
51389
+ if( !pPager->subjInMemory ){
51390
+ CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
51391
+ }else
51392
+#endif
51393
+ pData2 = pData;
5135451394
PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
5135551395
rc = write32bits(pPager->sjfd, offset, pPg->pgno);
5135651396
if( rc==SQLITE_OK ){
5135751397
rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);
5135851398
}
@@ -92369,11 +92409,11 @@
9236992409
pList->a[pList->nExpr-1].zName = pColumns->a[i].zName;
9237092410
pColumns->a[i].zName = 0;
9237192411
}
9237292412
}
9237392413
92374
- if( pExpr->op==TK_SELECT && pList ){
92414
+ if( !db->mallocFailed && pExpr->op==TK_SELECT && ALWAYS(pList!=0) ){
9237592415
Expr *pFirst = pList->a[iFirst].pExpr;
9237692416
assert( pFirst!=0 );
9237792417
assert( pFirst->op==TK_SELECT_COLUMN );
9237892418
9237992419
/* Store the SELECT statement in pRight so it will be deleted when
@@ -121536,17 +121576,34 @@
121536121576
#endif
121537121577
return rc;
121538121578
}
121539121579
#endif
121540121580
121541
- /* Generate code for all sub-queries in the FROM clause
121581
+ /* For each term in the FROM clause, do two things:
121582
+ ** (1) Authorized unreferenced tables
121583
+ ** (2) Generate code for all sub-queries
121542121584
*/
121543
-#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
121544121585
for(i=0; i<pTabList->nSrc; i++){
121545121586
struct SrcList_item *pItem = &pTabList->a[i];
121546121587
SelectDest dest;
121547
- Select *pSub = pItem->pSelect;
121588
+ Select *pSub;
121589
+
121590
+ /* Issue SQLITE_READ authorizations with a NULL column name for any tables that
121591
+ ** are referenced but from which no values are extracted. Examples of where these
121592
+ ** kinds of null SQLITE_READ authorizations would occur:
121593
+ **
121594
+ ** SELECT count(*) FROM t1; -- SQLITE_READ t1 null
121595
+ ** SELECT t1.* FROM t1, t2; -- SQLITE_READ t2 null
121596
+ */
121597
+ if( pItem->colUsed==0 ){
121598
+ sqlite3AuthCheck(pParse, SQLITE_READ, pItem->zName, pItem->zDatabase, 0);
121599
+ }
121600
+
121601
+#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
121602
+ /* Generate code for all sub-queries in the FROM clause
121603
+ */
121604
+ pSub = pItem->pSelect;
121548121605
if( pSub==0 ) continue;
121549121606
121550121607
/* Sometimes the code for a subquery will be generated more than
121551121608
** once, if the subquery is part of the WHERE clause in a LEFT JOIN,
121552121609
** for example. In that case, do not regenerate the code to manifest
@@ -121663,12 +121720,12 @@
121663121720
sqlite3VdbeChangeP1(v, topAddr, retAddr);
121664121721
sqlite3ClearTempRegCache(pParse);
121665121722
}
121666121723
if( db->mallocFailed ) goto select_end;
121667121724
pParse->nHeight -= sqlite3SelectExprHeight(p);
121725
+#endif
121668121726
}
121669
-#endif
121670121727
121671121728
/* Various elements of the SELECT copied into local variables for
121672121729
** convenience */
121673121730
pEList = p->pEList;
121674121731
pWhere = p->pWhere;
@@ -143421,20 +143478,22 @@
143421143478
sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);
143422143479
}
143423143480
#endif
143424143481
#if defined(SQLITE_HAS_CODEC)
143425143482
if( rc==SQLITE_OK ){
143426
- const char *zHexKey = sqlite3_uri_parameter(zOpen, "hexkey");
143427
- if( zHexKey && zHexKey[0] ){
143483
+ const char *zKey;
143484
+ if( (zKey = sqlite3_uri_parameter(zOpen, "hexkey"))!=0 && zKey[0] ){;
143428143485
u8 iByte;
143429143486
int i;
143430
- char zKey[40];
143431
- for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zHexKey[i]); i++){
143432
- iByte = (iByte<<4) + sqlite3HexToInt(zHexKey[i]);
143433
- if( (i&1)!=0 ) zKey[i/2] = iByte;
143487
+ char zDecoded[40];
143488
+ for(i=0, iByte=0; i<sizeof(zDecoded)*2 && sqlite3Isxdigit(zKey[i]); i++){
143489
+ iByte = (iByte<<4) + sqlite3HexToInt(zKey[i]);
143490
+ if( (i&1)!=0 ) zDecoded[i/2] = iByte;
143434143491
}
143435
- sqlite3_key_v2(db, 0, zKey, i/2);
143492
+ sqlite3_key_v2(db, 0, zDecoded, i/2);
143493
+ }else if( (zKey = sqlite3_uri_parameter(zOpen, "key"))!=0 ){
143494
+ sqlite3_key_v2(db, 0, zKey, sqlite3Strlen30(zKey));
143436143495
}
143437143496
}
143438143497
#endif
143439143498
sqlite3_free(zOpen);
143440143499
return rc & 0xff;
@@ -167122,10 +167181,11 @@
167122167181
** COMMIT;
167123167182
*/
167124167183
static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){
167125167184
Rtree *pRtree = (Rtree *)pVtab;
167126167185
int iwt = pRtree->inWrTrans;
167186
+ UNUSED_PARAMETER(iSavepoint);
167127167187
pRtree->inWrTrans = 0;
167128167188
nodeBlobReset(pRtree);
167129167189
pRtree->inWrTrans = iwt;
167130167190
return SQLITE_OK;
167131167191
}
@@ -198848,11 +198908,11 @@
198848198908
int nArg, /* Number of args */
198849198909
sqlite3_value **apUnused /* Function arguments */
198850198910
){
198851198911
assert( nArg==0 );
198852198912
UNUSED_PARAM2(nArg, apUnused);
198853
- sqlite3_result_text(pCtx, "fts5: 2017-05-02 18:00:31 430f539cbb3f806fb89191e0b759a5f8b49d9e5b6c95fe9a4b55a1aa0875762a", -1, SQLITE_TRANSIENT);
198913
+ sqlite3_result_text(pCtx, "fts5: 2017-05-10 16:12:00 92ab1f7257d2866c69eaaf4cf85990677b911ef425e9c5a36a96978cccfb551c", -1, SQLITE_TRANSIENT);
198854198914
}
198855198915
198856198916
static int fts5Init(sqlite3 *db){
198857198917
static const sqlite3_module fts5Mod = {
198858198918
/* iVersion */ 2,
198859198919
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -398,11 +398,11 @@
398 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
399 ** [sqlite_version()] and [sqlite_source_id()].
400 */
401 #define SQLITE_VERSION "3.19.0"
402 #define SQLITE_VERSION_NUMBER 3019000
403 #define SQLITE_SOURCE_ID "2017-05-02 18:00:31 430f539cbb3f806fb89191e0b759a5f8b49d9e5b6c95fe9a4b55a1aa0875762a"
404
405 /*
406 ** CAPI3REF: Run-Time Library Version Numbers
407 ** KEYWORDS: sqlite3_version sqlite3_sourceid
408 **
@@ -17272,13 +17272,20 @@
17272 ** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
17273 **
17274 ** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally
17275 ** disabled. The default value may be changed by compiling with the
17276 ** SQLITE_USE_URI symbol defined.
 
 
 
17277 */
17278 #ifndef SQLITE_USE_URI
17279 # define SQLITE_USE_URI 0
 
 
 
 
17280 #endif
17281
17282 /* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
17283 ** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
17284 ** that compile-time option is omitted.
@@ -28348,10 +28355,11 @@
28348 }else{
28349 return 0;
28350 }
28351 }
28352 #endif
 
28353 while( zNum[0]=='0' ) zNum++;
28354 for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
28355 v = v*10 + c;
28356 }
28357
@@ -49153,10 +49161,15 @@
49153 Pgno pgno; /* The page number of a page in journal */
49154 u32 cksum; /* Checksum used for sanity checking */
49155 char *aData; /* Temporary storage for the page */
49156 sqlite3_file *jfd; /* The file descriptor for the journal file */
49157 int isSynced; /* True if journal page is synced */
 
 
 
 
 
49158
49159 assert( (isMainJrnl&~1)==0 ); /* isMainJrnl is 0 or 1 */
49160 assert( (isSavepnt&~1)==0 ); /* isSavepnt is 0 or 1 */
49161 assert( isMainJrnl || pDone ); /* pDone always used on sub-journals */
49162 assert( isSavepnt || pDone==0 ); /* pDone never used on non-savepoint */
@@ -49276,18 +49289,38 @@
49276 && isSynced
49277 ){
49278 i64 ofst = (pgno-1)*(i64)pPager->pageSize;
49279 testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 );
49280 assert( !pagerUseWal(pPager) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49281 rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst);
 
49282 if( pgno>pPager->dbFileSize ){
49283 pPager->dbFileSize = pgno;
49284 }
49285 if( pPager->pBackup ){
49286 CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
 
 
 
 
 
 
49287 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
49288 CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData);
49289 }
49290 }else if( !isMainJrnl && pPg==0 ){
49291 /* If this is a rollback of a savepoint and data was not written to
49292 ** the database and the page is not in-memory, there is a potential
49293 ** problem. When the page is next fetched by the b-tree layer, it
@@ -49335,11 +49368,13 @@
49335 if( pgno==1 ){
49336 memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers));
49337 }
49338
49339 /* Decode the page just read from disk */
49340 CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT);
 
 
49341 sqlite3PcacheRelease(pPg);
49342 }
49343 return rc;
49344 }
49345
@@ -51347,12 +51382,17 @@
51347 ** write the journal record into the file. */
51348 if( rc==SQLITE_OK ){
51349 void *pData = pPg->pData;
51350 i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
51351 char *pData2;
51352
51353 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
 
 
 
 
 
51354 PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
51355 rc = write32bits(pPager->sjfd, offset, pPg->pgno);
51356 if( rc==SQLITE_OK ){
51357 rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);
51358 }
@@ -92369,11 +92409,11 @@
92369 pList->a[pList->nExpr-1].zName = pColumns->a[i].zName;
92370 pColumns->a[i].zName = 0;
92371 }
92372 }
92373
92374 if( pExpr->op==TK_SELECT && pList ){
92375 Expr *pFirst = pList->a[iFirst].pExpr;
92376 assert( pFirst!=0 );
92377 assert( pFirst->op==TK_SELECT_COLUMN );
92378
92379 /* Store the SELECT statement in pRight so it will be deleted when
@@ -121536,17 +121576,34 @@
121536 #endif
121537 return rc;
121538 }
121539 #endif
121540
121541 /* Generate code for all sub-queries in the FROM clause
 
 
121542 */
121543 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
121544 for(i=0; i<pTabList->nSrc; i++){
121545 struct SrcList_item *pItem = &pTabList->a[i];
121546 SelectDest dest;
121547 Select *pSub = pItem->pSelect;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121548 if( pSub==0 ) continue;
121549
121550 /* Sometimes the code for a subquery will be generated more than
121551 ** once, if the subquery is part of the WHERE clause in a LEFT JOIN,
121552 ** for example. In that case, do not regenerate the code to manifest
@@ -121663,12 +121720,12 @@
121663 sqlite3VdbeChangeP1(v, topAddr, retAddr);
121664 sqlite3ClearTempRegCache(pParse);
121665 }
121666 if( db->mallocFailed ) goto select_end;
121667 pParse->nHeight -= sqlite3SelectExprHeight(p);
 
121668 }
121669 #endif
121670
121671 /* Various elements of the SELECT copied into local variables for
121672 ** convenience */
121673 pEList = p->pEList;
121674 pWhere = p->pWhere;
@@ -143421,20 +143478,22 @@
143421 sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);
143422 }
143423 #endif
143424 #if defined(SQLITE_HAS_CODEC)
143425 if( rc==SQLITE_OK ){
143426 const char *zHexKey = sqlite3_uri_parameter(zOpen, "hexkey");
143427 if( zHexKey && zHexKey[0] ){
143428 u8 iByte;
143429 int i;
143430 char zKey[40];
143431 for(i=0, iByte=0; i<sizeof(zKey)*2 && sqlite3Isxdigit(zHexKey[i]); i++){
143432 iByte = (iByte<<4) + sqlite3HexToInt(zHexKey[i]);
143433 if( (i&1)!=0 ) zKey[i/2] = iByte;
143434 }
143435 sqlite3_key_v2(db, 0, zKey, i/2);
 
 
143436 }
143437 }
143438 #endif
143439 sqlite3_free(zOpen);
143440 return rc & 0xff;
@@ -167122,10 +167181,11 @@
167122 ** COMMIT;
167123 */
167124 static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){
167125 Rtree *pRtree = (Rtree *)pVtab;
167126 int iwt = pRtree->inWrTrans;
 
167127 pRtree->inWrTrans = 0;
167128 nodeBlobReset(pRtree);
167129 pRtree->inWrTrans = iwt;
167130 return SQLITE_OK;
167131 }
@@ -198848,11 +198908,11 @@
198848 int nArg, /* Number of args */
198849 sqlite3_value **apUnused /* Function arguments */
198850 ){
198851 assert( nArg==0 );
198852 UNUSED_PARAM2(nArg, apUnused);
198853 sqlite3_result_text(pCtx, "fts5: 2017-05-02 18:00:31 430f539cbb3f806fb89191e0b759a5f8b49d9e5b6c95fe9a4b55a1aa0875762a", -1, SQLITE_TRANSIENT);
198854 }
198855
198856 static int fts5Init(sqlite3 *db){
198857 static const sqlite3_module fts5Mod = {
198858 /* iVersion */ 2,
198859
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -398,11 +398,11 @@
398 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
399 ** [sqlite_version()] and [sqlite_source_id()].
400 */
401 #define SQLITE_VERSION "3.19.0"
402 #define SQLITE_VERSION_NUMBER 3019000
403 #define SQLITE_SOURCE_ID "2017-05-10 16:12:00 92ab1f7257d2866c69eaaf4cf85990677b911ef425e9c5a36a96978cccfb551c"
404
405 /*
406 ** CAPI3REF: Run-Time Library Version Numbers
407 ** KEYWORDS: sqlite3_version sqlite3_sourceid
408 **
@@ -17272,13 +17272,20 @@
17272 ** using the SQLITE_USE_URI=1 or SQLITE_USE_URI=0 compile-time options.
17273 **
17274 ** EVIDENCE-OF: R-43642-56306 By default, URI handling is globally
17275 ** disabled. The default value may be changed by compiling with the
17276 ** SQLITE_USE_URI symbol defined.
17277 **
17278 ** URI filenames are enabled by default if SQLITE_HAS_CODEC is
17279 ** enabled.
17280 */
17281 #ifndef SQLITE_USE_URI
17282 # ifdef SQLITE_HAS_CODEC
17283 # define SQLITE_USE_URI 1
17284 # else
17285 # define SQLITE_USE_URI 0
17286 # endif
17287 #endif
17288
17289 /* EVIDENCE-OF: R-38720-18127 The default setting is determined by the
17290 ** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if
17291 ** that compile-time option is omitted.
@@ -28348,10 +28355,11 @@
28355 }else{
28356 return 0;
28357 }
28358 }
28359 #endif
28360 if( !sqlite3Isdigit(zNum[0]) ) return 0;
28361 while( zNum[0]=='0' ) zNum++;
28362 for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
28363 v = v*10 + c;
28364 }
28365
@@ -49153,10 +49161,15 @@
49161 Pgno pgno; /* The page number of a page in journal */
49162 u32 cksum; /* Checksum used for sanity checking */
49163 char *aData; /* Temporary storage for the page */
49164 sqlite3_file *jfd; /* The file descriptor for the journal file */
49165 int isSynced; /* True if journal page is synced */
49166 #ifdef SQLITE_HAS_CODEC
49167 /* The jrnlEnc flag is true if Journal pages should be passed through
49168 ** the codec. It is false for pure in-memory journals. */
49169 const int jrnlEnc = (isMainJrnl || pPager->subjInMemory==0);
49170 #endif
49171
49172 assert( (isMainJrnl&~1)==0 ); /* isMainJrnl is 0 or 1 */
49173 assert( (isSavepnt&~1)==0 ); /* isSavepnt is 0 or 1 */
49174 assert( isMainJrnl || pDone ); /* pDone always used on sub-journals */
49175 assert( isSavepnt || pDone==0 ); /* pDone never used on non-savepoint */
@@ -49276,18 +49289,38 @@
49289 && isSynced
49290 ){
49291 i64 ofst = (pgno-1)*(i64)pPager->pageSize;
49292 testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 );
49293 assert( !pagerUseWal(pPager) );
49294
49295 /* Write the data read from the journal back into the database file.
49296 ** This is usually safe even for an encrypted database - as the data
49297 ** was encrypted before it was written to the journal file. The exception
49298 ** is if the data was just read from an in-memory sub-journal. In that
49299 ** case it must be encrypted here before it is copied into the database
49300 ** file. */
49301 #ifdef SQLITE_HAS_CODEC
49302 if( !jrnlEnc ){
49303 CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT, aData);
49304 rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst);
49305 CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
49306 }else
49307 #endif
49308 rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst);
49309
49310 if( pgno>pPager->dbFileSize ){
49311 pPager->dbFileSize = pgno;
49312 }
49313 if( pPager->pBackup ){
49314 #ifdef SQLITE_HAS_CODEC
49315 if( jrnlEnc ){
49316 CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM_BKPT);
49317 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
49318 CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM_BKPT,aData);
49319 }else
49320 #endif
49321 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData);
 
49322 }
49323 }else if( !isMainJrnl && pPg==0 ){
49324 /* If this is a rollback of a savepoint and data was not written to
49325 ** the database and the page is not in-memory, there is a potential
49326 ** problem. When the page is next fetched by the b-tree layer, it
@@ -49335,11 +49368,13 @@
49368 if( pgno==1 ){
49369 memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers));
49370 }
49371
49372 /* Decode the page just read from disk */
49373 #if SQLITE_HAS_CODEC
49374 if( jrnlEnc ){ CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM_BKPT); }
49375 #endif
49376 sqlite3PcacheRelease(pPg);
49377 }
49378 return rc;
49379 }
49380
@@ -51347,12 +51382,17 @@
51382 ** write the journal record into the file. */
51383 if( rc==SQLITE_OK ){
51384 void *pData = pPg->pData;
51385 i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize);
51386 char *pData2;
51387
51388 #if SQLITE_HAS_CODEC
51389 if( !pPager->subjInMemory ){
51390 CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM_BKPT, pData2);
51391 }else
51392 #endif
51393 pData2 = pData;
51394 PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno));
51395 rc = write32bits(pPager->sjfd, offset, pPg->pgno);
51396 if( rc==SQLITE_OK ){
51397 rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);
51398 }
@@ -92369,11 +92409,11 @@
92409 pList->a[pList->nExpr-1].zName = pColumns->a[i].zName;
92410 pColumns->a[i].zName = 0;
92411 }
92412 }
92413
92414 if( !db->mallocFailed && pExpr->op==TK_SELECT && ALWAYS(pList!=0) ){
92415 Expr *pFirst = pList->a[iFirst].pExpr;
92416 assert( pFirst!=0 );
92417 assert( pFirst->op==TK_SELECT_COLUMN );
92418
92419 /* Store the SELECT statement in pRight so it will be deleted when
@@ -121536,17 +121576,34 @@
121576 #endif
121577 return rc;
121578 }
121579 #endif
121580
121581 /* For each term in the FROM clause, do two things:
121582 ** (1) Authorized unreferenced tables
121583 ** (2) Generate code for all sub-queries
121584 */
 
121585 for(i=0; i<pTabList->nSrc; i++){
121586 struct SrcList_item *pItem = &pTabList->a[i];
121587 SelectDest dest;
121588 Select *pSub;
121589
121590 /* Issue SQLITE_READ authorizations with a NULL column name for any tables that
121591 ** are referenced but from which no values are extracted. Examples of where these
121592 ** kinds of null SQLITE_READ authorizations would occur:
121593 **
121594 ** SELECT count(*) FROM t1; -- SQLITE_READ t1 null
121595 ** SELECT t1.* FROM t1, t2; -- SQLITE_READ t2 null
121596 */
121597 if( pItem->colUsed==0 ){
121598 sqlite3AuthCheck(pParse, SQLITE_READ, pItem->zName, pItem->zDatabase, 0);
121599 }
121600
121601 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
121602 /* Generate code for all sub-queries in the FROM clause
121603 */
121604 pSub = pItem->pSelect;
121605 if( pSub==0 ) continue;
121606
121607 /* Sometimes the code for a subquery will be generated more than
121608 ** once, if the subquery is part of the WHERE clause in a LEFT JOIN,
121609 ** for example. In that case, do not regenerate the code to manifest
@@ -121663,12 +121720,12 @@
121720 sqlite3VdbeChangeP1(v, topAddr, retAddr);
121721 sqlite3ClearTempRegCache(pParse);
121722 }
121723 if( db->mallocFailed ) goto select_end;
121724 pParse->nHeight -= sqlite3SelectExprHeight(p);
121725 #endif
121726 }
 
121727
121728 /* Various elements of the SELECT copied into local variables for
121729 ** convenience */
121730 pEList = p->pEList;
121731 pWhere = p->pWhere;
@@ -143421,20 +143478,22 @@
143478 sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);
143479 }
143480 #endif
143481 #if defined(SQLITE_HAS_CODEC)
143482 if( rc==SQLITE_OK ){
143483 const char *zKey;
143484 if( (zKey = sqlite3_uri_parameter(zOpen, "hexkey"))!=0 && zKey[0] ){;
143485 u8 iByte;
143486 int i;
143487 char zDecoded[40];
143488 for(i=0, iByte=0; i<sizeof(zDecoded)*2 && sqlite3Isxdigit(zKey[i]); i++){
143489 iByte = (iByte<<4) + sqlite3HexToInt(zKey[i]);
143490 if( (i&1)!=0 ) zDecoded[i/2] = iByte;
143491 }
143492 sqlite3_key_v2(db, 0, zDecoded, i/2);
143493 }else if( (zKey = sqlite3_uri_parameter(zOpen, "key"))!=0 ){
143494 sqlite3_key_v2(db, 0, zKey, sqlite3Strlen30(zKey));
143495 }
143496 }
143497 #endif
143498 sqlite3_free(zOpen);
143499 return rc & 0xff;
@@ -167122,10 +167181,11 @@
167181 ** COMMIT;
167182 */
167183 static int rtreeSavepoint(sqlite3_vtab *pVtab, int iSavepoint){
167184 Rtree *pRtree = (Rtree *)pVtab;
167185 int iwt = pRtree->inWrTrans;
167186 UNUSED_PARAMETER(iSavepoint);
167187 pRtree->inWrTrans = 0;
167188 nodeBlobReset(pRtree);
167189 pRtree->inWrTrans = iwt;
167190 return SQLITE_OK;
167191 }
@@ -198848,11 +198908,11 @@
198908 int nArg, /* Number of args */
198909 sqlite3_value **apUnused /* Function arguments */
198910 ){
198911 assert( nArg==0 );
198912 UNUSED_PARAM2(nArg, apUnused);
198913 sqlite3_result_text(pCtx, "fts5: 2017-05-10 16:12:00 92ab1f7257d2866c69eaaf4cf85990677b911ef425e9c5a36a96978cccfb551c", -1, SQLITE_TRANSIENT);
198914 }
198915
198916 static int fts5Init(sqlite3 *db){
198917 static const sqlite3_module fts5Mod = {
198918 /* iVersion */ 2,
198919
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122122
** [sqlite_version()] and [sqlite_source_id()].
123123
*/
124124
#define SQLITE_VERSION "3.19.0"
125125
#define SQLITE_VERSION_NUMBER 3019000
126
-#define SQLITE_SOURCE_ID "2017-05-02 18:00:31 430f539cbb3f806fb89191e0b759a5f8b49d9e5b6c95fe9a4b55a1aa0875762a"
126
+#define SQLITE_SOURCE_ID "2017-05-10 16:12:00 92ab1f7257d2866c69eaaf4cf85990677b911ef425e9c5a36a96978cccfb551c"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version sqlite3_sourceid
131131
**
132132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.19.0"
125 #define SQLITE_VERSION_NUMBER 3019000
126 #define SQLITE_SOURCE_ID "2017-05-02 18:00:31 430f539cbb3f806fb89191e0b759a5f8b49d9e5b6c95fe9a4b55a1aa0875762a"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
132
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.19.0"
125 #define SQLITE_VERSION_NUMBER 3019000
126 #define SQLITE_SOURCE_ID "2017-05-10 16:12:00 92ab1f7257d2866c69eaaf4cf85990677b911ef425e9c5a36a96978cccfb551c"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
132

Keyboard Shortcuts

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