Fossil SCM

Update the built-in SQLite to version 3.32.1.

drh 2020-05-25 17:28 trunk
Commit bb713f1337a3d82bdc51a7f881c54a9c292ce59ab4214bba19ffc0837e71f717
--- src/shell.c
+++ src/shell.c
@@ -6589,10 +6589,11 @@
65896589
** sqlar support.
65906590
*/
65916591
/* #include "sqlite3ext.h" */
65926592
SQLITE_EXTENSION_INIT1
65936593
#include <zlib.h>
6594
+#include <assert.h>
65946595
65956596
/*
65966597
** Implementation of the "sqlar_compress(X)" SQL function.
65976598
**
65986599
** If the type of X is SQLITE_BLOB, and compressing that blob using
65996600
--- src/shell.c
+++ src/shell.c
@@ -6589,10 +6589,11 @@
6589 ** sqlar support.
6590 */
6591 /* #include "sqlite3ext.h" */
6592 SQLITE_EXTENSION_INIT1
6593 #include <zlib.h>
 
6594
6595 /*
6596 ** Implementation of the "sqlar_compress(X)" SQL function.
6597 **
6598 ** If the type of X is SQLITE_BLOB, and compressing that blob using
6599
--- src/shell.c
+++ src/shell.c
@@ -6589,10 +6589,11 @@
6589 ** sqlar support.
6590 */
6591 /* #include "sqlite3ext.h" */
6592 SQLITE_EXTENSION_INIT1
6593 #include <zlib.h>
6594 #include <assert.h>
6595
6596 /*
6597 ** Implementation of the "sqlar_compress(X)" SQL function.
6598 **
6599 ** If the type of X is SQLITE_BLOB, and compressing that blob using
6600
+107 -51
--- 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.32.0. By combining all the individual C code files into this
3
+** version 3.32.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.
@@ -1160,13 +1160,13 @@
11601160
**
11611161
** See also: [sqlite3_libversion()],
11621162
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11631163
** [sqlite_version()] and [sqlite_source_id()].
11641164
*/
1165
-#define SQLITE_VERSION "3.32.0"
1166
-#define SQLITE_VERSION_NUMBER 3032000
1167
-#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a"
1165
+#define SQLITE_VERSION "3.32.1"
1166
+#define SQLITE_VERSION_NUMBER 3032001
1167
+#define SQLITE_SOURCE_ID "2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350"
11681168
11691169
/*
11701170
** CAPI3REF: Run-Time Library Version Numbers
11711171
** KEYWORDS: sqlite3_version sqlite3_sourceid
11721172
**
@@ -17841,11 +17841,11 @@
1784117841
/*
1784217842
** An instance of this structure contains information needed to generate
1784317843
** code for a SELECT that contains aggregate functions.
1784417844
**
1784517845
** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
17846
-** pointer to this structure. The Expr.iColumn field is the index in
17846
+** pointer to this structure. The Expr.iAgg field is the index in
1784717847
** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
1784817848
** code for that node.
1784917849
**
1785017850
** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
1785117851
** original Select structure that describes the SELECT statement. These
@@ -19080,10 +19080,13 @@
1908019080
SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*);
1908119081
SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*);
1908219082
SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*);
1908319083
SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*);
1908419084
SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*);
19085
+SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker*,Select*);
19086
+SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker*,Select*);
19087
+
1908519088
#ifdef SQLITE_DEBUG
1908619089
SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*);
1908719090
#endif
1908819091
1908919092
/*
@@ -28274,10 +28277,17 @@
2827428277
#ifndef SQLITE_PRINT_BUF_SIZE
2827528278
# define SQLITE_PRINT_BUF_SIZE 70
2827628279
#endif
2827728280
#define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */
2827828281
28282
+/*
28283
+** Hard limit on the precision of floating-point conversions.
28284
+*/
28285
+#ifndef SQLITE_PRINTF_PRECISION_LIMIT
28286
+# define SQLITE_FP_PRECISION_LIMIT 100000000
28287
+#endif
28288
+
2827928289
/*
2828028290
** Render a string given by "fmt" into the StrAccum object.
2828128291
*/
2828228292
SQLITE_API void sqlite3_str_vappendf(
2828328293
sqlite3_str *pAccum, /* Accumulate results here */
@@ -28474,10 +28484,12 @@
2847428484
** precision The specified precision. The default
2847528485
** is -1.
2847628486
** xtype The class of the conversion.
2847728487
** infop Pointer to the appropriate info struct.
2847828488
*/
28489
+ assert( width>=0 );
28490
+ assert( precision>=(-1) );
2847928491
switch( xtype ){
2848028492
case etPOINTER:
2848128493
flag_long = sizeof(char*)==sizeof(i64) ? 2 :
2848228494
sizeof(char*)==sizeof(long int) ? 1 : 0;
2848328495
/* Fall through into the next case */
@@ -28595,10 +28607,15 @@
2859528607
}
2859628608
#ifdef SQLITE_OMIT_FLOATING_POINT
2859728609
length = 0;
2859828610
#else
2859928611
if( precision<0 ) precision = 6; /* Set default precision */
28612
+#ifdef SQLITE_FP_PRECISION_LIMIT
28613
+ if( precision>SQLITE_FP_PRECISION_LIMIT ){
28614
+ precision = SQLITE_FP_PRECISION_LIMIT;
28615
+ }
28616
+#endif
2860028617
if( realvalue<0.0 ){
2860128618
realvalue = -realvalue;
2860228619
prefix = '-';
2860328620
}else{
2860428621
prefix = flag_prefix;
@@ -28877,11 +28894,11 @@
2887728894
}else{
2887828895
escarg = va_arg(ap,char*);
2887928896
}
2888028897
isnull = escarg==0;
2888128898
if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
28882
- /* For %q, %Q, and %w, the precision is the number of byte (or
28899
+ /* For %q, %Q, and %w, the precision is the number of bytes (or
2888328900
** characters if the ! flags is present) to use from the input.
2888428901
** Because of the extra quoting characters inserted, the number
2888528902
** of output characters may be larger than the precision.
2888628903
*/
2888728904
k = precision;
@@ -29962,12 +29979,13 @@
2996229979
#else
2996329980
pWin = 0;
2996429981
#endif
2996529982
}
2996629983
if( pExpr->op==TK_AGG_FUNCTION ){
29967
- sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s",
29968
- pExpr->op2, pExpr->u.zToken, zFlgs);
29984
+ sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s iAgg=%d agg=%p",
29985
+ pExpr->op2, pExpr->u.zToken, zFlgs,
29986
+ pExpr->iAgg, pExpr->pAggInfo);
2996929987
}else if( pExpr->op2!=0 ){
2997029988
const char *zOp2;
2997129989
char zBuf[8];
2997229990
sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2);
2997329991
zOp2 = zBuf;
@@ -62133,16 +62151,18 @@
6213362151
** needs to be flushed.
6213462152
*/
6213562153
SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
6213662154
int rc; /* Return code */
6213762155
int cnt = 0; /* Number of TryBeginRead attempts */
62156
+#ifdef SQLITE_ENABLE_SNAPSHOT
62157
+ int bChanged = 0;
62158
+ WalIndexHdr *pSnapshot = pWal->pSnapshot;
62159
+#endif
6213862160
6213962161
assert( pWal->ckptLock==0 );
6214062162
6214162163
#ifdef SQLITE_ENABLE_SNAPSHOT
62142
- int bChanged = 0;
62143
- WalIndexHdr *pSnapshot = pWal->pSnapshot;
6214462164
if( pSnapshot ){
6214562165
if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
6214662166
bChanged = 1;
6214762167
}
6214862168
@@ -97462,10 +97482,47 @@
9746297482
}
9746397483
p = p->pPrior;
9746497484
}while( p!=0 );
9746597485
return WRC_Continue;
9746697486
}
97487
+
97488
+/* Increase the walkerDepth when entering a subquery, and
97489
+** descrease when leaving the subquery.
97490
+*/
97491
+SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker *pWalker, Select *pSelect){
97492
+ UNUSED_PARAMETER(pSelect);
97493
+ pWalker->walkerDepth++;
97494
+ return WRC_Continue;
97495
+}
97496
+SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker *pWalker, Select *pSelect){
97497
+ UNUSED_PARAMETER(pSelect);
97498
+ pWalker->walkerDepth--;
97499
+}
97500
+
97501
+
97502
+/*
97503
+** No-op routine for the parse-tree walker.
97504
+**
97505
+** When this routine is the Walker.xExprCallback then expression trees
97506
+** are walked without any actions being taken at each node. Presumably,
97507
+** when this routine is used for Walker.xExprCallback then
97508
+** Walker.xSelectCallback is set to do something useful for every
97509
+** subquery in the parser tree.
97510
+*/
97511
+SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
97512
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
97513
+ return WRC_Continue;
97514
+}
97515
+
97516
+/*
97517
+** No-op routine for the parse-tree walker for SELECT statements.
97518
+** subquery in the parser tree.
97519
+*/
97520
+SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){
97521
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
97522
+ return WRC_Continue;
97523
+}
9746797524
9746897525
/************** End of walker.c **********************************************/
9746997526
/************** Begin file resolve.c *****************************************/
9747097527
/*
9747197528
** 2008 August 18
@@ -97491,10 +97548,12 @@
9749197548
** This needs to occur when copying a TK_AGG_FUNCTION node from an
9749297549
** outer query into an inner subquery.
9749397550
**
9749497551
** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
9749597552
** is a helper function - a callback for the tree walker.
97553
+**
97554
+** See also the sqlite3WindowExtraAggFuncDepth() routine in window.c
9749697555
*/
9749797556
static int incrAggDepth(Walker *pWalker, Expr *pExpr){
9749897557
if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
9749997558
return WRC_Continue;
9750097559
}
@@ -103232,11 +103291,14 @@
103232103291
op = pExpr->op;
103233103292
}
103234103293
switch( op ){
103235103294
case TK_AGG_COLUMN: {
103236103295
AggInfo *pAggInfo = pExpr->pAggInfo;
103237
- struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];
103296
+ struct AggInfo_col *pCol;
103297
+ assert( pAggInfo!=0 );
103298
+ assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
103299
+ pCol = &pAggInfo->aCol[pExpr->iAgg];
103238103300
if( !pAggInfo->directMode ){
103239103301
assert( pCol->iMem>0 );
103240103302
return pCol->iMem;
103241103303
}else if( pAggInfo->useSortingIdx ){
103242103304
Table *pTab = pCol->pTab;
@@ -103532,11 +103594,14 @@
103532103594
sqlite3VdbeJumpHere(v, addr);
103533103595
break;
103534103596
}
103535103597
case TK_AGG_FUNCTION: {
103536103598
AggInfo *pInfo = pExpr->pAggInfo;
103537
- if( pInfo==0 ){
103599
+ if( pInfo==0
103600
+ || NEVER(pExpr->iAgg<0)
103601
+ || NEVER(pExpr->iAgg>=pInfo->nFunc)
103602
+ ){
103538103603
assert( !ExprHasProperty(pExpr, EP_IntValue) );
103539103604
sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
103540103605
}else{
103541103606
return pInfo->aFunc[pExpr->iAgg].iMem;
103542103607
}
@@ -105288,19 +105353,10 @@
105288105353
}
105289105354
}
105290105355
}
105291105356
return WRC_Continue;
105292105357
}
105293
-static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
105294
- UNUSED_PARAMETER(pSelect);
105295
- pWalker->walkerDepth++;
105296
- return WRC_Continue;
105297
-}
105298
-static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){
105299
- UNUSED_PARAMETER(pSelect);
105300
- pWalker->walkerDepth--;
105301
-}
105302105358
105303105359
/*
105304105360
** Analyze the pExpr expression looking for aggregate functions and
105305105361
** for variables that need to be added to AggInfo object that pNC->pAggInfo
105306105362
** points to. Additional entries are made on the AggInfo object as
@@ -105310,12 +105366,12 @@
105310105366
** analyzed by sqlite3ResolveExprNames().
105311105367
*/
105312105368
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
105313105369
Walker w;
105314105370
w.xExprCallback = analyzeAggregate;
105315
- w.xSelectCallback = analyzeAggregatesInSelect;
105316
- w.xSelectCallback2 = analyzeAggregatesInSelectEnd;
105371
+ w.xSelectCallback = sqlite3WalkerDepthIncrease;
105372
+ w.xSelectCallback2 = sqlite3WalkerDepthDecrease;
105317105373
w.walkerDepth = 0;
105318105374
w.u.pNC = pNC;
105319105375
w.pParse = 0;
105320105376
assert( pNC->pSrcList!=0 );
105321105377
sqlite3WalkExpr(&w, pExpr);
@@ -122033,11 +122089,11 @@
122033122089
}
122034122090
if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
122035122091
sqlite3TableAffinity(v, pTab, regNewData+1);
122036122092
bAffinityDone = 1;
122037122093
}
122038
- VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName));
122094
+ VdbeNoopComment((v, "prep index %s", pIdx->zName));
122039122095
iThisCur = iIdxCur+ix;
122040122096
122041122097
122042122098
/* Skip partial indices for which the WHERE clause is not true */
122043122099
if( pIdx->pPartIdxWhere ){
@@ -134005,33 +134061,10 @@
134005134061
}
134006134062
}
134007134063
return WRC_Continue;
134008134064
}
134009134065
134010
-/*
134011
-** No-op routine for the parse-tree walker.
134012
-**
134013
-** When this routine is the Walker.xExprCallback then expression trees
134014
-** are walked without any actions being taken at each node. Presumably,
134015
-** when this routine is used for Walker.xExprCallback then
134016
-** Walker.xSelectCallback is set to do something useful for every
134017
-** subquery in the parser tree.
134018
-*/
134019
-SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
134020
- UNUSED_PARAMETER2(NotUsed, NotUsed2);
134021
- return WRC_Continue;
134022
-}
134023
-
134024
-/*
134025
-** No-op routine for the parse-tree walker for SELECT statements.
134026
-** subquery in the parser tree.
134027
-*/
134028
-SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){
134029
- UNUSED_PARAMETER2(NotUsed, NotUsed2);
134030
- return WRC_Continue;
134031
-}
134032
-
134033134066
#if SQLITE_DEBUG
134034134067
/*
134035134068
** Always assert. This xSelectCallback2 implementation proves that the
134036134069
** xSelectCallback2 is never invoked.
134037134070
*/
@@ -135198,11 +135231,11 @@
135198135231
sAggInfo.mxReg = pParse->nMem;
135199135232
if( db->mallocFailed ) goto select_end;
135200135233
#if SELECTTRACE_ENABLED
135201135234
if( sqlite3SelectTrace & 0x400 ){
135202135235
int ii;
135203
- SELECTTRACE(0x400,pParse,p,("After aggregate analysis:\n"));
135236
+ SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", &sAggInfo));
135204135237
sqlite3TreeViewSelect(0, p, 0);
135205135238
for(ii=0; ii<sAggInfo.nColumn; ii++){
135206135239
sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
135207135240
ii, sAggInfo.aCol[ii].iMem);
135208135241
sqlite3TreeViewExpr(0, sAggInfo.aCol[ii].pExpr, 0);
@@ -151241,10 +151274,27 @@
151241151274
if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;
151242151275
}
151243151276
}
151244151277
return pList;
151245151278
}
151279
+
151280
+/*
151281
+** When rewriting a query, if the new subquery in the FROM clause
151282
+** contains TK_AGG_FUNCTION nodes that refer to an outer query,
151283
+** then we have to increase the Expr->op2 values of those nodes
151284
+** due to the extra subquery layer that was added.
151285
+**
151286
+** See also the incrAggDepth() routine in resolve.c
151287
+*/
151288
+static int sqlite3WindowExtraAggFuncDepth(Walker *pWalker, Expr *pExpr){
151289
+ if( pExpr->op==TK_AGG_FUNCTION
151290
+ && pExpr->op2>=pWalker->walkerDepth
151291
+ ){
151292
+ pExpr->op2++;
151293
+ }
151294
+ return WRC_Continue;
151295
+}
151246151296
151247151297
/*
151248151298
** If the SELECT statement passed as the second argument does not invoke
151249151299
** any SQL window functions, this function is a no-op. Otherwise, it
151250151300
** rewrites the SELECT statement so that window function xStep functions
@@ -151351,10 +151401,11 @@
151351151401
pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
151352151402
);
151353151403
p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
151354151404
if( p->pSrc ){
151355151405
Table *pTab2;
151406
+ Walker w;
151356151407
p->pSrc->a[0].pSelect = pSub;
151357151408
sqlite3SrcListAssignCursors(pParse, p->pSrc);
151358151409
pSub->selFlags |= SF_Expanded;
151359151410
pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE);
151360151411
pSub->selFlags |= (selFlags & SF_Aggregate);
@@ -151366,10 +151417,15 @@
151366151417
}else{
151367151418
memcpy(pTab, pTab2, sizeof(Table));
151368151419
pTab->tabFlags |= TF_Ephemeral;
151369151420
p->pSrc->a[0].pTab = pTab;
151370151421
pTab = pTab2;
151422
+ memset(&w, 0, sizeof(w));
151423
+ w.xExprCallback = sqlite3WindowExtraAggFuncDepth;
151424
+ w.xSelectCallback = sqlite3WalkerDepthIncrease;
151425
+ w.xSelectCallback2 = sqlite3WalkerDepthDecrease;
151426
+ sqlite3WalkSelect(&w, pSub);
151371151427
}
151372151428
}else{
151373151429
sqlite3SelectDelete(db, pSub);
151374151430
}
151375151431
if( db->mallocFailed ) rc = SQLITE_NOMEM;
@@ -224764,11 +224820,11 @@
224764224820
int nArg, /* Number of args */
224765224821
sqlite3_value **apUnused /* Function arguments */
224766224822
){
224767224823
assert( nArg==0 );
224768224824
UNUSED_PARAM2(nArg, apUnused);
224769
- sqlite3_result_text(pCtx, "fts5: 2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a", -1, SQLITE_TRANSIENT);
224825
+ sqlite3_result_text(pCtx, "fts5: 2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350", -1, SQLITE_TRANSIENT);
224770224826
}
224771224827
224772224828
/*
224773224829
** Return true if zName is the extension on one of the shadow tables used
224774224830
** by this module.
@@ -229547,12 +229603,12 @@
229547229603
}
229548229604
#endif /* SQLITE_CORE */
229549229605
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
229550229606
229551229607
/************** End of stmt.c ************************************************/
229552
-#if __LINE__!=229552
229608
+#if __LINE__!=229608
229553229609
#undef SQLITE_SOURCE_ID
229554
-#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360falt2"
229610
+#define SQLITE_SOURCE_ID "2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba8alt2"
229555229611
#endif
229556229612
/* Return the source-id for this library */
229557229613
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
229558229614
/************************** End of sqlite3.c ******************************/
229559229615
--- 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.32.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.
@@ -1160,13 +1160,13 @@
1160 **
1161 ** See also: [sqlite3_libversion()],
1162 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1163 ** [sqlite_version()] and [sqlite_source_id()].
1164 */
1165 #define SQLITE_VERSION "3.32.0"
1166 #define SQLITE_VERSION_NUMBER 3032000
1167 #define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a"
1168
1169 /*
1170 ** CAPI3REF: Run-Time Library Version Numbers
1171 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1172 **
@@ -17841,11 +17841,11 @@
17841 /*
17842 ** An instance of this structure contains information needed to generate
17843 ** code for a SELECT that contains aggregate functions.
17844 **
17845 ** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
17846 ** pointer to this structure. The Expr.iColumn field is the index in
17847 ** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
17848 ** code for that node.
17849 **
17850 ** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
17851 ** original Select structure that describes the SELECT statement. These
@@ -19080,10 +19080,13 @@
19080 SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*);
19081 SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*);
19082 SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*);
19083 SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*);
19084 SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*);
 
 
 
19085 #ifdef SQLITE_DEBUG
19086 SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*);
19087 #endif
19088
19089 /*
@@ -28274,10 +28277,17 @@
28274 #ifndef SQLITE_PRINT_BUF_SIZE
28275 # define SQLITE_PRINT_BUF_SIZE 70
28276 #endif
28277 #define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */
28278
 
 
 
 
 
 
 
