Skip to content

Commit c850687

Browse files
author
Paul Bergeron
committed
Update sqlite to 3.12.1
1 parent be91dec commit c850687

File tree

6 files changed

+2139
-2001
lines changed

6 files changed

+2139
-2001
lines changed

c/sqlite3.c

Lines changed: 78 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
@@ -336,9 +336,9 @@ extern "C" {
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
@@ -14393,6 +14393,7 @@ 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*);
@@ -84674,6 +84675,7 @@ static int memjrnlRead(
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;
@@ -84684,6 +84686,7 @@ static int memjrnlRead(
8468484686
}
8468584687
}else{
8468684688
pChunk = p->readpoint.pChunk;
84689+
assert( pChunk!=0 );
8468784690
}
8468884691

8468984692
iChunkOffset = (int)(iOfst%p->nChunkSize);
@@ -84695,7 +84698,7 @@ static int memjrnlRead(
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;
@@ -96650,44 +96653,55 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
9665096653
** statement that defines the view.
9665196654
*/
9665296655
assert( pTable->pSelect );
96653-
if( pTable->pCheck ){
96656+
pSel = sqlite3SelectDup(db, pTable->pSelect, 0);
96657+
if( pSel ){
96658+
n = pParse->nTab;
96659+
sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
96660+
pTable->nCol = -1;
9665496661
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++;
9666596662
#ifndef SQLITE_OMIT_AUTHORIZATION
96666-
xAuth = db->xAuth;
96667-
db->xAuth = 0;
96668-
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96669-
db->xAuth = xAuth;
96663+
xAuth = db->xAuth;
96664+
db->xAuth = 0;
96665+
pSelTab = sqlite3ResultSetOfSelect(pParse, pSel);
96666+
db->xAuth = xAuth;
9667096667
#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++;
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);
9668696685
}
96687-
sqlite3SelectDelete(db, pSel);
96688-
} else {
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;
9668996698
nErr++;
9669096699
}
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 */
@@ -112193,7 +112207,7 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
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 */
@@ -112215,10 +112229,20 @@ static void selectAddColumnTypeAndCollation(
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 ){
@@ -112255,7 +112279,7 @@ SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){
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);
@@ -115039,7 +115063,7 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
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
}
@@ -125728,8 +125752,6 @@ static int whereLoopAddBtreeIndex(
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
}
@@ -125767,6 +125789,18 @@ static int whereLoopAddBtreeIndex(
125767125789
** to mix with a lower range bound from some other source */
125768125790
if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue;
125769125791

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+
125770125804
pNew->wsFlags = saved_wsFlags;
125771125805
pNew->u.btree.nEq = saved_nEq;
125772125806
pNew->nLTerm = saved_nLTerm;
@@ -185424,7 +185458,7 @@ static void fts5SourceIdFunc(
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){

c/sqlite3.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ extern "C" {
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

js/sql-debug.js

Lines changed: 1755 additions & 1651 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)