Fossil SCM

Update the built-in SQLite to the 4th release candidate for 3.20.0.

drh 2017-07-31 17:42 trunk
Commit 2a615bed1184d6a1ce239e23d1c0e239f5d726a6464afb1e8ef0986fe8428f9e
2 files changed +33 -74 +2 -2
+33 -74
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
11501150
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11511151
** [sqlite_version()] and [sqlite_source_id()].
11521152
*/
11531153
#define SQLITE_VERSION "3.20.0"
11541154
#define SQLITE_VERSION_NUMBER 3020000
1155
-#define SQLITE_SOURCE_ID "2017-07-28 00:45:38 d891a2a00a34b6726624c66273f0f3388da9de6a771771c94b6e8a970dd9cdb9"
1155
+#define SQLITE_SOURCE_ID "2017-07-31 17:40:15 be0e24a0293f31b81fc5608a1d5aa1e57d3f5f7dddef6b368ae2e207bbdaf44c"
11561156
11571157
/*
11581158
** CAPI3REF: Run-Time Library Version Numbers
11591159
** KEYWORDS: sqlite3_version sqlite3_sourceid
11601160
**
@@ -5226,11 +5226,11 @@
52265226
** For all versions of SQLite up to and including 3.6.23.1, a call to
52275227
** [sqlite3_reset()] was required after sqlite3_step() returned anything
52285228
** other than [SQLITE_ROW] before any subsequent invocation of
52295229
** sqlite3_step(). Failure to reset the prepared statement using
52305230
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
5231
-** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
5231
+** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
52325232
** sqlite3_step() began
52335233
** calling [sqlite3_reset()] automatically in this circumstance rather
52345234
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
52355235
** break because any application that ever receives an SQLITE_MISUSE error
52365236
** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
@@ -102191,19 +102191,10 @@
102191102191
pPk = sqlite3PrimaryKeyIndex(pTab);
102192102192
pTab->iPKey = -1;
102193102193
}else{
102194102194
pPk = sqlite3PrimaryKeyIndex(pTab);
102195102195
102196
- /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
102197
- ** table entry. This is only required if currently generating VDBE
102198
- ** code for a CREATE TABLE (not when parsing one as part of reading
102199
- ** a database schema). */
102200
- if( v ){
102201
- assert( db->init.busy==0 );
102202
- sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
102203
- }
102204
-
102205102196
/*
102206102197
** Remove all redundant columns from the PRIMARY KEY. For example, change
102207102198
** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
102208102199
** code assumes the PRIMARY KEY contains no repeated columns.
102209102200
*/
@@ -102218,10 +102209,19 @@
102218102209
}
102219102210
assert( pPk!=0 );
102220102211
pPk->isCovering = 1;
102221102212
if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
102222102213
nPk = pPk->nKeyCol;
102214
+
102215
+ /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
102216
+ ** table entry. This is only required if currently generating VDBE
102217
+ ** code for a CREATE TABLE (not when parsing one as part of reading
102218
+ ** a database schema). */
102219
+ if( v && pPk->tnum>0 ){
102220
+ assert( db->init.busy==0 );
102221
+ sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
102222
+ }
102223102223
102224102224
/* The root page of the PRIMARY KEY is the table root page */
102225102225
pPk->tnum = pTab->tnum;
102226102226
102227102227
/* Update the in-memory representation of all UNIQUE indices by converting
@@ -118870,17 +118870,14 @@
118870118870
if( pS ){
118871118871
/* The "table" is actually a sub-select or a view in the FROM clause
118872118872
** of the SELECT statement. Return the declaration type and origin
118873118873
** data for the result-set column of the sub-select.
118874118874
*/
118875
- if( iCol>=0 && ALWAYS(iCol<pS->pEList->nExpr) ){
118875
+ if( iCol>=0 && iCol<pS->pEList->nExpr ){
118876118876
/* If iCol is less than zero, then the expression requests the
118877118877
** rowid of the sub-select or view. This expression is legal (see
118878118878
** test case misc2.2.2) - it always evaluates to NULL.
118879
- **
118880
- ** The ALWAYS() is because iCol>=pS->pEList->nExpr will have been
118881
- ** caught already by name resolution.
118882118879
*/
118883118880
NameContext sNC;
118884118881
Expr *p = pS->pEList->a[iCol].pExpr;
118885118882
sNC.pSrcList = pS->pSrc;
118886118883
sNC.pNext = pNC;
@@ -118986,22 +118983,10 @@
118986118983
sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT);
118987118984
}
118988118985
#endif /* !defined(SQLITE_OMIT_DECLTYPE) */
118989118986
}
118990118987
118991
-/*
118992
-** Return the Table objecct in the SrcList that has cursor iCursor.
118993
-** Or return NULL if no such Table object exists in the SrcList.
118994
-*/
118995
-static Table *tableWithCursor(SrcList *pList, int iCursor){
118996
- int j;
118997
- for(j=0; j<pList->nSrc; j++){
118998
- if( pList->a[j].iCursor==iCursor ) return pList->a[j].pTab;
118999
- }
119000
- return 0;
119001
-}
119002
-
119003118988
119004118989
/*
119005118990
** Compute the column names for a SELECT statement.
119006118991
**
119007118992
** The only guarantee that SQLite makes about column names is that if the
@@ -119031,28 +119016,33 @@
119031119016
** then the result column name with the table name
119032119017
** prefix, ex: TABLE.COLUMN. Otherwise use zSpan.
119033119018
*/
119034119019
static void generateColumnNames(
119035119020
Parse *pParse, /* Parser context */
119036
- SrcList *pTabList, /* The FROM clause of the SELECT */
119037
- ExprList *pEList /* Expressions defining the result set */
119021
+ Select *pSelect /* Generate column names for this SELECT statement */
119038119022
){
119039119023
Vdbe *v = pParse->pVdbe;
119040119024
int i;
119041119025
Table *pTab;
119026
+ SrcList *pTabList;
119027
+ ExprList *pEList;
119042119028
sqlite3 *db = pParse->db;
119043
- int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */
119044
- int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */
119029
+ int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */
119030
+ int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */
119045119031
119046119032
#ifndef SQLITE_OMIT_EXPLAIN
119047119033
/* If this is an EXPLAIN, skip this step */
119048119034
if( pParse->explain ){
119049119035
return;
119050119036
}
119051119037
#endif
119052119038
119053119039
if( pParse->colNamesSet || db->mallocFailed ) return;
119040
+ /* Column names are determined by the left-most term of a compound select */
119041
+ while( pSelect->pPrior ) pSelect = pSelect->pPrior;
119042
+ pTabList = pSelect->pSrc;
119043
+ pEList = pSelect->pEList;
119054119044
assert( v!=0 );
119055119045
assert( pTabList!=0 );
119056119046
pParse->colNamesSet = 1;
119057119047
fullName = (db->flags & SQLITE_FullColNames)!=0;
119058119048
srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
@@ -119063,16 +119053,15 @@
119063119053
assert( p!=0 );
119064119054
if( pEList->a[i].zName ){
119065119055
/* An AS clause always takes first priority */
119066119056
char *zName = pEList->a[i].zName;
119067119057
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
119068
- }else if( srcName
119069
- && (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN)
119070
- && (pTab = tableWithCursor(pTabList, p->iTable))!=0
119071
- ){
119058
+ }else if( srcName && p->op==TK_COLUMN ){
119072119059
char *zCol;
119073119060
int iCol = p->iColumn;
119061
+ pTab = p->pTab;
119062
+ assert( pTab!=0 );
119074119063
if( iCol<0 ) iCol = pTab->iPKey;
119075119064
assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
119076119065
if( iCol<0 ){
119077119066
zCol = "rowid";
119078119067
}else{
@@ -119900,15 +119889,10 @@
119900119889
*/
119901119890
assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );
119902119891
if( dest.eDest!=priorOp ){
119903119892
int iCont, iBreak, iStart;
119904119893
assert( p->pEList );
119905
- if( dest.eDest==SRT_Output ){
119906
- Select *pFirst = p;
119907
- while( pFirst->pPrior ) pFirst = pFirst->pPrior;
119908
- generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
119909
- }
119910119894
iBreak = sqlite3VdbeMakeLabel(v);
119911119895
iCont = sqlite3VdbeMakeLabel(v);
119912119896
computeLimitRegisters(pParse, p, iBreak);
119913119897
sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);
119914119898
iStart = sqlite3VdbeCurrentAddr(v);
@@ -119975,15 +119959,10 @@
119975119959
119976119960
/* Generate code to take the intersection of the two temporary
119977119961
** tables.
119978119962
*/
119979119963
assert( p->pEList );
119980
- if( dest.eDest==SRT_Output ){
119981
- Select *pFirst = p;
119982
- while( pFirst->pPrior ) pFirst = pFirst->pPrior;
119983
- generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
119984
- }
119985119964
iBreak = sqlite3VdbeMakeLabel(v);
119986119965
iCont = sqlite3VdbeMakeLabel(v);
119987119966
computeLimitRegisters(pParse, p, iBreak);
119988119967
sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);
119989119968
r1 = sqlite3GetTempReg(pParse);
@@ -120587,18 +120566,10 @@
120587120566
120588120567
/* Jump to the this point in order to terminate the query.
120589120568
*/
120590120569
sqlite3VdbeResolveLabel(v, labelEnd);
120591120570
120592
- /* Set the number of output columns
120593
- */
120594
- if( pDest->eDest==SRT_Output ){
120595
- Select *pFirst = pPrior;
120596
- while( pFirst->pPrior ) pFirst = pFirst->pPrior;
120597
- generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
120598
- }
120599
-
120600120571
/* Reassembly the compound query so that it will be freed correctly
120601120572
** by the calling function */
120602120573
if( p->pPrior ){
120603120574
sqlite3SelectDelete(db, p->pPrior);
120604120575
}
@@ -120889,11 +120860,10 @@
120889120860
Select *pParent; /* Current UNION ALL term of the other query */
120890120861
Select *pSub; /* The inner query or "subquery" */
120891120862
Select *pSub1; /* Pointer to the rightmost select in sub-query */
120892120863
SrcList *pSrc; /* The FROM clause of the outer query */
120893120864
SrcList *pSubSrc; /* The FROM clause of the subquery */
120894
- ExprList *pList; /* The result set of the outer query */
120895120865
int iParent; /* VDBE cursor number of the pSub result set temp table */
120896120866
int iNewParent = -1;/* Replacement table for iParent */
120897120867
int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
120898120868
int i; /* Loop counter */
120899120869
Expr *pWhere; /* The WHERE clause */
@@ -121214,18 +121184,10 @@
121214121184
** \_____________________ outer query ______________________________/
121215121185
**
121216121186
** We look at every expression in the outer query and every place we see
121217121187
** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
121218121188
*/
121219
- pList = pParent->pEList;
121220
- for(i=0; i<pList->nExpr; i++){
121221
- if( pList->a[i].zName==0 ){
121222
- char *zName = sqlite3DbStrDup(db, pList->a[i].zSpan);
121223
- sqlite3Dequote(zName);
121224
- pList->a[i].zName = zName;
121225
- }
121226
- }
121227121189
if( pSub->pOrderBy ){
121228121190
/* At this point, any non-zero iOrderByCol values indicate that the
121229121191
** ORDER BY column expression is identical to the iOrderByCol'th
121230121192
** expression returned by SELECT statement pSub. Since these values
121231121193
** do not necessarily correspond to columns in SELECT statement pParent,
@@ -122650,10 +122612,18 @@
122650122612
if( sqlite3SelectTrace & 0x100 ){
122651122613
SELECTTRACE(0x100,pParse,p, ("after name resolution:\n"));
122652122614
sqlite3TreeViewSelect(0, p, 0);
122653122615
}
122654122616
#endif
122617
+
122618
+ /* Get a pointer the VDBE under construction, allocating a new VDBE if one
122619
+ ** does not already exist */
122620
+ v = sqlite3GetVdbe(pParse);
122621
+ if( v==0 ) goto select_end;
122622
+ if( pDest->eDest==SRT_Output ){
122623
+ generateColumnNames(pParse, p);
122624
+ }
122655122625
122656122626
/* Try to flatten subqueries in the FROM clause up into the main query
122657122627
*/
122658122628
#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
122659122629
for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
@@ -122686,15 +122656,10 @@
122686122656
sSort.pOrderBy = p->pOrderBy;
122687122657
}
122688122658
}
122689122659
#endif
122690122660
122691
- /* Get a pointer the VDBE under construction, allocating a new VDBE if one
122692
- ** does not already exist */
122693
- v = sqlite3GetVdbe(pParse);
122694
- if( v==0 ) goto select_end;
122695
-
122696122661
#ifndef SQLITE_OMIT_COMPOUND_SELECT
122697122662
/* Handle compound SELECT statements using the separate multiSelect()
122698122663
** procedure.
122699122664
*/
122700122665
if( p->pPrior ){
@@ -123490,16 +123455,10 @@
123490123455
** successful coding of the SELECT.
123491123456
*/
123492123457
select_end:
123493123458
explainSetInteger(pParse->iSelectId, iRestoreSelectId);
123494123459
123495
- /* Identify column names if results of the SELECT are to be output.
123496
- */
123497
- if( rc==SQLITE_OK && pDest->eDest==SRT_Output ){
123498
- generateColumnNames(pParse, pTabList, pEList);
123499
- }
123500
-
123501123460
sqlite3DbFree(db, sAggInfo.aCol);
123502123461
sqlite3DbFree(db, sAggInfo.aFunc);
123503123462
#if SELECTTRACE_ENABLED
123504123463
SELECTTRACE(1,pParse,p,("end processing\n"));
123505123464
pParse->nSelectIndent--;
@@ -200314,11 +200273,11 @@
200314200273
int nArg, /* Number of args */
200315200274
sqlite3_value **apUnused /* Function arguments */
200316200275
){
200317200276
assert( nArg==0 );
200318200277
UNUSED_PARAM2(nArg, apUnused);
200319
- sqlite3_result_text(pCtx, "fts5: 2017-07-27 18:43:13 2dfcd9a8ecdf0ddd8e044d820639830c6171141c588cf0224255af85c64cf79c", -1, SQLITE_TRANSIENT);
200278
+ sqlite3_result_text(pCtx, "fts5: 2017-07-31 17:40:15 be0e24a0293f31b81fc5608a1d5aa1e57d3f5f7dddef6b368ae2e207bbdaf44c", -1, SQLITE_TRANSIENT);
200320200279
}
200321200280
200322200281
static int fts5Init(sqlite3 *db){
200323200282
static const sqlite3_module fts5Mod = {
200324200283
/* iVersion */ 2,
200325200284
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.20.0"
1154 #define SQLITE_VERSION_NUMBER 3020000
1155 #define SQLITE_SOURCE_ID "2017-07-28 00:45:38 d891a2a00a34b6726624c66273f0f3388da9de6a771771c94b6e8a970dd9cdb9"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -5226,11 +5226,11 @@
5226 ** For all versions of SQLite up to and including 3.6.23.1, a call to
5227 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
5228 ** other than [SQLITE_ROW] before any subsequent invocation of
5229 ** sqlite3_step(). Failure to reset the prepared statement using
5230 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
5231 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
5232 ** sqlite3_step() began
5233 ** calling [sqlite3_reset()] automatically in this circumstance rather
5234 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
5235 ** break because any application that ever receives an SQLITE_MISUSE error
5236 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
@@ -102191,19 +102191,10 @@
102191 pPk = sqlite3PrimaryKeyIndex(pTab);
102192 pTab->iPKey = -1;
102193 }else{
102194 pPk = sqlite3PrimaryKeyIndex(pTab);
102195
102196 /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
102197 ** table entry. This is only required if currently generating VDBE
102198 ** code for a CREATE TABLE (not when parsing one as part of reading
102199 ** a database schema). */
102200 if( v ){
102201 assert( db->init.busy==0 );
102202 sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
102203 }
102204
102205 /*
102206 ** Remove all redundant columns from the PRIMARY KEY. For example, change
102207 ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
102208 ** code assumes the PRIMARY KEY contains no repeated columns.
102209 */
@@ -102218,10 +102209,19 @@
102218 }
102219 assert( pPk!=0 );
102220 pPk->isCovering = 1;
102221 if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
102222 nPk = pPk->nKeyCol;
 
 
 
 
 
 
 
 
 
102223
102224 /* The root page of the PRIMARY KEY is the table root page */
102225 pPk->tnum = pTab->tnum;
102226
102227 /* Update the in-memory representation of all UNIQUE indices by converting
@@ -118870,17 +118870,14 @@
118870 if( pS ){
118871 /* The "table" is actually a sub-select or a view in the FROM clause
118872 ** of the SELECT statement. Return the declaration type and origin
118873 ** data for the result-set column of the sub-select.
118874 */
118875 if( iCol>=0 && ALWAYS(iCol<pS->pEList->nExpr) ){
118876 /* If iCol is less than zero, then the expression requests the
118877 ** rowid of the sub-select or view. This expression is legal (see
118878 ** test case misc2.2.2) - it always evaluates to NULL.
118879 **
118880 ** The ALWAYS() is because iCol>=pS->pEList->nExpr will have been
118881 ** caught already by name resolution.
118882 */
118883 NameContext sNC;
118884 Expr *p = pS->pEList->a[iCol].pExpr;
118885 sNC.pSrcList = pS->pSrc;
118886 sNC.pNext = pNC;
@@ -118986,22 +118983,10 @@
118986 sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT);
118987 }
118988 #endif /* !defined(SQLITE_OMIT_DECLTYPE) */
118989 }
118990
118991 /*
118992 ** Return the Table objecct in the SrcList that has cursor iCursor.
118993 ** Or return NULL if no such Table object exists in the SrcList.
118994 */
118995 static Table *tableWithCursor(SrcList *pList, int iCursor){
118996 int j;
118997 for(j=0; j<pList->nSrc; j++){
118998 if( pList->a[j].iCursor==iCursor ) return pList->a[j].pTab;
118999 }
119000 return 0;
119001 }
119002
119003
119004 /*
119005 ** Compute the column names for a SELECT statement.
119006 **
119007 ** The only guarantee that SQLite makes about column names is that if the
@@ -119031,28 +119016,33 @@
119031 ** then the result column name with the table name
119032 ** prefix, ex: TABLE.COLUMN. Otherwise use zSpan.
119033 */
119034 static void generateColumnNames(
119035 Parse *pParse, /* Parser context */
119036 SrcList *pTabList, /* The FROM clause of the SELECT */
119037 ExprList *pEList /* Expressions defining the result set */
119038 ){
119039 Vdbe *v = pParse->pVdbe;
119040 int i;
119041 Table *pTab;
 
 
119042 sqlite3 *db = pParse->db;
119043 int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */
119044 int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */
119045
119046 #ifndef SQLITE_OMIT_EXPLAIN
119047 /* If this is an EXPLAIN, skip this step */
119048 if( pParse->explain ){
119049 return;
119050 }
119051 #endif
119052
119053 if( pParse->colNamesSet || db->mallocFailed ) return;
 
 
 
 
119054 assert( v!=0 );
119055 assert( pTabList!=0 );
119056 pParse->colNamesSet = 1;
119057 fullName = (db->flags & SQLITE_FullColNames)!=0;
119058 srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
@@ -119063,16 +119053,15 @@
119063 assert( p!=0 );
119064 if( pEList->a[i].zName ){
119065 /* An AS clause always takes first priority */
119066 char *zName = pEList->a[i].zName;
119067 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
119068 }else if( srcName
119069 && (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN)
119070 && (pTab = tableWithCursor(pTabList, p->iTable))!=0
119071 ){
119072 char *zCol;
119073 int iCol = p->iColumn;
 
 
119074 if( iCol<0 ) iCol = pTab->iPKey;
119075 assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
119076 if( iCol<0 ){
119077 zCol = "rowid";
119078 }else{
@@ -119900,15 +119889,10 @@
119900 */
119901 assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );
119902 if( dest.eDest!=priorOp ){
119903 int iCont, iBreak, iStart;
119904 assert( p->pEList );
119905 if( dest.eDest==SRT_Output ){
119906 Select *pFirst = p;
119907 while( pFirst->pPrior ) pFirst = pFirst->pPrior;
119908 generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
119909 }
119910 iBreak = sqlite3VdbeMakeLabel(v);
119911 iCont = sqlite3VdbeMakeLabel(v);
119912 computeLimitRegisters(pParse, p, iBreak);
119913 sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);
119914 iStart = sqlite3VdbeCurrentAddr(v);
@@ -119975,15 +119959,10 @@
119975
119976 /* Generate code to take the intersection of the two temporary
119977 ** tables.
119978 */
119979 assert( p->pEList );
119980 if( dest.eDest==SRT_Output ){
119981 Select *pFirst = p;
119982 while( pFirst->pPrior ) pFirst = pFirst->pPrior;
119983 generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
119984 }
119985 iBreak = sqlite3VdbeMakeLabel(v);
119986 iCont = sqlite3VdbeMakeLabel(v);
119987 computeLimitRegisters(pParse, p, iBreak);
119988 sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);
119989 r1 = sqlite3GetTempReg(pParse);
@@ -120587,18 +120566,10 @@
120587
120588 /* Jump to the this point in order to terminate the query.
120589 */
120590 sqlite3VdbeResolveLabel(v, labelEnd);
120591
120592 /* Set the number of output columns
120593 */
120594 if( pDest->eDest==SRT_Output ){
120595 Select *pFirst = pPrior;
120596 while( pFirst->pPrior ) pFirst = pFirst->pPrior;
120597 generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
120598 }
120599
120600 /* Reassembly the compound query so that it will be freed correctly
120601 ** by the calling function */
120602 if( p->pPrior ){
120603 sqlite3SelectDelete(db, p->pPrior);
120604 }
@@ -120889,11 +120860,10 @@
120889 Select *pParent; /* Current UNION ALL term of the other query */
120890 Select *pSub; /* The inner query or "subquery" */
120891 Select *pSub1; /* Pointer to the rightmost select in sub-query */
120892 SrcList *pSrc; /* The FROM clause of the outer query */
120893 SrcList *pSubSrc; /* The FROM clause of the subquery */
120894 ExprList *pList; /* The result set of the outer query */
120895 int iParent; /* VDBE cursor number of the pSub result set temp table */
120896 int iNewParent = -1;/* Replacement table for iParent */
120897 int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
120898 int i; /* Loop counter */
120899 Expr *pWhere; /* The WHERE clause */
@@ -121214,18 +121184,10 @@
121214 ** \_____________________ outer query ______________________________/
121215 **
121216 ** We look at every expression in the outer query and every place we see
121217 ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
121218 */
121219 pList = pParent->pEList;
121220 for(i=0; i<pList->nExpr; i++){
121221 if( pList->a[i].zName==0 ){
121222 char *zName = sqlite3DbStrDup(db, pList->a[i].zSpan);
121223 sqlite3Dequote(zName);
121224 pList->a[i].zName = zName;
121225 }
121226 }
121227 if( pSub->pOrderBy ){
121228 /* At this point, any non-zero iOrderByCol values indicate that the
121229 ** ORDER BY column expression is identical to the iOrderByCol'th
121230 ** expression returned by SELECT statement pSub. Since these values
121231 ** do not necessarily correspond to columns in SELECT statement pParent,
@@ -122650,10 +122612,18 @@
122650 if( sqlite3SelectTrace & 0x100 ){
122651 SELECTTRACE(0x100,pParse,p, ("after name resolution:\n"));
122652 sqlite3TreeViewSelect(0, p, 0);
122653 }
122654 #endif
 
 
 
 
 
 
 
 
122655
122656 /* Try to flatten subqueries in the FROM clause up into the main query
122657 */
122658 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
122659 for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
@@ -122686,15 +122656,10 @@
122686 sSort.pOrderBy = p->pOrderBy;
122687 }
122688 }
122689 #endif
122690
122691 /* Get a pointer the VDBE under construction, allocating a new VDBE if one
122692 ** does not already exist */
122693 v = sqlite3GetVdbe(pParse);
122694 if( v==0 ) goto select_end;
122695
122696 #ifndef SQLITE_OMIT_COMPOUND_SELECT
122697 /* Handle compound SELECT statements using the separate multiSelect()
122698 ** procedure.
122699 */
122700 if( p->pPrior ){
@@ -123490,16 +123455,10 @@
123490 ** successful coding of the SELECT.
123491 */
123492 select_end:
123493 explainSetInteger(pParse->iSelectId, iRestoreSelectId);
123494
123495 /* Identify column names if results of the SELECT are to be output.
123496 */
123497 if( rc==SQLITE_OK && pDest->eDest==SRT_Output ){
123498 generateColumnNames(pParse, pTabList, pEList);
123499 }
123500
123501 sqlite3DbFree(db, sAggInfo.aCol);
123502 sqlite3DbFree(db, sAggInfo.aFunc);
123503 #if SELECTTRACE_ENABLED
123504 SELECTTRACE(1,pParse,p,("end processing\n"));
123505 pParse->nSelectIndent--;
@@ -200314,11 +200273,11 @@
200314 int nArg, /* Number of args */
200315 sqlite3_value **apUnused /* Function arguments */
200316 ){
200317 assert( nArg==0 );
200318 UNUSED_PARAM2(nArg, apUnused);
200319 sqlite3_result_text(pCtx, "fts5: 2017-07-27 18:43:13 2dfcd9a8ecdf0ddd8e044d820639830c6171141c588cf0224255af85c64cf79c", -1, SQLITE_TRANSIENT);
200320 }
200321
200322 static int fts5Init(sqlite3 *db){
200323 static const sqlite3_module fts5Mod = {
200324 /* iVersion */ 2,
200325
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.20.0"
1154 #define SQLITE_VERSION_NUMBER 3020000
1155 #define SQLITE_SOURCE_ID "2017-07-31 17:40:15 be0e24a0293f31b81fc5608a1d5aa1e57d3f5f7dddef6b368ae2e207bbdaf44c"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -5226,11 +5226,11 @@
5226 ** For all versions of SQLite up to and including 3.6.23.1, a call to
5227 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
5228 ** other than [SQLITE_ROW] before any subsequent invocation of
5229 ** sqlite3_step(). Failure to reset the prepared statement using
5230 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
5231 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
5232 ** sqlite3_step() began
5233 ** calling [sqlite3_reset()] automatically in this circumstance rather
5234 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
5235 ** break because any application that ever receives an SQLITE_MISUSE error
5236 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
@@ -102191,19 +102191,10 @@
102191 pPk = sqlite3PrimaryKeyIndex(pTab);
102192 pTab->iPKey = -1;
102193 }else{
102194 pPk = sqlite3PrimaryKeyIndex(pTab);
102195
 
 
 
 
 
 
 
 
 
102196 /*
102197 ** Remove all redundant columns from the PRIMARY KEY. For example, change
102198 ** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
102199 ** code assumes the PRIMARY KEY contains no repeated columns.
102200 */
@@ -102218,10 +102209,19 @@
102209 }
102210 assert( pPk!=0 );
102211 pPk->isCovering = 1;
102212 if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
102213 nPk = pPk->nKeyCol;
102214
102215 /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
102216 ** table entry. This is only required if currently generating VDBE
102217 ** code for a CREATE TABLE (not when parsing one as part of reading
102218 ** a database schema). */
102219 if( v && pPk->tnum>0 ){
102220 assert( db->init.busy==0 );
102221 sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
102222 }
102223
102224 /* The root page of the PRIMARY KEY is the table root page */
102225 pPk->tnum = pTab->tnum;
102226
102227 /* Update the in-memory representation of all UNIQUE indices by converting
@@ -118870,17 +118870,14 @@
118870 if( pS ){
118871 /* The "table" is actually a sub-select or a view in the FROM clause
118872 ** of the SELECT statement. Return the declaration type and origin
118873 ** data for the result-set column of the sub-select.
118874 */
118875 if( iCol>=0 && iCol<pS->pEList->nExpr ){
118876 /* If iCol is less than zero, then the expression requests the
118877 ** rowid of the sub-select or view. This expression is legal (see
118878 ** test case misc2.2.2) - it always evaluates to NULL.
 
 
 
118879 */
118880 NameContext sNC;
118881 Expr *p = pS->pEList->a[iCol].pExpr;
118882 sNC.pSrcList = pS->pSrc;
118883 sNC.pNext = pNC;
@@ -118986,22 +118983,10 @@
118983 sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT);
118984 }
118985 #endif /* !defined(SQLITE_OMIT_DECLTYPE) */
118986 }
118987
 
 
 
 
 
 
 
 
 
 
 
 
118988
118989 /*
118990 ** Compute the column names for a SELECT statement.
118991 **
118992 ** The only guarantee that SQLite makes about column names is that if the
@@ -119031,28 +119016,33 @@
119016 ** then the result column name with the table name
119017 ** prefix, ex: TABLE.COLUMN. Otherwise use zSpan.
119018 */
119019 static void generateColumnNames(
119020 Parse *pParse, /* Parser context */
119021 Select *pSelect /* Generate column names for this SELECT statement */
 
119022 ){
119023 Vdbe *v = pParse->pVdbe;
119024 int i;
119025 Table *pTab;
119026 SrcList *pTabList;
119027 ExprList *pEList;
119028 sqlite3 *db = pParse->db;
119029 int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */
119030 int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */
119031
119032 #ifndef SQLITE_OMIT_EXPLAIN
119033 /* If this is an EXPLAIN, skip this step */
119034 if( pParse->explain ){
119035 return;
119036 }
119037 #endif
119038
119039 if( pParse->colNamesSet || db->mallocFailed ) return;
119040 /* Column names are determined by the left-most term of a compound select */
119041 while( pSelect->pPrior ) pSelect = pSelect->pPrior;
119042 pTabList = pSelect->pSrc;
119043 pEList = pSelect->pEList;
119044 assert( v!=0 );
119045 assert( pTabList!=0 );
119046 pParse->colNamesSet = 1;
119047 fullName = (db->flags & SQLITE_FullColNames)!=0;
119048 srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
@@ -119063,16 +119053,15 @@
119053 assert( p!=0 );
119054 if( pEList->a[i].zName ){
119055 /* An AS clause always takes first priority */
119056 char *zName = pEList->a[i].zName;
119057 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
119058 }else if( srcName && p->op==TK_COLUMN ){
 
 
 
119059 char *zCol;
119060 int iCol = p->iColumn;
119061 pTab = p->pTab;
119062 assert( pTab!=0 );
119063 if( iCol<0 ) iCol = pTab->iPKey;
119064 assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
119065 if( iCol<0 ){
119066 zCol = "rowid";
119067 }else{
@@ -119900,15 +119889,10 @@
119889 */
119890 assert( unionTab==dest.iSDParm || dest.eDest!=priorOp );
119891 if( dest.eDest!=priorOp ){
119892 int iCont, iBreak, iStart;
119893 assert( p->pEList );
 
 
 
 
 
119894 iBreak = sqlite3VdbeMakeLabel(v);
119895 iCont = sqlite3VdbeMakeLabel(v);
119896 computeLimitRegisters(pParse, p, iBreak);
119897 sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);
119898 iStart = sqlite3VdbeCurrentAddr(v);
@@ -119975,15 +119959,10 @@
119959
119960 /* Generate code to take the intersection of the two temporary
119961 ** tables.
119962 */
119963 assert( p->pEList );
 
 
 
 
 
119964 iBreak = sqlite3VdbeMakeLabel(v);
119965 iCont = sqlite3VdbeMakeLabel(v);
119966 computeLimitRegisters(pParse, p, iBreak);
119967 sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); VdbeCoverage(v);
119968 r1 = sqlite3GetTempReg(pParse);
@@ -120587,18 +120566,10 @@
120566
120567 /* Jump to the this point in order to terminate the query.
120568 */
120569 sqlite3VdbeResolveLabel(v, labelEnd);
120570
 
 
 
 
 
 
 
 
120571 /* Reassembly the compound query so that it will be freed correctly
120572 ** by the calling function */
120573 if( p->pPrior ){
120574 sqlite3SelectDelete(db, p->pPrior);
120575 }
@@ -120889,11 +120860,10 @@
120860 Select *pParent; /* Current UNION ALL term of the other query */
120861 Select *pSub; /* The inner query or "subquery" */
120862 Select *pSub1; /* Pointer to the rightmost select in sub-query */
120863 SrcList *pSrc; /* The FROM clause of the outer query */
120864 SrcList *pSubSrc; /* The FROM clause of the subquery */
 
120865 int iParent; /* VDBE cursor number of the pSub result set temp table */
120866 int iNewParent = -1;/* Replacement table for iParent */
120867 int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
120868 int i; /* Loop counter */
120869 Expr *pWhere; /* The WHERE clause */
@@ -121214,18 +121184,10 @@
121184 ** \_____________________ outer query ______________________________/
121185 **
121186 ** We look at every expression in the outer query and every place we see
121187 ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
121188 */
 
 
 
 
 
 
 
 
121189 if( pSub->pOrderBy ){
121190 /* At this point, any non-zero iOrderByCol values indicate that the
121191 ** ORDER BY column expression is identical to the iOrderByCol'th
121192 ** expression returned by SELECT statement pSub. Since these values
121193 ** do not necessarily correspond to columns in SELECT statement pParent,
@@ -122650,10 +122612,18 @@
122612 if( sqlite3SelectTrace & 0x100 ){
122613 SELECTTRACE(0x100,pParse,p, ("after name resolution:\n"));
122614 sqlite3TreeViewSelect(0, p, 0);
122615 }
122616 #endif
122617
122618 /* Get a pointer the VDBE under construction, allocating a new VDBE if one
122619 ** does not already exist */
122620 v = sqlite3GetVdbe(pParse);
122621 if( v==0 ) goto select_end;
122622 if( pDest->eDest==SRT_Output ){
122623 generateColumnNames(pParse, p);
122624 }
122625
122626 /* Try to flatten subqueries in the FROM clause up into the main query
122627 */
122628 #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
122629 for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
@@ -122686,15 +122656,10 @@
122656 sSort.pOrderBy = p->pOrderBy;
122657 }
122658 }
122659 #endif
122660
 
 
 
 
 
122661 #ifndef SQLITE_OMIT_COMPOUND_SELECT
122662 /* Handle compound SELECT statements using the separate multiSelect()
122663 ** procedure.
122664 */
122665 if( p->pPrior ){
@@ -123490,16 +123455,10 @@
123455 ** successful coding of the SELECT.
123456 */
123457 select_end:
123458 explainSetInteger(pParse->iSelectId, iRestoreSelectId);
123459
 
 
 
 
 
 
123460 sqlite3DbFree(db, sAggInfo.aCol);
123461 sqlite3DbFree(db, sAggInfo.aFunc);
123462 #if SELECTTRACE_ENABLED
123463 SELECTTRACE(1,pParse,p,("end processing\n"));
123464 pParse->nSelectIndent--;
@@ -200314,11 +200273,11 @@
200273 int nArg, /* Number of args */
200274 sqlite3_value **apUnused /* Function arguments */
200275 ){
200276 assert( nArg==0 );
200277 UNUSED_PARAM2(nArg, apUnused);
200278 sqlite3_result_text(pCtx, "fts5: 2017-07-31 17:40:15 be0e24a0293f31b81fc5608a1d5aa1e57d3f5f7dddef6b368ae2e207bbdaf44c", -1, SQLITE_TRANSIENT);
200279 }
200280
200281 static int fts5Init(sqlite3 *db){
200282 static const sqlite3_module fts5Mod = {
200283 /* iVersion */ 2,
200284
+2 -2
--- 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.20.0"
125125
#define SQLITE_VERSION_NUMBER 3020000
126
-#define SQLITE_SOURCE_ID "2017-07-28 00:45:38 d891a2a00a34b6726624c66273f0f3388da9de6a771771c94b6e8a970dd9cdb9"
126
+#define SQLITE_SOURCE_ID "2017-07-31 17:40:15 be0e24a0293f31b81fc5608a1d5aa1e57d3f5f7dddef6b368ae2e207bbdaf44c"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version sqlite3_sourceid
131131
**
@@ -4197,11 +4197,11 @@
41974197
** For all versions of SQLite up to and including 3.6.23.1, a call to
41984198
** [sqlite3_reset()] was required after sqlite3_step() returned anything
41994199
** other than [SQLITE_ROW] before any subsequent invocation of
42004200
** sqlite3_step(). Failure to reset the prepared statement using
42014201
** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4202
-** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
4202
+** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
42034203
** sqlite3_step() began
42044204
** calling [sqlite3_reset()] automatically in this circumstance rather
42054205
** than returning [SQLITE_MISUSE]. This is not considered a compatibility
42064206
** break because any application that ever receives an SQLITE_MISUSE error
42074207
** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
42084208
--- 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.20.0"
125 #define SQLITE_VERSION_NUMBER 3020000
126 #define SQLITE_SOURCE_ID "2017-07-28 00:45:38 d891a2a00a34b6726624c66273f0f3388da9de6a771771c94b6e8a970dd9cdb9"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -4197,11 +4197,11 @@
4197 ** For all versions of SQLite up to and including 3.6.23.1, a call to
4198 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
4199 ** other than [SQLITE_ROW] before any subsequent invocation of
4200 ** sqlite3_step(). Failure to reset the prepared statement using
4201 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4202 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
4203 ** sqlite3_step() began
4204 ** calling [sqlite3_reset()] automatically in this circumstance rather
4205 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
4206 ** break because any application that ever receives an SQLITE_MISUSE error
4207 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
4208
--- 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.20.0"
125 #define SQLITE_VERSION_NUMBER 3020000
126 #define SQLITE_SOURCE_ID "2017-07-31 17:40:15 be0e24a0293f31b81fc5608a1d5aa1e57d3f5f7dddef6b368ae2e207bbdaf44c"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -4197,11 +4197,11 @@
4197 ** For all versions of SQLite up to and including 3.6.23.1, a call to
4198 ** [sqlite3_reset()] was required after sqlite3_step() returned anything
4199 ** other than [SQLITE_ROW] before any subsequent invocation of
4200 ** sqlite3_step(). Failure to reset the prepared statement using
4201 ** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
4202 ** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1]),
4203 ** sqlite3_step() began
4204 ** calling [sqlite3_reset()] automatically in this circumstance rather
4205 ** than returning [SQLITE_MISUSE]. This is not considered a compatibility
4206 ** break because any application that ever receives an SQLITE_MISUSE error
4207 ** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
4208

Keyboard Shortcuts

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