28279 /*
28280 ** Render a string given by "fmt" into the StrAccum object.
28281 */
28282 SQLITE_API void sqlite3_str_vappendf(
28283 sqlite3_str *pAccum, /* Accumulate results here */
@@ -28474,10 +28484,12 @@
28474 ** precision The specified precision. The default
28475 ** is -1.
28476 ** xtype The class of the conversion.
28477 ** infop Pointer to the appropriate info struct.
28478 */
 
 
28479 switch( xtype ){
28480 case etPOINTER:
28481 flag_long = sizeof(char*)==sizeof(i64) ? 2 :
28482 sizeof(char*)==sizeof(long int) ? 1 : 0;
28483 /* Fall through into the next case */
@@ -28595,10 +28607,15 @@
28595 }
28596 #ifdef SQLITE_OMIT_FLOATING_POINT
28597 length = 0;
28598 #else
28599 if( precision<0 ) precision = 6; /* Set default precision */
 
 
 
 
 
28600 if( realvalue<0.0 ){
28601 realvalue = -realvalue;
28602 prefix = '-';
28603 }else{
28604 prefix = flag_prefix;
@@ -28877,11 +28894,11 @@
28877 }else{
28878 escarg = va_arg(ap,char*);
28879 }
28880 isnull = escarg==0;
28881 if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
28882 /* For %q, %Q, and %w, the precision is the number of byte (or
28883 ** characters if the ! flags is present) to use from the input.
28884 ** Because of the extra quoting characters inserted, the number
28885 ** of output characters may be larger than the precision.
28886 */
28887 k = precision;
@@ -29962,12 +29979,13 @@
29962 #else
29963 pWin = 0;
29964 #endif
29965 }
29966 if( pExpr->op==TK_AGG_FUNCTION ){
29967 sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s",
29968 pExpr->op2, pExpr->u.zToken, zFlgs);
 
