Fossil SCM

Update SQLite to 3.12.1

jan.nijtmans 2016-04-08 19:09 UTC branch-1.34
Commit f676ace45cdf300b34054cc546957ef1352405ae
2 files changed +84 -50 +3 -3
+84 -50
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.12.0. By combining all the individual C code files into this
3
+** version 3.12.1. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -334,13 +334,13 @@
334334
**
335335
** See also: [sqlite3_libversion()],
336336
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
337337
** [sqlite_version()] and [sqlite_source_id()].
338338
*/
339
-#define SQLITE_VERSION "3.12.0"
340
-#define SQLITE_VERSION_NUMBER 3012000
341
-#define SQLITE_SOURCE_ID "2016-03-29 10:14:15 e9bb4cf40f4971974a74468ef922bdee481c988b"
339
+#define SQLITE_VERSION "3.12.1"
340
+#define SQLITE_VERSION_NUMBER 3012001
341
+#define SQLITE_SOURCE_ID "2016-04-08 15:09:49 fe7d3b75fe1bde41511b323925af8ae1b910bc4d"
342342
343343
/*
344344
** CAPI3REF: Run-Time Library Version Numbers
345345
** KEYWORDS: sqlite3_version, sqlite3_sourceid
346346
**
@@ -14391,10 +14391,11 @@
1439114391
SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int);
1439214392
SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*);
1439314393
SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*);
1439414394
SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3*,Table*);
1439514395
SQLITE_PRIVATE int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**);
14396
+SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*);
1439614397
SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*);
1439714398
SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int);
1439814399
SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*);
1439914400
SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index*, i16);
1440014401
SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
@@ -84672,10 +84673,11 @@
8467284673
return SQLITE_IOERR_SHORT_READ;
8467384674
}
8467484675
#endif
8467584676
8467684677
assert( (iAmt+iOfst)<=p->endpoint.iOffset );
84678
+ assert( p->readpoint.iOffset==0 || p->readpoint.pChunk!=0 );
8467784679
if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
8467884680
sqlite3_int64 iOff = 0;
8467984681
for(pChunk=p->pFirst;
8468084682
ALWAYS(pChunk) && (iOff+p->nChunkSize)<=iOfst;
8468184683
pChunk=pChunk->pNext
@@ -84682,10 +84684,11 @@
8468284684
){
8468384685
iOff += p->nChunkSize;
8468484686
}
8468584687
}else{
8468684688
pChunk = p->readpoint.pChunk;
84689
+ assert( pChunk!=0 );
8468784690
}
8468884691
8468984692
iChunkOffset = (int)(iOfst%p->nChunkSize);
8469084693
do {
8469184694
int iSpace = p->nChunkSize - iChunkOffset;
@@ -84693,11 +84696,11 @@
8469384696
memcpy(zOut, (u8*)pChunk->zChunk + iChunkOffset, nCopy);
8469484697
zOut += nCopy;
8469584698
nRead -= iSpace;
8469684699
iChunkOffset = 0;
8469784700
} while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
84698
- p->readpoint.iOffset = iOfst+iAmt;
84701
+ p->readpoint.iOffset = pChunk ? iOfst+iAmt : 0;
8469984702
p->readpoint.pChunk = pChunk;
8470084703
8470184704
return SQLITE_OK;
8470284705
}
8470384706
@@ -96648,48 +96651,59 @@
9664896651
** to the elements of the FROM clause. But we do not want these changes
9664996652
** to be permanent. So the computation is done on a copy of the SELECT
9665096653
** statement that defines the view.
9665196654
*/
9665296655
assert( pTable->pSelect );
96653
- if( pTable->pCheck ){
96654
- db->lookaside.bDisable++;
96655
- sqlite3ColumnsFromExprList(pParse, pTable->pCheck,
96656
- &pTable->nCol, &pTable->aCol);
96657
- db->lookaside.bDisable--;
96658
- }else{
96659
- pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
96660
- if( pSel ){
96661
- n = pParse->nTab;
96662
- sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
96663
- pTable->nCol = -1;
96664
- db->lookaside.bDisable++;
96665
-#ifndef SQLITE_OMIT_AUTHORIZATION
96666
- xAuth = db->xAuth;
96667
- db->xAuth = 0;
96668
- pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96669
- db->xAuth = xAuth;
96670
-#else
96671
- pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96672
-#endif
96673
- db->lookaside.bDisable--;
96674
- pParse->nTab = n;
96675
- if( pSelTab ){
96676
- assert( pTable->aCol==0 );
96677
- pTable->nCol = pSelTab->nCol;
96678
- pTable->aCol = pSelTab->aCol;
96679
- pSelTab->nCol = 0;
96680
- pSelTab->aCol = 0;
96681
- sqlite3DeleteTable(db, pSelTab);
96682
- assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
96683
- }else{
96684
- pTable->nCol = 0;
96685
- nErr++;
96686
- }
96687
- sqlite3SelectDelete(db, pSel);
96688
- } else {
96689
- nErr++;
96690
- }
96656
+ pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
96657
+ if( pSel ){
96658
+ n = pParse->nTab;
96659
+ sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
96660
+ pTable->nCol = -1;
96661
+ db->lookaside.bDisable++;
96662
+#ifndef SQLITE_OMIT_AUTHORIZATION
96663
+ xAuth = db->xAuth;
96664
+ db->xAuth = 0;
96665
+ pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96666
+ db->xAuth = xAuth;
96667
+#else
96668
+ pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96669
+#endif
96670
+ pParse->nTab = n;
96671
+ if( pTable->pCheck ){
96672
+ /* CREATE VIEW name(arglist) AS ...
96673
+ ** The names of the columns in the table are taken from
96674
+ ** arglist which is stored in pTable->pCheck. The pCheck field
96675
+ ** normally holds CHECK constraints on an ordinary table, but for
96676
+ ** a VIEW it holds the list of column names.
96677
+ */
96678
+ sqlite3ColumnsFromExprList(pParse, pTable->pCheck,
96679
+ &pTable->nCol, &pTable->aCol);
96680
+ if( db->mallocFailed==0
96681
+ && pParse->nErr==0
96682
+ && pTable->nCol==pSel->pEList->nExpr
96683
+ ){
96684
+ sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel);
96685
+ }
96686
+ }else if( pSelTab ){
96687
+ /* CREATE VIEW name AS... without an argument list. Construct
96688
+ ** the column names from the SELECT statement that defines the view.
96689
+ */
96690
+ assert( pTable->aCol==0 );
96691
+ pTable->nCol = pSelTab->nCol;
96692
+ pTable->aCol = pSelTab->aCol;
96693
+ pSelTab->nCol = 0;
96694
+ pSelTab->aCol = 0;
96695
+ assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
96696
+ }else{
96697
+ pTable->nCol = 0;
96698
+ nErr++;
96699
+ }
96700
+ if( pSelTab ) sqlite3DeleteTable(db, pSelTab);
96701
+ sqlite3SelectDelete(db, pSel);
96702
+ db->lookaside.bDisable--;
96703
+ } else {
96704
+ nErr++;
9669196705
}
9669296706
pTable->pSchema->schemaFlags |= DB_UnresetViews;
9669396707
#endif /* SQLITE_OMIT_VIEW */
9669496708
return nErr;
9669596709
}
@@ -112191,11 +112205,11 @@
112191112205
** routine goes through and adds the types and collations.
112192112206
**
112193112207
** This routine requires that all identifiers in the SELECT
112194112208
** statement be resolved.
112195112209
*/
112196
-static void selectAddColumnTypeAndCollation(
112210
+SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(
112197112211
Parse *pParse, /* Parsing contexts */
112198112212
Table *pTab, /* Add column type information to this table */
112199112213
Select *pSelect /* SELECT used to determine types and collations */
112200112214
){
112201112215
sqlite3 *db = pParse->db;
@@ -112213,14 +112227,24 @@
112213112227
if( db->mallocFailed ) return;
112214112228
memset(&sNC, 0, sizeof(sNC));
112215112229
sNC.pSrcList = pSelect->pSrc;
112216112230
a = pSelect->pEList->a;
112217112231
for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
112232
+ const char *zType;
112233
+ int n, m;
112218112234
p = a[i].pExpr;
112219
- columnType(&sNC, p, 0, 0, 0, &pCol->szEst);
112235
+ zType = columnType(&sNC, p, 0, 0, 0, &pCol->szEst);
112220112236
szAll += pCol->szEst;
112221112237
pCol->affinity = sqlite3ExprAffinity(p);
112238
+ if( zType && (m = sqlite3Strlen30(zType))>0 ){
112239
+ n = sqlite3Strlen30(pCol->zName);
112240
+ pCol->zName = sqlite3DbReallocOrFree(db, pCol->zName, n+m+2);
112241
+ if( pCol->zName ){
112242
+ memcpy(&pCol->zName[n+1], zType, m+1);
112243
+ pCol->colFlags |= COLFLAG_HASTYPE;
112244
+ }
112245
+ }
112222112246
if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB;
112223112247
pColl = sqlite3ExprCollSeq(pParse, p);
112224112248
if( pColl && pCol->zColl==0 ){
112225112249
pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
112226112250
}
@@ -112253,11 +112277,11 @@
112253112277
assert( db->lookaside.bDisable );
112254112278
pTab->nRef = 1;
112255112279
pTab->zName = 0;
112256112280
pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
112257112281
sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
112258
- selectAddColumnTypeAndCollation(pParse, pTab, pSelect);
112282
+ sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect);
112259112283
pTab->iPKey = -1;
112260112284
if( db->mallocFailed ){
112261112285
sqlite3DeleteTable(db, pTab);
112262112286
return 0;
112263112287
}
@@ -115037,11 +115061,11 @@
115037115061
if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
115038115062
/* A sub-query in the FROM clause of a SELECT */
115039115063
Select *pSel = pFrom->pSelect;
115040115064
if( pSel ){
115041115065
while( pSel->pPrior ) pSel = pSel->pPrior;
115042
- selectAddColumnTypeAndCollation(pParse, pTab, pSel);
115066
+ sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSel);
115043115067
}
115044115068
}
115045115069
}
115046115070
}
115047115071
#endif
@@ -125726,12 +125750,10 @@
125726125750
125727125751
assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
125728125752
assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
125729125753
if( pNew->wsFlags & WHERE_BTM_LIMIT ){
125730125754
opMask = WO_LT|WO_LE;
125731
- }else if( /*pProbe->tnum<=0 ||*/ (pSrc->fg.jointype & JT_LEFT)!=0 ){
125732
- opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE;
125733125755
}else{
125734125756
opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS;
125735125757
}
125736125758
if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);
125737125759
@@ -125764,10 +125786,22 @@
125764125786
if( pTerm->prereqRight & pNew->maskSelf ) continue;
125765125787
125766125788
/* Do not allow the upper bound of a LIKE optimization range constraint
125767125789
** to mix with a lower range bound from some other source */
125768125790
if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
125791
+
125792
+ /* Do not allow IS constraints from the WHERE clause to be used by the
125793
+ ** right table of a LEFT JOIN. Only constraints in the ON clause are
125794
+ ** allowed */
125795
+ if( (pSrc->fg.jointype & JT_LEFT)!=0
125796
+ && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
125797
+ && (eOp & (WO_IS|WO_ISNULL))!=0
125798
+ ){
125799
+ testcase( eOp & WO_IS );
125800
+ testcase( eOp & WO_ISNULL );
125801
+ continue;
125802
+ }
125769125803
125770125804
pNew->wsFlags = saved_wsFlags;
125771125805
pNew->u.btree.nEq = saved_nEq;
125772125806
pNew->nLTerm = saved_nLTerm;
125773125807
if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
@@ -185422,11 +185456,11 @@
185422185456
int nArg, /* Number of args */
185423185457
sqlite3_value **apUnused /* Function arguments */
185424185458
){
185425185459
assert( nArg==0 );
185426185460
UNUSED_PARAM2(nArg, apUnused);
185427
- sqlite3_result_text(pCtx, "fts5: 2016-03-29 10:14:15 e9bb4cf40f4971974a74468ef922bdee481c988b", -1, SQLITE_TRANSIENT);
185461
+ sqlite3_result_text(pCtx, "fts5: 2016-04-08 15:09:49 fe7d3b75fe1bde41511b323925af8ae1b910bc4d", -1, SQLITE_TRANSIENT);
185428185462
}
185429185463
185430185464
static int fts5Init(sqlite3 *db){
185431185465
static const sqlite3_module fts5Mod = {
185432185466
/* iVersion */ 2,
185433185467
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.12.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -334,13 +334,13 @@
334 **
335 ** See also: [sqlite3_libversion()],
336 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
337 ** [sqlite_version()] and [sqlite_source_id()].
338 */
339 #define SQLITE_VERSION "3.12.0"
340 #define SQLITE_VERSION_NUMBER 3012000
341 #define SQLITE_SOURCE_ID "2016-03-29 10:14:15 e9bb4cf40f4971974a74468ef922bdee481c988b"
342
343 /*
344 ** CAPI3REF: Run-Time Library Version Numbers
345 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
346 **
@@ -14391,10 +14391,11 @@
14391 SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int);
14392 SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*);
14393 SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*);
14394 SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3*,Table*);
14395 SQLITE_PRIVATE int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**);
 
14396 SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*);
14397 SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int);
14398 SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*);
14399 SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index*, i16);
14400 SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
@@ -84672,10 +84673,11 @@
84672 return SQLITE_IOERR_SHORT_READ;
84673 }
84674 #endif
84675
84676 assert( (iAmt+iOfst)<=p->endpoint.iOffset );
 
84677 if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
84678 sqlite3_int64 iOff = 0;
84679 for(pChunk=p->pFirst;
84680 ALWAYS(pChunk) && (iOff+p->nChunkSize)<=iOfst;
84681 pChunk=pChunk->pNext
@@ -84682,10 +84684,11 @@
84682 ){
84683 iOff += p->nChunkSize;
84684 }
84685 }else{
84686 pChunk = p->readpoint.pChunk;
 
84687 }
84688
84689 iChunkOffset = (int)(iOfst%p->nChunkSize);
84690 do {
84691 int iSpace = p->nChunkSize - iChunkOffset;
@@ -84693,11 +84696,11 @@
84693 memcpy(zOut, (u8*)pChunk->zChunk + iChunkOffset, nCopy);
84694 zOut += nCopy;
84695 nRead -= iSpace;
84696 iChunkOffset = 0;
84697 } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
84698 p->readpoint.iOffset = iOfst+iAmt;
84699 p->readpoint.pChunk = pChunk;
84700
84701 return SQLITE_OK;
84702 }
84703
@@ -96648,48 +96651,59 @@
96648 ** to the elements of the FROM clause. But we do not want these changes
96649 ** to be permanent. So the computation is done on a copy of the SELECT
96650 ** statement that defines the view.
96651 */
96652 assert( pTable->pSelect );
96653 if( pTable->pCheck ){
96654 db->lookaside.bDisable++;
96655 sqlite3ColumnsFromExprList(pParse, pTable->pCheck,
96656 &pTable->nCol, &pTable->aCol);
96657 db->lookaside.bDisable--;
96658 }else{
96659 pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
96660 if( pSel ){
96661 n = pParse->nTab;
96662 sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
96663 pTable->nCol = -1;
96664 db->lookaside.bDisable++;
96665 #ifndef SQLITE_OMIT_AUTHORIZATION
96666 xAuth = db->xAuth;
96667 db->xAuth = 0;
96668 pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96669 db->xAuth = xAuth;
96670 #else
96671 pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96672 #endif
96673 db->lookaside.bDisable--;
96674 pParse->nTab = n;
96675 if( pSelTab ){
96676 assert( pTable->aCol==0 );
96677 pTable->nCol = pSelTab->nCol;
96678 pTable->aCol = pSelTab->aCol;
96679 pSelTab->nCol = 0;
96680 pSelTab->aCol = 0;
96681 sqlite3DeleteTable(db, pSelTab);
96682 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
96683 }else{
96684 pTable->nCol = 0;
96685 nErr++;
96686 }
96687 sqlite3SelectDelete(db, pSel);
96688 } else {
96689 nErr++;
96690 }
 
 
 
 
 
 
 
 
 
 
 
96691 }
96692 pTable->pSchema->schemaFlags |= DB_UnresetViews;
96693 #endif /* SQLITE_OMIT_VIEW */
96694 return nErr;
96695 }
@@ -112191,11 +112205,11 @@
112191 ** routine goes through and adds the types and collations.
112192 **
112193 ** This routine requires that all identifiers in the SELECT
112194 ** statement be resolved.
112195 */
112196 static void selectAddColumnTypeAndCollation(
112197 Parse *pParse, /* Parsing contexts */
112198 Table *pTab, /* Add column type information to this table */
112199 Select *pSelect /* SELECT used to determine types and collations */
112200 ){
112201 sqlite3 *db = pParse->db;
@@ -112213,14 +112227,24 @@
112213 if( db->mallocFailed ) return;
112214 memset(&sNC, 0, sizeof(sNC));
112215 sNC.pSrcList = pSelect->pSrc;
112216 a = pSelect->pEList->a;
112217 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
 
 
112218 p = a[i].pExpr;
112219 columnType(&sNC, p, 0, 0, 0, &pCol->szEst);
112220 szAll += pCol->szEst;
112221 pCol->affinity = sqlite3ExprAffinity(p);
 
 
 
 
 
 
 
 
112222 if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB;
112223 pColl = sqlite3ExprCollSeq(pParse, p);
112224 if( pColl && pCol->zColl==0 ){
112225 pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
112226 }
@@ -112253,11 +112277,11 @@
112253 assert( db->lookaside.bDisable );
112254 pTab->nRef = 1;
112255 pTab->zName = 0;
112256 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
112257 sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
112258 selectAddColumnTypeAndCollation(pParse, pTab, pSelect);
112259 pTab->iPKey = -1;
112260 if( db->mallocFailed ){
112261 sqlite3DeleteTable(db, pTab);
112262 return 0;
112263 }
@@ -115037,11 +115061,11 @@
115037 if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
115038 /* A sub-query in the FROM clause of a SELECT */
115039 Select *pSel = pFrom->pSelect;
115040 if( pSel ){
115041 while( pSel->pPrior ) pSel = pSel->pPrior;
115042 selectAddColumnTypeAndCollation(pParse, pTab, pSel);
115043 }
115044 }
115045 }
115046 }
115047 #endif
@@ -125726,12 +125750,10 @@
125726
125727 assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
125728 assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
125729 if( pNew->wsFlags & WHERE_BTM_LIMIT ){
125730 opMask = WO_LT|WO_LE;
125731 }else if( /*pProbe->tnum<=0 ||*/ (pSrc->fg.jointype & JT_LEFT)!=0 ){
125732 opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE;
125733 }else{
125734 opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS;
125735 }
125736 if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);
125737
@@ -125764,10 +125786,22 @@
125764 if( pTerm->prereqRight & pNew->maskSelf ) continue;
125765
125766 /* Do not allow the upper bound of a LIKE optimization range constraint
125767 ** to mix with a lower range bound from some other source */
125768 if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
125769
125770 pNew->wsFlags = saved_wsFlags;
125771 pNew->u.btree.nEq = saved_nEq;
125772 pNew->nLTerm = saved_nLTerm;
125773 if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
@@ -185422,11 +185456,11 @@
185422 int nArg, /* Number of args */
185423 sqlite3_value **apUnused /* Function arguments */
185424 ){
185425 assert( nArg==0 );
185426 UNUSED_PARAM2(nArg, apUnused);
185427 sqlite3_result_text(pCtx, "fts5: 2016-03-29 10:14:15 e9bb4cf40f4971974a74468ef922bdee481c988b", -1, SQLITE_TRANSIENT);
185428 }
185429
185430 static int fts5Init(sqlite3 *db){
185431 static const sqlite3_module fts5Mod = {
185432 /* iVersion */ 2,
185433
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.12.1. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -334,13 +334,13 @@
334 **
335 ** See also: [sqlite3_libversion()],
336 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
337 ** [sqlite_version()] and [sqlite_source_id()].
338 */
339 #define SQLITE_VERSION "3.12.1"
340 #define SQLITE_VERSION_NUMBER 3012001
341 #define SQLITE_SOURCE_ID "2016-04-08 15:09:49 fe7d3b75fe1bde41511b323925af8ae1b910bc4d"
342
343 /*
344 ** CAPI3REF: Run-Time Library Version Numbers
345 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
346 **
@@ -14391,10 +14391,11 @@
14391 SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int);
14392 SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*);
14393 SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*);
14394 SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3*,Table*);
14395 SQLITE_PRIVATE int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**);
14396 SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*);
14397 SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*);
14398 SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int);
14399 SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*);
14400 SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index*, i16);
14401 SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
@@ -84672,10 +84673,11 @@
84673 return SQLITE_IOERR_SHORT_READ;
84674 }
84675 #endif
84676
84677 assert( (iAmt+iOfst)<=p->endpoint.iOffset );
84678 assert( p->readpoint.iOffset==0 || p->readpoint.pChunk!=0 );
84679 if( p->readpoint.iOffset!=iOfst || iOfst==0 ){
84680 sqlite3_int64 iOff = 0;
84681 for(pChunk=p->pFirst;
84682 ALWAYS(pChunk) && (iOff+p->nChunkSize)<=iOfst;
84683 pChunk=pChunk->pNext
@@ -84682,10 +84684,11 @@
84684 ){
84685 iOff += p->nChunkSize;
84686 }
84687 }else{
84688 pChunk = p->readpoint.pChunk;
84689 assert( pChunk!=0 );
84690 }
84691
84692 iChunkOffset = (int)(iOfst%p->nChunkSize);
84693 do {
84694 int iSpace = p->nChunkSize - iChunkOffset;
@@ -84693,11 +84696,11 @@
84696 memcpy(zOut, (u8*)pChunk->zChunk + iChunkOffset, nCopy);
84697 zOut += nCopy;
84698 nRead -= iSpace;
84699 iChunkOffset = 0;
84700 } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 );
84701 p->readpoint.iOffset = pChunk ? iOfst+iAmt : 0;
84702 p->readpoint.pChunk = pChunk;
84703
84704 return SQLITE_OK;
84705 }
84706
@@ -96648,48 +96651,59 @@
96651 ** to the elements of the FROM clause. But we do not want these changes
96652 ** to be permanent. So the computation is done on a copy of the SELECT
96653 ** statement that defines the view.
96654 */
96655 assert( pTable->pSelect );
96656 pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
96657 if( pSel ){
96658 n = pParse->nTab;
96659 sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
96660 pTable->nCol = -1;
96661 db->lookaside.bDisable++;
96662 #ifndef SQLITE_OMIT_AUTHORIZATION
96663 xAuth = db->xAuth;
96664 db->xAuth = 0;
96665 pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96666 db->xAuth = xAuth;
96667 #else
96668 pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96669 #endif
96670 pParse->nTab = n;
96671 if( pTable->pCheck ){
96672 /* CREATE VIEW name(arglist) AS ...
96673 ** The names of the columns in the table are taken from
96674 ** arglist which is stored in pTable->pCheck. The pCheck field
96675 ** normally holds CHECK constraints on an ordinary table, but for
96676 ** a VIEW it holds the list of column names.
96677 */
96678 sqlite3ColumnsFromExprList(pParse, pTable->pCheck,
96679 &pTable->nCol, &pTable->aCol);
96680 if( db->mallocFailed==0
96681 && pParse->nErr==0
96682 && pTable->nCol==pSel->pEList->nExpr
96683 ){
96684 sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel);
96685 }
96686 }else if( pSelTab ){
96687 /* CREATE VIEW name AS... without an argument list. Construct
96688 ** the column names from the SELECT statement that defines the view.
96689 */
96690 assert( pTable->aCol==0 );
96691 pTable->nCol = pSelTab->nCol;
96692 pTable->aCol = pSelTab->aCol;
96693 pSelTab->nCol = 0;
96694 pSelTab->aCol = 0;
96695 assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) );
96696 }else{
96697 pTable->nCol = 0;
96698 nErr++;
96699 }
96700 if( pSelTab ) sqlite3DeleteTable(db, pSelTab);
96701 sqlite3SelectDelete(db, pSel);
96702 db->lookaside.bDisable--;
96703 } else {
96704 nErr++;
96705 }
96706 pTable->pSchema->schemaFlags |= DB_UnresetViews;
96707 #endif /* SQLITE_OMIT_VIEW */
96708 return nErr;
96709 }
@@ -112191,11 +112205,11 @@
112205 ** routine goes through and adds the types and collations.
112206 **
112207 ** This routine requires that all identifiers in the SELECT
112208 ** statement be resolved.
112209 */
112210 SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(
112211 Parse *pParse, /* Parsing contexts */
112212 Table *pTab, /* Add column type information to this table */
112213 Select *pSelect /* SELECT used to determine types and collations */
112214 ){
112215 sqlite3 *db = pParse->db;
@@ -112213,14 +112227,24 @@
112227 if( db->mallocFailed ) return;
112228 memset(&sNC, 0, sizeof(sNC));
112229 sNC.pSrcList = pSelect->pSrc;
112230 a = pSelect->pEList->a;
112231 for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
112232 const char *zType;
112233 int n, m;
112234 p = a[i].pExpr;
112235 zType = columnType(&sNC, p, 0, 0, 0, &pCol->szEst);
112236 szAll += pCol->szEst;
112237 pCol->affinity = sqlite3ExprAffinity(p);
112238 if( zType && (m = sqlite3Strlen30(zType))>0 ){
112239 n = sqlite3Strlen30(pCol->zName);
112240 pCol->zName = sqlite3DbReallocOrFree(db, pCol->zName, n+m+2);
112241 if( pCol->zName ){
112242 memcpy(&pCol->zName[n+1], zType, m+1);
112243 pCol->colFlags |= COLFLAG_HASTYPE;
112244 }
112245 }
112246 if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_BLOB;
112247 pColl = sqlite3ExprCollSeq(pParse, p);
112248 if( pColl && pCol->zColl==0 ){
112249 pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
112250 }
@@ -112253,11 +112277,11 @@
112277 assert( db->lookaside.bDisable );
112278 pTab->nRef = 1;
112279 pTab->zName = 0;
112280 pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
112281 sqlite3ColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol);
112282 sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSelect);
112283 pTab->iPKey = -1;
112284 if( db->mallocFailed ){
112285 sqlite3DeleteTable(db, pTab);
112286 return 0;
112287 }
@@ -115037,11 +115061,11 @@
115061 if( (pTab->tabFlags & TF_Ephemeral)!=0 ){
115062 /* A sub-query in the FROM clause of a SELECT */
115063 Select *pSel = pFrom->pSelect;
115064 if( pSel ){
115065 while( pSel->pPrior ) pSel = pSel->pPrior;
115066 sqlite3SelectAddColumnTypeAndCollation(pParse, pTab, pSel);
115067 }
115068 }
115069 }
115070 }
115071 #endif
@@ -125726,12 +125750,10 @@
125750
125751 assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 );
125752 assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 );
125753 if( pNew->wsFlags & WHERE_BTM_LIMIT ){
125754 opMask = WO_LT|WO_LE;
 
 
125755 }else{
125756 opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS;
125757 }
125758 if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE);
125759
@@ -125764,10 +125786,22 @@
125786 if( pTerm->prereqRight & pNew->maskSelf ) continue;
125787
125788 /* Do not allow the upper bound of a LIKE optimization range constraint
125789 ** to mix with a lower range bound from some other source */
125790 if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
125791
125792 /* Do not allow IS constraints from the WHERE clause to be used by the
125793 ** right table of a LEFT JOIN. Only constraints in the ON clause are
125794 ** allowed */
125795 if( (pSrc->fg.jointype & JT_LEFT)!=0
125796 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
125797 && (eOp & (WO_IS|WO_ISNULL))!=0
125798 ){
125799 testcase( eOp & WO_IS );
125800 testcase( eOp & WO_ISNULL );
125801 continue;
125802 }
125803
125804 pNew->wsFlags = saved_wsFlags;
125805 pNew->u.btree.nEq = saved_nEq;
125806 pNew->nLTerm = saved_nLTerm;
125807 if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */
@@ -185422,11 +185456,11 @@
185456 int nArg, /* Number of args */
185457 sqlite3_value **apUnused /* Function arguments */
185458 ){
185459 assert( nArg==0 );
185460 UNUSED_PARAM2(nArg, apUnused);
185461 sqlite3_result_text(pCtx, "fts5: 2016-04-08 15:09:49 fe7d3b75fe1bde41511b323925af8ae1b910bc4d", -1, SQLITE_TRANSIENT);
185462 }
185463
185464 static int fts5Init(sqlite3 *db){
185465 static const sqlite3_module fts5Mod = {
185466 /* iVersion */ 2,
185467
+3 -3
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -109,13 +109,13 @@
109109
**
110110
** See also: [sqlite3_libversion()],
111111
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112112
** [sqlite_version()] and [sqlite_source_id()].
113113
*/
114
-#define SQLITE_VERSION "3.12.0"
115
-#define SQLITE_VERSION_NUMBER 3012000
116
-#define SQLITE_SOURCE_ID "2016-03-29 10:14:15 e9bb4cf40f4971974a74468ef922bdee481c988b"
114
+#define SQLITE_VERSION "3.12.1"
115
+#define SQLITE_VERSION_NUMBER 3012001
116
+#define SQLITE_SOURCE_ID "2016-04-08 15:09:49 fe7d3b75fe1bde41511b323925af8ae1b910bc4d"
117117
118118
/*
119119
** CAPI3REF: Run-Time Library Version Numbers
120120
** KEYWORDS: sqlite3_version, sqlite3_sourceid
121121
**
122122
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -109,13 +109,13 @@
109 **
110 ** See also: [sqlite3_libversion()],
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.12.0"
115 #define SQLITE_VERSION_NUMBER 3012000
116 #define SQLITE_SOURCE_ID "2016-03-29 10:14:15 e9bb4cf40f4971974a74468ef922bdee481c988b"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
122
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -109,13 +109,13 @@
109 **
110 ** See also: [sqlite3_libversion()],
111 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
112 ** [sqlite_version()] and [sqlite_source_id()].
113 */
114 #define SQLITE_VERSION "3.12.1"
115 #define SQLITE_VERSION_NUMBER 3012001
116 #define SQLITE_SOURCE_ID "2016-04-08 15:09:49 fe7d3b75fe1bde41511b323925af8ae1b910bc4d"
117
118 /*
119 ** CAPI3REF: Run-Time Library Version Numbers
120 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
121 **
122

Keyboard Shortcuts

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