29969 }else if( pExpr->op2!=0 ){
29970 const char *zOp2;
29971 char zBuf[8];
29972 sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2);
29973 zOp2 = zBuf;
@@ -62133,16 +62151,18 @@
62133 ** needs to be flushed.
62134 */
62135 SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
62136 int rc; /* Return code */
62137 int cnt = 0; /* Number of TryBeginRead attempts */
 
 
 
 
62138
62139 assert( pWal->ckptLock==0 );
62140
62141 #ifdef SQLITE_ENABLE_SNAPSHOT
62142 int bChanged = 0;
62143 WalIndexHdr *pSnapshot = pWal->pSnapshot;
62144 if( pSnapshot ){
62145 if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
62146 bChanged = 1;
62147 }
62148
@@ -97462,10 +97482,47 @@
97462 }
97463 p = p->pPrior;
97464 }while( p!=0 );
97465 return WRC_Continue;
97466 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97467
97468 /************** End of walker.c **********************************************/
97469 /************** Begin file resolve.c *****************************************/
97470 /*
97471 ** 2008 August 18
@@ -97491,10 +97548,12 @@
97491 ** This needs to occur when copying a TK_AGG_FUNCTION node from an
97492 ** outer query into an inner subquery.
97493 **
97494 ** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
97495 ** is a helper function - a callback for the tree walker.
 
 
97496 */
97497 static int incrAggDepth(Walker *pWalker, Expr *pExpr){
97498 if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
97499 return WRC_Continue;
97500 }
@@ -103232,11 +103291,14 @@
103232 op = pExpr->op;
103233 }
103234 switch( op ){
103235 case TK_AGG_COLUMN: {
103236 AggInfo *pAggInfo = pExpr->pAggInfo;
103237 struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];
 
 
 
103238 if( !pAggInfo->directMode ){
103239 assert( pCol->iMem>0 );
103240 return pCol->iMem;
103241 }else if( pAggInfo->useSortingIdx ){
103242 Table *pTab = pCol->pTab;
@@ -103532,11 +103594,14 @@
103532 sqlite3VdbeJumpHere(v, addr);
103533 break;
103534 }
103535 case TK_AGG_FUNCTION: {
103536 AggInfo *pInfo = pExpr->pAggInfo;
103537 if( pInfo==0 ){
 
 
 
103538 assert( !ExprHasProperty(pExpr, EP_IntValue) );
103539 sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
103540 }else{
103541 return pInfo->aFunc[pExpr->iAgg].iMem;
103542 }
@@ -105288,19 +105353,10 @@
105288 }
105289 }
105290 }
105291 return WRC_Continue;
105292 }
105293 static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
105294 UNUSED_PARAMETER(pSelect);
105295 pWalker->walkerDepth++;
105296 return WRC_Continue;
105297 }
105298 static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){
105299 UNUSED_PARAMETER(pSelect);
105300 pWalker->walkerDepth--;
105301 }
105302
105303 /*
105304 ** Analyze the pExpr expression looking for aggregate functions and
105305 ** for variables that need to be added to AggInfo object that pNC->pAggInfo
105306 ** points to. Additional entries are made on the AggInfo object as
@@ -105310,12 +105366,12 @@
105310 ** analyzed by sqlite3ResolveExprNames().
105311 */
105312 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
105313 Walker w;
105314 w.xExprCallback = analyzeAggregate;
105315 w.xSelectCallback = analyzeAggregatesInSelect;
105316 w.xSelectCallback2 = analyzeAggregatesInSelectEnd;
105317 w.walkerDepth = 0;
105318 w.u.pNC = pNC;
105319 w.pParse = 0;
105320 assert( pNC->pSrcList!=0 );
105321 sqlite3WalkExpr(&w, pExpr);
@@ -122033,11 +122089,11 @@
122033 }
122034 if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
122035 sqlite3TableAffinity(v, pTab, regNewData+1);
122036 bAffinityDone = 1;
122037 }
122038 VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName));
122039 iThisCur = iIdxCur+ix;
122040
122041
122042 /* Skip partial indices for which the WHERE clause is not true */
122043 if( pIdx->pPartIdxWhere ){
@@ -134005,33 +134061,10 @@
134005 }
134006 }
134007 return WRC_Continue;
134008 }
134009
134010 /*
134011 ** No-op routine for the parse-tree walker.
134012 **
134013 ** When this routine is the Walker.xExprCallback then expression trees
134014 ** are walked without any actions being taken at each node. Presumably,
134015 ** when this routine is used for Walker.xExprCallback then
134016 ** Walker.xSelectCallback is set to do something useful for every
134017 ** subquery in the parser tree.
134018 */
134019 SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
134020 UNUSED_PARAMETER2(NotUsed, NotUsed2);
134021 return WRC_Continue;
134022 }
134023
134024 /*
134025 ** No-op routine for the parse-tree walker for SELECT statements.
134026 ** subquery in the parser tree.
134027 */
134028 SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){
134029 UNUSED_PARAMETER2(NotUsed, NotUsed2);
134030 return WRC_Continue;
134031 }
134032
134033 #if SQLITE_DEBUG
134034 /*
134035 ** Always assert. This xSelectCallback2 implementation proves that the
134036 ** xSelectCallback2 is never invoked.
134037 */
@@ -135198,11 +135231,11 @@
135198 sAggInfo.mxReg = pParse->nMem;
135199 if( db->mallocFailed ) goto select_end;
135200 #if SELECTTRACE_ENABLED
135201 if( sqlite3SelectTrace & 0x400 ){
135202 int ii;
135203 SELECTTRACE(0x400,pParse,p,("After aggregate analysis:\n"));
135204 sqlite3TreeViewSelect(0, p, 0);
135205 for(ii=0; ii<sAggInfo.nColumn; ii++){
135206 sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
135207 ii, sAggInfo.aCol[ii].iMem);
135208 sqlite3TreeViewExpr(0, sAggInfo.aCol[ii].pExpr, 0);
@@ -151241,10 +151274,27 @@
151241 if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;
151242 }
151243 }
151244 return pList;
151245 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151246
151247 /*
151248 ** If the SELECT statement passed as the second argument does not invoke
151249 ** any SQL window functions, this function is a no-op. Otherwise, it
151250 ** rewrites the SELECT statement so that window function xStep functions
@@ -151351,10 +151401,11 @@
151351 pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
151352 );
151353 p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
151354 if( p->pSrc ){
151355 Table *pTab2;
 
151356 p->pSrc->a[0].pSelect = pSub;
151357 sqlite3SrcListAssignCursors(pParse, p->pSrc);
151358 pSub->selFlags |= SF_Expanded;
151359 pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE);
151360 pSub->selFlags |= (selFlags & SF_Aggregate);
@@ -151366,10 +151417,15 @@
151366 }else{
151367 memcpy(pTab, pTab2, sizeof(Table));
151368 pTab->tabFlags |= TF_Ephemeral;
151369 p->pSrc->a[0].pTab = pTab;
151370 pTab = pTab2;
 
 
 
 
 
151371 }
151372 }else{
151373 sqlite3SelectDelete(db, pSub);
151374 }
151375 if( db->mallocFailed ) rc = SQLITE_NOMEM;
@@ -224764,11 +224820,11 @@
224764 int nArg, /* Number of args */
224765 sqlite3_value **apUnused /* Function arguments */
224766 ){
224767 assert( nArg==0 );
224768 UNUSED_PARAM2(nArg, apUnused);
224769 sqlite3_result_text(pCtx, "fts5: 2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a", -1, SQLITE_TRANSIENT);
224770 }
224771
224772 /*
224773 ** Return true if zName is the extension on one of the shadow tables used
224774 ** by this module.
@@ -229547,12 +229603,12 @@
229547 }
229548 #endif /* SQLITE_CORE */
229549 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
229550
229551 /************** End of stmt.c ************************************************/
229552 #if __LINE__!=229552
229553 #undef SQLITE_SOURCE_ID
229554 #define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360falt2"
229555 #endif
229556 /* Return the source-id for this library */
229557 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
229558 /************************** End of sqlite3.c ******************************/
229559
--- 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.32.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.
@@ -1160,13 +1160,13 @@
1160 **
1161 ** See also: [sqlite3_libversion()],
1162 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1163 ** [sqlite_version()] and [sqlite_source_id()].
1164 */
1165 #define SQLITE_VERSION "3.32.1"
1166 #define SQLITE_VERSION_NUMBER 3032001
1167 #define SQLITE_SOURCE_ID "2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350"
1168
1169 /*
1170 ** CAPI3REF: Run-Time Library Version Numbers
1171 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1172 **
@@ -17841,11 +17841,11 @@
17841 /*
17842 ** An instance of this structure contains information needed to generate
17843 ** code for a SELECT that contains aggregate functions.
17844 **
17845 ** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
17846 ** pointer to this structure. The Expr.iAgg field is the index in
17847 ** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
17848 ** code for that node.
17849 **
17850 ** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
17851 ** original Select structure that describes the SELECT statement. These
@@ -19080,10 +19080,13 @@
19080 SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*);
19081 SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*);
19082 SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*);
19083 SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*);
19084 SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*);
19085 SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker*,Select*);
19086 SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker*,Select*);
19087
19088 #ifdef SQLITE_DEBUG
19089 SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*);
19090 #endif
19091
19092 /*
@@ -28274,10 +28277,17 @@
28277 #ifndef SQLITE_PRINT_BUF_SIZE
28278 # define SQLITE_PRINT_BUF_SIZE 70
28279 #endif
28280 #define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */
28281
28282 /*
28283 ** Hard limit on the precision of floating-point conversions.
28284 */
28285 #ifndef SQLITE_PRINTF_PRECISION_LIMIT
28286 # define SQLITE_FP_PRECISION_LIMIT 100000000
28287 #endif
28288
28289 /*
28290 ** Render a string given by "fmt" into the StrAccum object.
28291 */
28292 SQLITE_API void sqlite3_str_vappendf(
28293 sqlite3_str *pAccum, /* Accumulate results here */
@@ -28474,10 +28484,12 @@
28484 ** precision The specified precision. The default
28485 ** is -1.
28486 ** xtype The class of the conversion.
28487 ** infop Pointer to the appropriate info struct.
28488 */
28489 assert( width>=0 );
28490 assert( precision>=(-1) );
28491 switch( xtype ){
28492 case etPOINTER:
28493 flag_long = sizeof(char*)==sizeof(i64) ? 2 :
28494 sizeof(char*)==sizeof(long int) ? 1 : 0;
28495 /* Fall through into the next case */
@@ -28595,10 +28607,15 @@
28607 }
28608 #ifdef SQLITE_OMIT_FLOATING_POINT
28609 length = 0;
28610 #else
28611 if( precision<0 ) precision = 6; /* Set default precision */
28612 #ifdef SQLITE_FP_PRECISION_LIMIT
28613 if( precision>SQLITE_FP_PRECISION_LIMIT ){
28614 precision = SQLITE_FP_PRECISION_LIMIT;
28615 }
28616 #endif
28617 if( realvalue<0.0 ){
28618 realvalue = -realvalue;
28619 prefix = '-';
28620 }else{
28621 prefix = flag_prefix;
@@ -28877,11 +28894,11 @@
28894 }else{
28895 escarg = va_arg(ap,char*);
28896 }
28897 isnull = escarg==0;
28898 if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
28899 /* For %q, %Q, and %w, the precision is the number of bytes (or
28900 ** characters if the ! flags is present) to use from the input.
28901 ** Because of the extra quoting characters inserted, the number
28902 ** of output characters may be larger than the precision.
28903 */
28904 k = precision;
@@ -29962,12 +29979,13 @@
29979 #else
29980 pWin = 0;
29981 #endif
29982 }
29983 if( pExpr->op==TK_AGG_FUNCTION ){
29984 sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s iAgg=%d agg=%p",
29985 pExpr->op2, pExpr->u.zToken, zFlgs,
29986 pExpr->iAgg, pExpr->pAggInfo);
29987 }else if( pExpr->op2!=0 ){
29988 const char *zOp2;
29989 char zBuf[8];
29990 sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2);
29991 zOp2 = zBuf;
@@ -62133,16 +62151,18 @@
62151 ** needs to be flushed.
62152 */
62153 SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){
62154 int rc; /* Return code */
62155 int cnt = 0; /* Number of TryBeginRead attempts */
62156 #ifdef SQLITE_ENABLE_SNAPSHOT
62157 int bChanged = 0;
62158 WalIndexHdr *pSnapshot = pWal->pSnapshot;
62159 #endif
62160
62161 assert( pWal->ckptLock==0 );
62162
62163 #ifdef SQLITE_ENABLE_SNAPSHOT
 
 
62164 if( pSnapshot ){
62165 if( memcmp(pSnapshot, &pWal->hdr, sizeof(WalIndexHdr))!=0 ){
62166 bChanged = 1;
62167 }
62168
@@ -97462,10 +97482,47 @@
97482 }
97483 p = p->pPrior;
97484 }while( p!=0 );
97485 return WRC_Continue;
97486 }
97487
97488 /* Increase the walkerDepth when entering a subquery, and
97489 ** descrease when leaving the subquery.
97490 */
97491 SQLITE_PRIVATE int sqlite3WalkerDepthIncrease(Walker *pWalker, Select *pSelect){
97492 UNUSED_PARAMETER(pSelect);
97493 pWalker->walkerDepth++;
97494 return WRC_Continue;
97495 }
97496 SQLITE_PRIVATE void sqlite3WalkerDepthDecrease(Walker *pWalker, Select *pSelect){
97497 UNUSED_PARAMETER(pSelect);
97498 pWalker->walkerDepth--;
97499 }
97500
97501
97502 /*
97503 ** No-op routine for the parse-tree walker.
97504 **
97505 ** When this routine is the Walker.xExprCallback then expression trees
97506 ** are walked without any actions being taken at each node. Presumably,
97507 ** when this routine is used for Walker.xExprCallback then
97508 ** Walker.xSelectCallback is set to do something useful for every
97509 ** subquery in the parser tree.
97510 */
97511 SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
97512 UNUSED_PARAMETER2(NotUsed, NotUsed2);
97513 return WRC_Continue;
97514 }
97515
97516 /*
97517 ** No-op routine for the parse-tree walker for SELECT statements.
97518 ** subquery in the parser tree.
97519 */
97520 SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){
97521 UNUSED_PARAMETER2(NotUsed, NotUsed2);
97522 return WRC_Continue;
97523 }
97524
97525 /************** End of walker.c **********************************************/
97526 /************** Begin file resolve.c *****************************************/
97527 /*
97528 ** 2008 August 18
@@ -97491,10 +97548,12 @@
97548 ** This needs to occur when copying a TK_AGG_FUNCTION node from an
97549 ** outer query into an inner subquery.
97550 **
97551 ** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..)
97552 ** is a helper function - a callback for the tree walker.
97553 **
97554 ** See also the sqlite3WindowExtraAggFuncDepth() routine in window.c
97555 */
97556 static int incrAggDepth(Walker *pWalker, Expr *pExpr){
97557 if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.n;
97558 return WRC_Continue;
97559 }
@@ -103232,11 +103291,14 @@
103291 op = pExpr->op;
103292 }
103293 switch( op ){
103294 case TK_AGG_COLUMN: {
103295 AggInfo *pAggInfo = pExpr->pAggInfo;
103296 struct AggInfo_col *pCol;
103297 assert( pAggInfo!=0 );
103298 assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
103299 pCol = &pAggInfo->aCol[pExpr->iAgg];
103300 if( !pAggInfo->directMode ){
103301 assert( pCol->iMem>0 );
103302 return pCol->iMem;
103303 }else if( pAggInfo->useSortingIdx ){
103304 Table *pTab = pCol->pTab;
@@ -103532,11 +103594,14 @@
103594 sqlite3VdbeJumpHere(v, addr);
103595 break;
103596 }
103597 case TK_AGG_FUNCTION: {
103598 AggInfo *pInfo = pExpr->pAggInfo;
103599 if( pInfo==0
103600 || NEVER(pExpr->iAgg<0)
103601 || NEVER(pExpr->iAgg>=pInfo->nFunc)
103602 ){
103603 assert( !ExprHasProperty(pExpr, EP_IntValue) );
103604 sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken);
103605 }else{
103606 return pInfo->aFunc[pExpr->iAgg].iMem;
103607 }
@@ -105288,19 +105353,10 @@
105353 }
105354 }
105355 }
105356 return WRC_Continue;
105357 }
 
 
 
 
 
 
 
 
 
105358
105359 /*
105360 ** Analyze the pExpr expression looking for aggregate functions and
105361 ** for variables that need to be added to AggInfo object that pNC->pAggInfo
105362 ** points to. Additional entries are made on the AggInfo object as
@@ -105310,12 +105366,12 @@
105366 ** analyzed by sqlite3ResolveExprNames().
105367 */
105368 SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
105369 Walker w;
105370 w.xExprCallback = analyzeAggregate;
105371 w.xSelectCallback = sqlite3WalkerDepthIncrease;
105372 w.xSelectCallback2 = sqlite3WalkerDepthDecrease;
105373 w.walkerDepth = 0;
105374 w.u.pNC = pNC;
105375 w.pParse = 0;
105376 assert( pNC->pSrcList!=0 );
105377 sqlite3WalkExpr(&w, pExpr);
@@ -122033,11 +122089,11 @@
122089 }
122090 if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){
122091 sqlite3TableAffinity(v, pTab, regNewData+1);
122092 bAffinityDone = 1;
122093 }
122094 VdbeNoopComment((v, "prep index %s", pIdx->zName));
122095 iThisCur = iIdxCur+ix;
122096
122097
122098 /* Skip partial indices for which the WHERE clause is not true */
122099 if( pIdx->pPartIdxWhere ){
@@ -134005,33 +134061,10 @@
134061 }
134062 }
134063 return WRC_Continue;
134064 }
134065
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134066 #if SQLITE_DEBUG
134067 /*
134068 ** Always assert. This xSelectCallback2 implementation proves that the
134069 ** xSelectCallback2 is never invoked.
134070 */
@@ -135198,11 +135231,11 @@
135231 sAggInfo.mxReg = pParse->nMem;
135232 if( db->mallocFailed ) goto select_end;
135233 #if SELECTTRACE_ENABLED
135234 if( sqlite3SelectTrace & 0x400 ){
135235 int ii;
135236 SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", &sAggInfo));
135237 sqlite3TreeViewSelect(0, p, 0);
135238 for(ii=0; ii<sAggInfo.nColumn; ii++){
135239 sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
135240 ii, sAggInfo.aCol[ii].iMem);
135241 sqlite3TreeViewExpr(0, sAggInfo.aCol[ii].pExpr, 0);
@@ -151241,10 +151274,27 @@
151274 if( pList ) pList->a[nInit+i].sortFlags = pAppend->a[i].sortFlags;
151275 }
151276 }
151277 return pList;
151278 }
151279
151280 /*
151281 ** When rewriting a query, if the new subquery in the FROM clause
151282 ** contains TK_AGG_FUNCTION nodes that refer to an outer query,
151283 ** then we have to increase the Expr->op2 values of those nodes
151284 ** due to the extra subquery layer that was added.
151285 **
151286 ** See also the incrAggDepth() routine in resolve.c
151287 */
151288 static int sqlite3WindowExtraAggFuncDepth(Walker *pWalker, Expr *pExpr){
151289 if( pExpr->op==TK_AGG_FUNCTION
151290 && pExpr->op2>=pWalker->walkerDepth
151291 ){
151292 pExpr->op2++;
151293 }
151294 return WRC_Continue;
151295 }
151296
151297 /*
151298 ** If the SELECT statement passed as the second argument does not invoke
151299 ** any SQL window functions, this function is a no-op. Otherwise, it
151300 ** rewrites the SELECT statement so that window function xStep functions
@@ -151351,10 +151401,11 @@
151401 pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0
151402 );
151403 p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0);
151404 if( p->pSrc ){
151405 Table *pTab2;
151406 Walker w;
151407 p->pSrc->a[0].pSelect = pSub;
151408 sqlite3SrcListAssignCursors(pParse, p->pSrc);
151409 pSub->selFlags |= SF_Expanded;
151410 pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE);
151411 pSub->selFlags |= (selFlags & SF_Aggregate);
@@ -151366,10 +151417,15 @@
151417 }else{
151418 memcpy(pTab, pTab2, sizeof(Table));
151419 pTab->tabFlags |= TF_Ephemeral;
151420 p->pSrc->a[0].pTab = pTab;
151421 pTab = pTab2;
151422 memset(&w, 0, sizeof(w));
151423 w.xExprCallback = sqlite3WindowExtraAggFuncDepth;
151424 w.xSelectCallback = sqlite3WalkerDepthIncrease;
151425 w.xSelectCallback2 = sqlite3WalkerDepthDecrease;
151426 sqlite3WalkSelect(&w, pSub);
151427 }
151428 }else{
151429 sqlite3SelectDelete(db, pSub);
151430 }
151431 if( db->mallocFailed ) rc = SQLITE_NOMEM;
@@ -224764,11 +224820,11 @@
224820 int nArg, /* Number of args */
224821 sqlite3_value **apUnused /* Function arguments */
224822 ){
224823 assert( nArg==0 );
224824 UNUSED_PARAM2(nArg, apUnused);
224825 sqlite3_result_text(pCtx, "fts5: 2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350", -1, SQLITE_TRANSIENT);
224826 }
224827
224828 /*
224829 ** Return true if zName is the extension on one of the shadow tables used
224830 ** by this module.
@@ -229547,12 +229603,12 @@
229603 }
229604 #endif /* SQLITE_CORE */
229605 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
229606
229607 /************** End of stmt.c ************************************************/
229608 #if __LINE__!=229608
229609 #undef SQLITE_SOURCE_ID
229610 #define SQLITE_SOURCE_ID "2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba8alt2"
229611 #endif
229612 /* Return the source-id for this library */
229613 SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
229614 /************************** End of sqlite3.c ******************************/
229615
+3 -3
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121121
**
122122
** See also: [sqlite3_libversion()],
123123
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124124
** [sqlite_version()] and [sqlite_source_id()].
125125
*/
126
-#define SQLITE_VERSION "3.32.0"
127
-#define SQLITE_VERSION_NUMBER 3032000
128
-#define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a"
126
+#define SQLITE_VERSION "3.32.1"
127
+#define SQLITE_VERSION_NUMBER 3032001
128
+#define SQLITE_SOURCE_ID "2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350"
129129
130130
/*
131131
** CAPI3REF: Run-Time Library Version Numbers
132132
** KEYWORDS: sqlite3_version sqlite3_sourceid
133133
**
134134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.32.0"
127 #define SQLITE_VERSION_NUMBER 3032000
128 #define SQLITE_SOURCE_ID "2020-05-22 17:46:16 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,13 +121,13 @@
121 **
122 ** See also: [sqlite3_libversion()],
123 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
124 ** [sqlite_version()] and [sqlite_source_id()].
125 */
126 #define SQLITE_VERSION "3.32.1"
127 #define SQLITE_VERSION_NUMBER 3032001
128 #define SQLITE_SOURCE_ID "2020-05-25 16:19:56 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350"
129
130 /*
131 ** CAPI3REF: Run-Time Library Version Numbers
132 ** KEYWORDS: sqlite3_version sqlite3_sourceid
133 **
134

Keyboard Shortcuts

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