Fossil SCM

Update the built-in SQLite to the latest 3.8.3 alpha from upstream, including the removal of a stray tab character from the source code.

drh 2013-12-23 11:37 trunk
Commit 5f08392169688eb7b5f61d020ecee462502241ee
3 files changed +5 -1 +204 -111 +1 -1
+5 -1
--- src/shell.c
+++ src/shell.c
@@ -3036,11 +3036,14 @@
30363036
if( seenInterrupt ){
30373037
if( in!=0 ) break;
30383038
seenInterrupt = 0;
30393039
}
30403040
lineno++;
3041
- if( nSql==0 && _all_whitespace(zLine) ) continue;
3041
+ if( nSql==0 && _all_whitespace(zLine) ){
3042
+ if( p->echoOn ) printf("%s\n", zLine);
3043
+ continue;
3044
+ }
30423045
if( zLine && zLine[0]=='.' && nSql==0 ){
30433046
if( p->echoOn ) printf("%s\n", zLine);
30443047
rc = do_meta_command(zLine, p);
30453048
if( rc==2 ){ /* exit requested */
30463049
break;
@@ -3098,10 +3101,11 @@
30983101
}
30993102
errCnt++;
31003103
}
31013104
nSql = 0;
31023105
}else if( nSql && _all_whitespace(zSql) ){
3106
+ if( p->echoOn ) printf("%s\n", zSql);
31033107
nSql = 0;
31043108
}
31053109
}
31063110
if( nSql ){
31073111
if( !_all_whitespace(zSql) ){
31083112
--- src/shell.c
+++ src/shell.c
@@ -3036,11 +3036,14 @@
3036 if( seenInterrupt ){
3037 if( in!=0 ) break;
3038 seenInterrupt = 0;
3039 }
3040 lineno++;
3041 if( nSql==0 && _all_whitespace(zLine) ) continue;
 
 
 
3042 if( zLine && zLine[0]=='.' && nSql==0 ){
3043 if( p->echoOn ) printf("%s\n", zLine);
3044 rc = do_meta_command(zLine, p);
3045 if( rc==2 ){ /* exit requested */
3046 break;
@@ -3098,10 +3101,11 @@
3098 }
3099 errCnt++;
3100 }
3101 nSql = 0;
3102 }else if( nSql && _all_whitespace(zSql) ){
 
3103 nSql = 0;
3104 }
3105 }
3106 if( nSql ){
3107 if( !_all_whitespace(zSql) ){
3108
--- src/shell.c
+++ src/shell.c
@@ -3036,11 +3036,14 @@
3036 if( seenInterrupt ){
3037 if( in!=0 ) break;
3038 seenInterrupt = 0;
3039 }
3040 lineno++;
3041 if( nSql==0 && _all_whitespace(zLine) ){
3042 if( p->echoOn ) printf("%s\n", zLine);
3043 continue;
3044 }
3045 if( zLine && zLine[0]=='.' && nSql==0 ){
3046 if( p->echoOn ) printf("%s\n", zLine);
3047 rc = do_meta_command(zLine, p);
3048 if( rc==2 ){ /* exit requested */
3049 break;
@@ -3098,10 +3101,11 @@
3101 }
3102 errCnt++;
3103 }
3104 nSql = 0;
3105 }else if( nSql && _all_whitespace(zSql) ){
3106 if( p->echoOn ) printf("%s\n", zSql);
3107 nSql = 0;
3108 }
3109 }
3110 if( nSql ){
3111 if( !_all_whitespace(zSql) ){
3112
+204 -111
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -135,11 +135,11 @@
135135
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136136
** [sqlite_version()] and [sqlite_source_id()].
137137
*/
138138
#define SQLITE_VERSION "3.8.3"
139139
#define SQLITE_VERSION_NUMBER 3008003
140
-#define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2"
140
+#define SQLITE_SOURCE_ID "2013-12-23 11:33:32 25b8a1c9ba77df3b7c78cbce922cb593d661696d"
141141
142142
/*
143143
** CAPI3REF: Run-Time Library Version Numbers
144144
** KEYWORDS: sqlite3_version, sqlite3_sourceid
145145
**
@@ -9098,11 +9098,11 @@
90989098
#define OP_String 25 /* synopsis: r[P2]='P4' (len=P1) */
90999099
#define OP_Null 26 /* synopsis: r[P2..P3]=NULL */
91009100
#define OP_Blob 27 /* synopsis: r[P2]=P4 (len=P1) */
91019101
#define OP_Variable 28 /* synopsis: r[P2]=parameter(P1,P4) */
91029102
#define OP_Move 29 /* synopsis: r[P2@P3]=r[P1@P3] */
9103
-#define OP_Copy 30 /* synopsis: r[P2@P3]=r[P1@P3] */
9103
+#define OP_Copy 30 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
91049104
#define OP_SCopy 31 /* synopsis: r[P2]=r[P1] */
91059105
#define OP_ResultRow 32 /* synopsis: output=r[P1@P2] */
91069106
#define OP_CollSeq 33
91079107
#define OP_AddImm 34 /* synopsis: r[P1]=r[P1]+P2 */
91089108
#define OP_MustBeInt 35
@@ -9263,11 +9263,11 @@
92639263
92649264
/*
92659265
** Prototypes for the VDBE interface. See comments on the implementation
92669266
** for a description of what each of these routines does.
92679267
*/
9268
-SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(sqlite3*);
9268
+SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*);
92699269
SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int);
92709270
SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int);
92719271
SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
92729272
SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
92739273
SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
@@ -11003,10 +11003,11 @@
1100311003
u8 useSortingIdx; /* In direct mode, reference the sorting index rather
1100411004
** than the source table */
1100511005
int sortingIdx; /* Cursor number of the sorting index */
1100611006
int sortingIdxPTab; /* Cursor number of pseudo-table */
1100711007
int nSortingColumn; /* Number of columns in the sorting index */
11008
+ int mnReg, mxReg; /* Range of registers allocated for aCol and aFunc */
1100811009
ExprList *pGroupBy; /* The group by clause */
1100911010
struct AggInfo_col { /* For each column used in source tables */
1101011011
Table *pTab; /* Source table */
1101111012
int iTable; /* Cursor number of the source table */
1101211013
int iColumn; /* Column number within the source table */
@@ -12452,12 +12453,11 @@
1245212453
SQLITE_PRIVATE void sqlite3Error(sqlite3*, int, const char*,...);
1245312454
SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
1245412455
SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
1245512456
SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
1245612457
12457
-#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) || \
12458
- defined(SQLITE_DEBUG_OS_TRACE)
12458
+#if defined(SQLITE_TEST)
1245912459
SQLITE_PRIVATE const char *sqlite3ErrName(int);
1246012460
#endif
1246112461
1246212462
SQLITE_PRIVATE const char *sqlite3ErrStr(int);
1246312463
SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
@@ -13776,10 +13776,13 @@
1377613776
Op *aOp; /* Space to hold the virtual machine's program */
1377713777
Mem *aMem; /* The memory locations */
1377813778
Mem **apArg; /* Arguments to currently executing user function */
1377913779
Mem *aColName; /* Column names to return */
1378013780
Mem *pResultSet; /* Pointer to an array of results */
13781
+#ifdef SQLITE_DEBUG
13782
+ Parse *pParse; /* Parsing context used to create this Vdbe */
13783
+#endif
1378113784
int nMem; /* Number of memory locations currently allocated */
1378213785
int nOp; /* Number of instructions in the program */
1378313786
int nOpAlloc; /* Number of slots allocated for aOp[] */
1378413787
int nLabel; /* Number of labels used */
1378513788
int *aLabel; /* Space to hold the labels */
@@ -15443,11 +15446,25 @@
1544315446
** really care if the VFS receives and understands the information since it
1544415447
** is only a hint and can be safely ignored. The sqlite3OsFileControlHint()
1544515448
** routine has no return value since the return value would be meaningless.
1544615449
*/
1544715450
SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
15448
- DO_OS_MALLOC_TEST(id);
15451
+#ifdef SQLITE_TEST
15452
+ if( op!=SQLITE_FCNTL_COMMIT_PHASETWO ){
15453
+ /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
15454
+ ** is using a regular VFS, it is called after the corresponding
15455
+ ** transaction has been committed. Injecting a fault at this point
15456
+ ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
15457
+ ** but the transaction is committed anyway.
15458
+ **
15459
+ ** The core must call OsFileControl() though, not OsFileControlHint(),
15460
+ ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
15461
+ ** means the commit really has failed and an error should be returned
15462
+ ** to the user. */
15463
+ DO_OS_MALLOC_TEST(id);
15464
+ }
15465
+#endif
1544915466
return id->pMethods->xFileControl(id, op, pArg);
1545015467
}
1545115468
SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){
1545215469
(void)id->pMethods->xFileControl(id, op, pArg);
1545315470
}
@@ -23098,11 +23115,11 @@
2309823115
/* 25 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
2309923116
/* 26 */ "Null" OpHelp("r[P2..P3]=NULL"),
2310023117
/* 27 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
2310123118
/* 28 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
2310223119
/* 29 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
23103
- /* 30 */ "Copy" OpHelp("r[P2@P3]=r[P1@P3]"),
23120
+ /* 30 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
2310423121
/* 31 */ "SCopy" OpHelp("r[P2]=r[P1]"),
2310523122
/* 32 */ "ResultRow" OpHelp("output=r[P1@P2]"),
2310623123
/* 33 */ "CollSeq" OpHelp(""),
2310723124
/* 34 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
2310823125
/* 35 */ "MustBeInt" OpHelp(""),
@@ -61170,11 +61187,12 @@
6117061187
*/
6117161188
6117261189
/*
6117361190
** Create a new virtual database engine.
6117461191
*/
61175
-SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(sqlite3 *db){
61192
+SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
61193
+ sqlite3 *db = pParse->db;
6117661194
Vdbe *p;
6117761195
p = sqlite3DbMallocZero(db, sizeof(Vdbe) );
6117861196
if( p==0 ) return 0;
6117961197
p->db = db;
6118061198
if( db->pVdbe ){
@@ -61182,10 +61200,13 @@
6118261200
}
6118361201
p->pNext = db->pVdbe;
6118461202
p->pPrev = 0;
6118561203
db->pVdbe = p;
6118661204
p->magic = VDBE_MAGIC_INIT;
61205
+#if SQLITE_DEBUG
61206
+ p->pParse = pParse;
61207
+#endif
6118761208
return p;
6118861209
}
6118961210
6119061211
/*
6119161212
** Remember the SQL string for a prepared statement.
@@ -61301,10 +61322,19 @@
6130161322
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
6130261323
pOp->zComment = 0;
6130361324
#endif
6130461325
#ifdef SQLITE_DEBUG
6130561326
if( p->db->flags & SQLITE_VdbeAddopTrace ){
61327
+ int jj, kk;
61328
+ Parse *pParse = p->pParse;
61329
+ for(jj=kk=0; jj<SQLITE_N_COLCACHE; jj++){
61330
+ struct yColCache *x = pParse->aColCache + jj;
61331
+ if( x->iLevel>pParse->iCacheLevel || x->iReg==0 ) continue;
61332
+ printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
61333
+ kk++;
61334
+ }
61335
+ if( kk ) printf("\n");
6130661336
sqlite3VdbePrintOp(0, i, &p->aOp[i]);
6130761337
test_addop_breakpoint();
6130861338
}
6130961339
#endif
6131061340
#ifdef VDBE_PROFILE
@@ -62022,11 +62052,21 @@
6202262052
if( c=='4' ) return pOp->p4.i;
6202362053
return pOp->p5;
6202462054
}
6202562055
6202662056
/*
62027
-** Compute a string for the "comment" field of a VDBE opcode listing
62057
+** Compute a string for the "comment" field of a VDBE opcode listing.
62058
+**
62059
+** The Synopsis: field in comments in the vdbe.c source file gets converted
62060
+** to an extra string that is appended to the sqlite3OpcodeName(). In the
62061
+** absence of other comments, this synopsis becomes the comment on the opcode.
62062
+** Some translation occurs:
62063
+**
62064
+** "PX" -> "r[X]"
62065
+** "PX@PY" -> "r[X..X+Y-1]" or "r[x]" if y is 0 or 1
62066
+** "PX@PY+1" -> "r[X..X+Y]" or "r[x]" if y is 0
62067
+** "PY..PY" -> "r[X..Y]" or "r[x]" if y<=x
6202862068
*/
6202962069
static int displayComment(
6203062070
const Op *pOp, /* The opcode to be commented */
6203162071
const char *zP4, /* Previously obtained value for P4 */
6203262072
char *zTemp, /* Write result here */
@@ -62056,11 +62096,17 @@
6205662096
sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1);
6205762097
if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){
6205862098
ii += 3;
6205962099
jj += sqlite3Strlen30(zTemp+jj);
6206062100
v2 = translateP(zSynopsis[ii], pOp);
62061
- if( v2>1 ) sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1);
62101
+ if( strncmp(zSynopsis+ii+1,"+1",2)==0 ){
62102
+ ii += 2;
62103
+ v2++;
62104
+ }
62105
+ if( v2>1 ){
62106
+ sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1);
62107
+ }
6206262108
}else if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){
6206362109
ii += 4;
6206462110
}
6206562111
}
6206662112
jj += sqlite3Strlen30(zTemp+jj);
@@ -62288,10 +62334,13 @@
6228862334
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
6228962335
displayComment(pOp, zP4, zCom, sizeof(zCom));
6229062336
#else
6229162337
zCom[0] = 0
6229262338
#endif
62339
+ /* NB: The sqlite3OpcodeName() function is implemented by code created
62340
+ ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the
62341
+ ** information from the vdbe.c source text */
6229362342
fprintf(pOut, zFormat1, pc,
6229462343
sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,
6229562344
zCom
6229662345
);
6229762346
fflush(pOut);
@@ -67348,11 +67397,11 @@
6734867397
}while( n-- );
6734967398
break;
6735067399
}
6735167400
6735267401
/* Opcode: Copy P1 P2 P3 * *
67353
-** Synopsis: r[P2@P3]=r[P1@P3]
67402
+** Synopsis: r[P2@P3+1]=r[P1@P3+1]
6735467403
**
6735567404
** Make a copy of registers P1..P1+P3 into registers P2..P2+P3.
6735667405
**
6735767406
** This instruction makes a deep copy of the value. A duplicate
6735867407
** is made of any string or blob constant. See also OP_SCopy.
@@ -68691,11 +68740,11 @@
6869168740
/* This is the common case where the desired content fits on the original
6869268741
** page - where the content is not on an overflow page */
6869368742
VdbeMemRelease(pDest);
6869468743
sqlite3VdbeSerialGet(pC->aRow+aOffset[p2], aType[p2], pDest);
6869568744
}else{
68696
- /* This branch happens only when content is on overflow pages */
68745
+ /* This branch happens only when content is on overflow pages */
6869768746
t = aType[p2];
6869868747
if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
6869968748
&& ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))
6870068749
|| (len = sqlite3VdbeSerialTypeLen(t))==0
6870168750
){
@@ -72809,11 +72858,11 @@
7280972858
sqlite3BtreeLeaveAll(db);
7281072859
goto blob_open_out;
7281172860
}
7281272861
}
7281372862
72814
- pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(db);
72863
+ pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(pParse);
7281572864
assert( pBlob->pStmt || db->mallocFailed );
7281672865
if( pBlob->pStmt ){
7281772866
Vdbe *v = (Vdbe *)pBlob->pStmt;
7281872867
int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
7281972868
@@ -78363,10 +78412,15 @@
7836378412
** added to the column cache after this call are removed when the
7836478413
** corresponding pop occurs.
7836578414
*/
7836678415
SQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){
7836778416
pParse->iCacheLevel++;
78417
+#ifdef SQLITE_DEBUG
78418
+ if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
78419
+ printf("PUSH to %d\n", pParse->iCacheLevel);
78420
+ }
78421
+#endif
7836878422
}
7836978423
7837078424
/*
7837178425
** Remove from the column cache any entries that were added since the
7837278426
** the previous N Push operations. In other words, restore the cache
@@ -78376,10 +78430,15 @@
7837678430
int i;
7837778431
struct yColCache *p;
7837878432
assert( N>0 );
7837978433
assert( pParse->iCacheLevel>=N );
7838078434
pParse->iCacheLevel -= N;
78435
+#ifdef SQLITE_DEBUG
78436
+ if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
78437
+ printf("POP to %d\n", pParse->iCacheLevel);
78438
+ }
78439
+#endif
7838178440
for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
7838278441
if( p->iReg && p->iLevel>pParse->iCacheLevel ){
7838378442
cacheEntryClear(pParse, p);
7838478443
p->iReg = 0;
7838578444
}
@@ -78470,10 +78529,15 @@
7847078529
*/
7847178530
SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
7847278531
int i;
7847378532
struct yColCache *p;
7847478533
78534
+#if SQLITE_DEBUG
78535
+ if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
78536
+ printf("CLEAR\n");
78537
+ }
78538
+#endif
7847578539
for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
7847678540
if( p->iReg ){
7847778541
cacheEntryClear(pParse, p);
7847878542
p->iReg = 0;
7847978543
}
@@ -79606,11 +79670,21 @@
7960679670
if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){
7960779671
sqlite3ExprCodeAtInit(pParse, pExpr, target+i, 0);
7960879672
}else{
7960979673
int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
7961079674
if( inReg!=target+i ){
79611
- sqlite3VdbeAddOp2(pParse->pVdbe, copyOp, inReg, target+i);
79675
+ VdbeOp *pOp;
79676
+ Vdbe *v = pParse->pVdbe;
79677
+ if( copyOp==OP_Copy
79678
+ && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy
79679
+ && pOp->p1+pOp->p3+1==inReg
79680
+ && pOp->p2+pOp->p3+1==target+i
79681
+ ){
79682
+ pOp->p3++;
79683
+ }else{
79684
+ sqlite3VdbeAddOp2(v, copyOp, inReg, target+i);
79685
+ }
7961279686
}
7961379687
}
7961479688
}
7961579689
return n;
7961679690
}
@@ -83030,14 +83104,10 @@
8303083104
{
8303183105
int rc = SQLITE_OK;
8303283106
if( pExpr ){
8303383107
if( pExpr->op!=TK_ID ){
8303483108
rc = sqlite3ResolveExprNames(pName, pExpr);
83035
- if( rc==SQLITE_OK && !sqlite3ExprIsConstant(pExpr) ){
83036
- sqlite3ErrorMsg(pName->pParse, "invalid name: \"%s\"", pExpr->u.zToken);
83037
- return SQLITE_ERROR;
83038
- }
8303983109
}else{
8304083110
pExpr->op = TK_STRING;
8304183111
}
8304283112
}
8304383113
return rc;
@@ -89271,11 +89341,10 @@
8927189341
Vdbe *v = pParse->pVdbe;
8927289342
int j;
8927389343
Table *pTab = pIdx->pTable;
8927489344
int regBase;
8927589345
int nCol;
89276
- Index *pPk;
8927789346
8927889347
if( piPartIdxLabel ){
8927989348
if( pIdx->pPartIdxWhere ){
8928089349
*piPartIdxLabel = sqlite3VdbeMakeLabel(v);
8928189350
pParse->iPartIdxTab = iDataCur;
@@ -89285,20 +89354,13 @@
8928589354
*piPartIdxLabel = 0;
8928689355
}
8928789356
}
8928889357
nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
8928989358
regBase = sqlite3GetTempRange(pParse, nCol);
89290
- pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
8929189359
for(j=0; j<nCol; j++){
89292
- i16 idx = pIdx->aiColumn[j];
89293
- if( pPk ) idx = sqlite3ColumnOfIndex(pPk, idx);
89294
- if( idx<0 || idx==pTab->iPKey ){
89295
- sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regBase+j);
89296
- }else{
89297
- sqlite3VdbeAddOp3(v, OP_Column, iDataCur, idx, regBase+j);
89298
- sqlite3ColumnDefault(v, pTab, pIdx->aiColumn[j], -1);
89299
- }
89360
+ sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pIdx->aiColumn[j],
89361
+ regBase+j);
8930089362
}
8930189363
if( regOut ){
8930289364
const char *zAff;
8930389365
if( pTab->pSelect
8930489366
|| OptimizationDisabled(pParse->db, SQLITE_IdxRealAsInt)
@@ -93929,51 +93991,53 @@
9392993991
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
9393093992
regIdx, pIdx->nKeyCol);
9393193993
9393293994
/* Generate code to handle collisions */
9393393995
regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
93934
- if( HasRowid(pTab) ){
93935
- sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
93936
- /* Conflict only if the rowid of the existing index entry
93937
- ** is different from old-rowid */
93938
- if( isUpdate ){
93939
- sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
93940
- }
93941
- }else{
93942
- int x;
93943
- /* Extract the PRIMARY KEY from the end of the index entry and
93944
- ** store it in registers regR..regR+nPk-1 */
93945
- if( (isUpdate || onError==OE_Replace) && pIdx!=pPk ){
93946
- for(i=0; i<pPk->nKeyCol; i++){
93947
- x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
93948
- sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);
93949
- VdbeComment((v, "%s.%s", pTab->zName,
93950
- pTab->aCol[pPk->aiColumn[i]].zName));
93951
- }
93952
- }
93953
- if( isUpdate ){
93954
- /* If currently processing the PRIMARY KEY of a WITHOUT ROWID
93955
- ** table, only conflict if the new PRIMARY KEY values are actually
93956
- ** different from the old.
93957
- **
93958
- ** For a UNIQUE index, only conflict if the PRIMARY KEY values
93959
- ** of the matched index row are different from the original PRIMARY
93960
- ** KEY values of this row before the update. */
93961
- int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;
93962
- int op = OP_Ne;
93963
- int regCmp = (pIdx->autoIndex==2 ? regIdx : regR);
93964
-
93965
- for(i=0; i<pPk->nKeyCol; i++){
93966
- char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);
93967
- x = pPk->aiColumn[i];
93968
- if( i==(pPk->nKeyCol-1) ){
93969
- addrJump = addrUniqueOk;
93970
- op = OP_Eq;
93971
- }
93972
- sqlite3VdbeAddOp4(v, op,
93973
- regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ
93974
- );
93996
+ if( isUpdate || onError==OE_Replace ){
93997
+ if( HasRowid(pTab) ){
93998
+ sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
93999
+ /* Conflict only if the rowid of the existing index entry
94000
+ ** is different from old-rowid */
94001
+ if( isUpdate ){
94002
+ sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
94003
+ }
94004
+ }else{
94005
+ int x;
94006
+ /* Extract the PRIMARY KEY from the end of the index entry and
94007
+ ** store it in registers regR..regR+nPk-1 */
94008
+ if( pIdx!=pPk ){
94009
+ for(i=0; i<pPk->nKeyCol; i++){
94010
+ x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
94011
+ sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);
94012
+ VdbeComment((v, "%s.%s", pTab->zName,
94013
+ pTab->aCol[pPk->aiColumn[i]].zName));
94014
+ }
94015
+ }
94016
+ if( isUpdate ){
94017
+ /* If currently processing the PRIMARY KEY of a WITHOUT ROWID
94018
+ ** table, only conflict if the new PRIMARY KEY values are actually
94019
+ ** different from the old.
94020
+ **
94021
+ ** For a UNIQUE index, only conflict if the PRIMARY KEY values
94022
+ ** of the matched index row are different from the original PRIMARY
94023
+ ** KEY values of this row before the update. */
94024
+ int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;
94025
+ int op = OP_Ne;
94026
+ int regCmp = (pIdx->autoIndex==2 ? regIdx : regR);
94027
+
94028
+ for(i=0; i<pPk->nKeyCol; i++){
94029
+ char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);
94030
+ x = pPk->aiColumn[i];
94031
+ if( i==(pPk->nKeyCol-1) ){
94032
+ addrJump = addrUniqueOk;
94033
+ op = OP_Eq;
94034
+ }
94035
+ sqlite3VdbeAddOp4(v, op,
94036
+ regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ
94037
+ );
94038
+ }
9397594039
}
9397694040
}
9397794041
}
9397894042
9397994043
/* Generate code that executes if the new index entry is not unique */
@@ -99669,11 +99733,10 @@
9966999733
}
9967099734
}else if( eDest!=SRT_Exists ){
9967199735
/* If the destination is an EXISTS(...) expression, the actual
9967299736
** values returned by the SELECT are not required.
9967399737
*/
99674
- sqlite3ExprCacheClear(pParse);
9967599738
sqlite3ExprCodeExprList(pParse, pEList, regResult,
9967699739
(eDest==SRT_Output)?SQLITE_ECEL_DUP:0);
9967799740
}
9967899741
nColumn = nResultCol;
9967999742
@@ -100636,11 +100699,11 @@
100636100699
** If an error occurs, return NULL and leave a message in pParse.
100637100700
*/
100638100701
SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){
100639100702
Vdbe *v = pParse->pVdbe;
100640100703
if( v==0 ){
100641
- v = pParse->pVdbe = sqlite3VdbeCreate(pParse->db);
100704
+ v = pParse->pVdbe = sqlite3VdbeCreate(pParse);
100642100705
#ifndef SQLITE_OMIT_TRACE
100643100706
if( v ){
100644100707
sqlite3VdbeAddOp0(v, OP_Trace);
100645100708
}
100646100709
#endif
@@ -102894,18 +102957,27 @@
102894102957
*/
102895102958
static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){
102896102959
Vdbe *v = pParse->pVdbe;
102897102960
int i;
102898102961
struct AggInfo_func *pFunc;
102899
- if( pAggInfo->nFunc+pAggInfo->nColumn==0 ){
102900
- return;
102901
- }
102962
+ int nReg = pAggInfo->nFunc + pAggInfo->nColumn;
102963
+ if( nReg==0 ) return;
102964
+#ifdef SQLITE_DEBUG
102965
+ /* Verify that all AggInfo registers are within the range specified by
102966
+ ** AggInfo.mnReg..AggInfo.mxReg */
102967
+ assert( nReg==pAggInfo->mxReg-pAggInfo->mnReg+1 );
102902102968
for(i=0; i<pAggInfo->nColumn; i++){
102903
- sqlite3VdbeAddOp2(v, OP_Null, 0, pAggInfo->aCol[i].iMem);
102969
+ assert( pAggInfo->aCol[i].iMem>=pAggInfo->mnReg
102970
+ && pAggInfo->aCol[i].iMem<=pAggInfo->mxReg );
102904102971
}
102972
+ for(i=0; i<pAggInfo->nFunc; i++){
102973
+ assert( pAggInfo->aFunc[i].iMem>=pAggInfo->mnReg
102974
+ && pAggInfo->aFunc[i].iMem<=pAggInfo->mxReg );
102975
+ }
102976
+#endif
102977
+ sqlite3VdbeAddOp3(v, OP_Null, 0, pAggInfo->mnReg, pAggInfo->mxReg);
102905102978
for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){
102906
- sqlite3VdbeAddOp2(v, OP_Null, 0, pFunc->iMem);
102907102979
if( pFunc->iDistinct>=0 ){
102908102980
Expr *pE = pFunc->pExpr;
102909102981
assert( !ExprHasProperty(pE, EP_xIsSelect) );
102910102982
if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){
102911102983
sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one "
@@ -102947,11 +103019,10 @@
102947103019
int addrHitTest = 0;
102948103020
struct AggInfo_func *pF;
102949103021
struct AggInfo_col *pC;
102950103022
102951103023
pAggInfo->directMode = 1;
102952
- sqlite3ExprCacheClear(pParse);
102953103024
for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
102954103025
int nArg;
102955103026
int addrNext = 0;
102956103027
int regAgg;
102957103028
ExprList *pList = pF->pExpr->x.pList;
@@ -103480,10 +103551,11 @@
103480103551
*/
103481103552
memset(&sNC, 0, sizeof(sNC));
103482103553
sNC.pParse = pParse;
103483103554
sNC.pSrcList = pTabList;
103484103555
sNC.pAggInfo = &sAggInfo;
103556
+ sAggInfo.mnReg = pParse->nMem+1;
103485103557
sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0;
103486103558
sAggInfo.pGroupBy = pGroupBy;
103487103559
sqlite3ExprAnalyzeAggList(&sNC, pEList);
103488103560
sqlite3ExprAnalyzeAggList(&sNC, pOrderBy);
103489103561
if( pHaving ){
@@ -103494,10 +103566,11 @@
103494103566
assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );
103495103567
sNC.ncFlags |= NC_InAggFunc;
103496103568
sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);
103497103569
sNC.ncFlags &= ~NC_InAggFunc;
103498103570
}
103571
+ sAggInfo.mxReg = pParse->nMem;
103499103572
if( db->mallocFailed ) goto select_end;
103500103573
103501103574
/* Processing for aggregates with GROUP BY is very different and
103502103575
** much more complex than aggregates without a GROUP BY.
103503103576
*/
@@ -105398,11 +105471,11 @@
105398105471
pCol->affinity, &pValue);
105399105472
if( pValue ){
105400105473
sqlite3VdbeChangeP4(v, -1, (const char *)pValue, P4_MEM);
105401105474
}
105402105475
#ifndef SQLITE_OMIT_FLOATING_POINT
105403
- if( iReg>=0 && pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
105476
+ if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
105404105477
sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg);
105405105478
}
105406105479
#endif
105407105480
}
105408105481
}
@@ -105822,14 +105895,14 @@
105822105895
** be used eliminates some redundant opcodes.
105823105896
*/
105824105897
newmask = sqlite3TriggerColmask(
105825105898
pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError
105826105899
);
105827
- sqlite3VdbeAddOp3(v, OP_Null, 0, regNew, regNew+pTab->nCol-1);
105900
+ /*sqlite3VdbeAddOp3(v, OP_Null, 0, regNew, regNew+pTab->nCol-1);*/
105828105901
for(i=0; i<pTab->nCol; i++){
105829105902
if( i==pTab->iPKey ){
105830
- /*sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);*/
105903
+ sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
105831105904
}else{
105832105905
j = aXRef[i];
105833105906
if( j>=0 ){
105834105907
sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i);
105835105908
}else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask&(1<<i)) ){
@@ -105839,10 +105912,12 @@
105839105912
** a new.* reference in a trigger program.
105840105913
*/
105841105914
testcase( i==31 );
105842105915
testcase( i==32 );
105843105916
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
105917
+ }else{
105918
+ sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
105844105919
}
105845105920
}
105846105921
}
105847105922
105848105923
/* Fire any BEFORE UPDATE triggers. This happens before constraints are
@@ -111951,10 +112026,11 @@
111951112026
*/
111952112027
if( pTerm==0
111953112028
&& saved_nEq==saved_nSkip
111954112029
&& saved_nEq+1<pProbe->nKeyCol
111955112030
&& pProbe->aiRowEst[saved_nEq+1]>=18 /* TUNING: Minimum for skip-scan */
112031
+ && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
111956112032
){
111957112033
LogEst nIter;
111958112034
pNew->u.btree.nEq++;
111959112035
pNew->u.btree.nSkip++;
111960112036
pNew->aLTerm[pNew->nLTerm++] = 0;
@@ -119669,12 +119745,11 @@
119669119745
119670119746
/*
119671119747
** Return a static string containing the name corresponding to the error code
119672119748
** specified in the argument.
119673119749
*/
119674
-#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) || \
119675
- defined(SQLITE_DEBUG_OS_TRACE)
119750
+#if defined(SQLITE_TEST)
119676119751
SQLITE_PRIVATE const char *sqlite3ErrName(int rc){
119677119752
const char *zName = 0;
119678119753
int i, origRc = rc;
119679119754
for(i=0; i<2 && zName==0; i++, rc &= 0xff){
119680119755
switch( rc ){
@@ -121247,10 +121322,12 @@
121247121322
#ifdef SQLITE_DEFAULT_LOCKING_MODE
121248121323
db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;
121249121324
sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
121250121325
SQLITE_DEFAULT_LOCKING_MODE);
121251121326
#endif
121327
+
121328
+ if( rc ) sqlite3Error(db, rc, 0);
121252121329
121253121330
/* Enable the lookaside-malloc subsystem */
121254121331
setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,
121255121332
sqlite3GlobalConfig.nLookaside);
121256121333
@@ -131579,61 +131656,74 @@
131579131656
}
131580131657
131581131658
/* Step 2 */
131582131659
switch( z[1] ){
131583131660
case 'a':
131584
- stem(&z, "lanoita", "ate", m_gt_0) ||
131585
- stem(&z, "lanoit", "tion", m_gt_0);
131661
+ if( !stem(&z, "lanoita", "ate", m_gt_0) ){
131662
+ stem(&z, "lanoit", "tion", m_gt_0);
131663
+ }
131586131664
break;
131587131665
case 'c':
131588
- stem(&z, "icne", "ence", m_gt_0) ||
131589
- stem(&z, "icna", "ance", m_gt_0);
131666
+ if( !stem(&z, "icne", "ence", m_gt_0) ){
131667
+ stem(&z, "icna", "ance", m_gt_0);
131668
+ }
131590131669
break;
131591131670
case 'e':
131592131671
stem(&z, "rezi", "ize", m_gt_0);
131593131672
break;
131594131673
case 'g':
131595131674
stem(&z, "igol", "log", m_gt_0);
131596131675
break;
131597131676
case 'l':
131598
- stem(&z, "ilb", "ble", m_gt_0) ||
131599
- stem(&z, "illa", "al", m_gt_0) ||
131600
- stem(&z, "iltne", "ent", m_gt_0) ||
131601
- stem(&z, "ile", "e", m_gt_0) ||
131602
- stem(&z, "ilsuo", "ous", m_gt_0);
131677
+ if( !stem(&z, "ilb", "ble", m_gt_0)
131678
+ && !stem(&z, "illa", "al", m_gt_0)
131679
+ && !stem(&z, "iltne", "ent", m_gt_0)
131680
+ && !stem(&z, "ile", "e", m_gt_0)
131681
+ ){
131682
+ stem(&z, "ilsuo", "ous", m_gt_0);
131683
+ }
131603131684
break;
131604131685
case 'o':
131605
- stem(&z, "noitazi", "ize", m_gt_0) ||
131606
- stem(&z, "noita", "ate", m_gt_0) ||
131607
- stem(&z, "rota", "ate", m_gt_0);
131686
+ if( !stem(&z, "noitazi", "ize", m_gt_0)
131687
+ && !stem(&z, "noita", "ate", m_gt_0)
131688
+ ){
131689
+ stem(&z, "rota", "ate", m_gt_0);
131690
+ }
131608131691
break;
131609131692
case 's':
131610
- stem(&z, "msila", "al", m_gt_0) ||
131611
- stem(&z, "ssenevi", "ive", m_gt_0) ||
131612
- stem(&z, "ssenluf", "ful", m_gt_0) ||
131613
- stem(&z, "ssensuo", "ous", m_gt_0);
131693
+ if( !stem(&z, "msila", "al", m_gt_0)
131694
+ && !stem(&z, "ssenevi", "ive", m_gt_0)
131695
+ && !stem(&z, "ssenluf", "ful", m_gt_0)
131696
+ ){
131697
+ stem(&z, "ssensuo", "ous", m_gt_0);
131698
+ }
131614131699
break;
131615131700
case 't':
131616
- stem(&z, "itila", "al", m_gt_0) ||
131617
- stem(&z, "itivi", "ive", m_gt_0) ||
131618
- stem(&z, "itilib", "ble", m_gt_0);
131701
+ if( !stem(&z, "itila", "al", m_gt_0)
131702
+ && !stem(&z, "itivi", "ive", m_gt_0)
131703
+ ){
131704
+ stem(&z, "itilib", "ble", m_gt_0);
131705
+ }
131619131706
break;
131620131707
}
131621131708
131622131709
/* Step 3 */
131623131710
switch( z[0] ){
131624131711
case 'e':
131625
- stem(&z, "etaci", "ic", m_gt_0) ||
131626
- stem(&z, "evita", "", m_gt_0) ||
131627
- stem(&z, "ezila", "al", m_gt_0);
131712
+ if( !stem(&z, "etaci", "ic", m_gt_0)
131713
+ && !stem(&z, "evita", "", m_gt_0)
131714
+ ){
131715
+ stem(&z, "ezila", "al", m_gt_0);
131716
+ }
131628131717
break;
131629131718
case 'i':
131630131719
stem(&z, "itici", "ic", m_gt_0);
131631131720
break;
131632131721
case 'l':
131633
- stem(&z, "laci", "ic", m_gt_0) ||
131634
- stem(&z, "luf", "", m_gt_0);
131722
+ if( !stem(&z, "laci", "ic", m_gt_0) ){
131723
+ stem(&z, "luf", "", m_gt_0);
131724
+ }
131635131725
break;
131636131726
case 's':
131637131727
stem(&z, "ssen", "", m_gt_0);
131638131728
break;
131639131729
}
@@ -131670,13 +131760,15 @@
131670131760
if( z[2]=='a' ){
131671131761
if( m_gt_1(z+3) ){
131672131762
z += 3;
131673131763
}
131674131764
}else if( z[2]=='e' ){
131675
- stem(&z, "tneme", "", m_gt_1) ||
131676
- stem(&z, "tnem", "", m_gt_1) ||
131677
- stem(&z, "tne", "", m_gt_1);
131765
+ if( !stem(&z, "tneme", "", m_gt_1)
131766
+ && !stem(&z, "tnem", "", m_gt_1)
131767
+ ){
131768
+ stem(&z, "tne", "", m_gt_1);
131769
+ }
131678131770
}
131679131771
}
131680131772
break;
131681131773
case 'o':
131682131774
if( z[0]=='u' ){
@@ -131691,12 +131783,13 @@
131691131783
if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
131692131784
z += 3;
131693131785
}
131694131786
break;
131695131787
case 't':
131696
- stem(&z, "eta", "", m_gt_1) ||
131697
- stem(&z, "iti", "", m_gt_1);
131788
+ if( !stem(&z, "eta", "", m_gt_1) ){
131789
+ stem(&z, "iti", "", m_gt_1);
131790
+ }
131698131791
break;
131699131792
case 'u':
131700131793
if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
131701131794
z += 3;
131702131795
}
131703131796
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -135,11 +135,11 @@
135 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136 ** [sqlite_version()] and [sqlite_source_id()].
137 */
138 #define SQLITE_VERSION "3.8.3"
139 #define SQLITE_VERSION_NUMBER 3008003
140 #define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2"
141
142 /*
143 ** CAPI3REF: Run-Time Library Version Numbers
144 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
145 **
@@ -9098,11 +9098,11 @@
9098 #define OP_String 25 /* synopsis: r[P2]='P4' (len=P1) */
9099 #define OP_Null 26 /* synopsis: r[P2..P3]=NULL */
9100 #define OP_Blob 27 /* synopsis: r[P2]=P4 (len=P1) */
9101 #define OP_Variable 28 /* synopsis: r[P2]=parameter(P1,P4) */
9102 #define OP_Move 29 /* synopsis: r[P2@P3]=r[P1@P3] */
9103 #define OP_Copy 30 /* synopsis: r[P2@P3]=r[P1@P3] */
9104 #define OP_SCopy 31 /* synopsis: r[P2]=r[P1] */
9105 #define OP_ResultRow 32 /* synopsis: output=r[P1@P2] */
9106 #define OP_CollSeq 33
9107 #define OP_AddImm 34 /* synopsis: r[P1]=r[P1]+P2 */
9108 #define OP_MustBeInt 35
@@ -9263,11 +9263,11 @@
9263
9264 /*
9265 ** Prototypes for the VDBE interface. See comments on the implementation
9266 ** for a description of what each of these routines does.
9267 */
9268 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(sqlite3*);
9269 SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int);
9270 SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int);
9271 SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
9272 SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
9273 SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
@@ -11003,10 +11003,11 @@
11003 u8 useSortingIdx; /* In direct mode, reference the sorting index rather
11004 ** than the source table */
11005 int sortingIdx; /* Cursor number of the sorting index */
11006 int sortingIdxPTab; /* Cursor number of pseudo-table */
11007 int nSortingColumn; /* Number of columns in the sorting index */
 
11008 ExprList *pGroupBy; /* The group by clause */
11009 struct AggInfo_col { /* For each column used in source tables */
11010 Table *pTab; /* Source table */
11011 int iTable; /* Cursor number of the source table */
11012 int iColumn; /* Column number within the source table */
@@ -12452,12 +12453,11 @@
12452 SQLITE_PRIVATE void sqlite3Error(sqlite3*, int, const char*,...);
12453 SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
12454 SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
12455 SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
12456
12457 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) || \
12458 defined(SQLITE_DEBUG_OS_TRACE)
12459 SQLITE_PRIVATE const char *sqlite3ErrName(int);
12460 #endif
12461
12462 SQLITE_PRIVATE const char *sqlite3ErrStr(int);
12463 SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
@@ -13776,10 +13776,13 @@
13776 Op *aOp; /* Space to hold the virtual machine's program */
13777 Mem *aMem; /* The memory locations */
13778 Mem **apArg; /* Arguments to currently executing user function */
13779 Mem *aColName; /* Column names to return */
13780 Mem *pResultSet; /* Pointer to an array of results */
 
 
 
13781 int nMem; /* Number of memory locations currently allocated */
13782 int nOp; /* Number of instructions in the program */
13783 int nOpAlloc; /* Number of slots allocated for aOp[] */
13784 int nLabel; /* Number of labels used */
13785 int *aLabel; /* Space to hold the labels */
@@ -15443,11 +15446,25 @@
15443 ** really care if the VFS receives and understands the information since it
15444 ** is only a hint and can be safely ignored. The sqlite3OsFileControlHint()
15445 ** routine has no return value since the return value would be meaningless.
15446 */
15447 SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
15448 DO_OS_MALLOC_TEST(id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15449 return id->pMethods->xFileControl(id, op, pArg);
15450 }
15451 SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){
15452 (void)id->pMethods->xFileControl(id, op, pArg);
15453 }
@@ -23098,11 +23115,11 @@
23098 /* 25 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
23099 /* 26 */ "Null" OpHelp("r[P2..P3]=NULL"),
23100 /* 27 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
23101 /* 28 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
23102 /* 29 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
23103 /* 30 */ "Copy" OpHelp("r[P2@P3]=r[P1@P3]"),
23104 /* 31 */ "SCopy" OpHelp("r[P2]=r[P1]"),
23105 /* 32 */ "ResultRow" OpHelp("output=r[P1@P2]"),
23106 /* 33 */ "CollSeq" OpHelp(""),
23107 /* 34 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
23108 /* 35 */ "MustBeInt" OpHelp(""),
@@ -61170,11 +61187,12 @@
61170 */
61171
61172 /*
61173 ** Create a new virtual database engine.
61174 */
61175 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(sqlite3 *db){
 
61176 Vdbe *p;
61177 p = sqlite3DbMallocZero(db, sizeof(Vdbe) );
61178 if( p==0 ) return 0;
61179 p->db = db;
61180 if( db->pVdbe ){
@@ -61182,10 +61200,13 @@
61182 }
61183 p->pNext = db->pVdbe;
61184 p->pPrev = 0;
61185 db->pVdbe = p;
61186 p->magic = VDBE_MAGIC_INIT;
 
 
 
61187 return p;
61188 }
61189
61190 /*
61191 ** Remember the SQL string for a prepared statement.
@@ -61301,10 +61322,19 @@
61301 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
61302 pOp->zComment = 0;
61303 #endif
61304 #ifdef SQLITE_DEBUG
61305 if( p->db->flags & SQLITE_VdbeAddopTrace ){
 
 
 
 
 
 
 
 
 
61306 sqlite3VdbePrintOp(0, i, &p->aOp[i]);
61307 test_addop_breakpoint();
61308 }
61309 #endif
61310 #ifdef VDBE_PROFILE
@@ -62022,11 +62052,21 @@
62022 if( c=='4' ) return pOp->p4.i;
62023 return pOp->p5;
62024 }
62025
62026 /*
62027 ** Compute a string for the "comment" field of a VDBE opcode listing
 
 
 
 
 
 
 
 
 
 
62028 */
62029 static int displayComment(
62030 const Op *pOp, /* The opcode to be commented */
62031 const char *zP4, /* Previously obtained value for P4 */
62032 char *zTemp, /* Write result here */
@@ -62056,11 +62096,17 @@
62056 sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1);
62057 if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){
62058 ii += 3;
62059 jj += sqlite3Strlen30(zTemp+jj);
62060 v2 = translateP(zSynopsis[ii], pOp);
62061 if( v2>1 ) sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1);
 
 
 
 
 
 
62062 }else if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){
62063 ii += 4;
62064 }
62065 }
62066 jj += sqlite3Strlen30(zTemp+jj);
@@ -62288,10 +62334,13 @@
62288 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
62289 displayComment(pOp, zP4, zCom, sizeof(zCom));
62290 #else
62291 zCom[0] = 0
62292 #endif
 
 
 
62293 fprintf(pOut, zFormat1, pc,
62294 sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,
62295 zCom
62296 );
62297 fflush(pOut);
@@ -67348,11 +67397,11 @@
67348 }while( n-- );
67349 break;
67350 }
67351
67352 /* Opcode: Copy P1 P2 P3 * *
67353 ** Synopsis: r[P2@P3]=r[P1@P3]
67354 **
67355 ** Make a copy of registers P1..P1+P3 into registers P2..P2+P3.
67356 **
67357 ** This instruction makes a deep copy of the value. A duplicate
67358 ** is made of any string or blob constant. See also OP_SCopy.
@@ -68691,11 +68740,11 @@
68691 /* This is the common case where the desired content fits on the original
68692 ** page - where the content is not on an overflow page */
68693 VdbeMemRelease(pDest);
68694 sqlite3VdbeSerialGet(pC->aRow+aOffset[p2], aType[p2], pDest);
68695 }else{
68696 /* This branch happens only when content is on overflow pages */
68697 t = aType[p2];
68698 if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
68699 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))
68700 || (len = sqlite3VdbeSerialTypeLen(t))==0
68701 ){
@@ -72809,11 +72858,11 @@
72809 sqlite3BtreeLeaveAll(db);
72810 goto blob_open_out;
72811 }
72812 }
72813
72814 pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(db);
72815 assert( pBlob->pStmt || db->mallocFailed );
72816 if( pBlob->pStmt ){
72817 Vdbe *v = (Vdbe *)pBlob->pStmt;
72818 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
72819
@@ -78363,10 +78412,15 @@
78363 ** added to the column cache after this call are removed when the
78364 ** corresponding pop occurs.
78365 */
78366 SQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){
78367 pParse->iCacheLevel++;
 
 
 
 
 
78368 }
78369
78370 /*
78371 ** Remove from the column cache any entries that were added since the
78372 ** the previous N Push operations. In other words, restore the cache
@@ -78376,10 +78430,15 @@
78376 int i;
78377 struct yColCache *p;
78378 assert( N>0 );
78379 assert( pParse->iCacheLevel>=N );
78380 pParse->iCacheLevel -= N;
 
 
 
 
 
78381 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
78382 if( p->iReg && p->iLevel>pParse->iCacheLevel ){
78383 cacheEntryClear(pParse, p);
78384 p->iReg = 0;
78385 }
@@ -78470,10 +78529,15 @@
78470 */
78471 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
78472 int i;
78473 struct yColCache *p;
78474
 
 
 
 
 
78475 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
78476 if( p->iReg ){
78477 cacheEntryClear(pParse, p);
78478 p->iReg = 0;
78479 }
@@ -79606,11 +79670,21 @@
79606 if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){
79607 sqlite3ExprCodeAtInit(pParse, pExpr, target+i, 0);
79608 }else{
79609 int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
79610 if( inReg!=target+i ){
79611 sqlite3VdbeAddOp2(pParse->pVdbe, copyOp, inReg, target+i);
 
 
 
 
 
 
 
 
 
 
79612 }
79613 }
79614 }
79615 return n;
79616 }
@@ -83030,14 +83104,10 @@
83030 {
83031 int rc = SQLITE_OK;
83032 if( pExpr ){
83033 if( pExpr->op!=TK_ID ){
83034 rc = sqlite3ResolveExprNames(pName, pExpr);
83035 if( rc==SQLITE_OK && !sqlite3ExprIsConstant(pExpr) ){
83036 sqlite3ErrorMsg(pName->pParse, "invalid name: \"%s\"", pExpr->u.zToken);
83037 return SQLITE_ERROR;
83038 }
83039 }else{
83040 pExpr->op = TK_STRING;
83041 }
83042 }
83043 return rc;
@@ -89271,11 +89341,10 @@
89271 Vdbe *v = pParse->pVdbe;
89272 int j;
89273 Table *pTab = pIdx->pTable;
89274 int regBase;
89275 int nCol;
89276 Index *pPk;
89277
89278 if( piPartIdxLabel ){
89279 if( pIdx->pPartIdxWhere ){
89280 *piPartIdxLabel = sqlite3VdbeMakeLabel(v);
89281 pParse->iPartIdxTab = iDataCur;
@@ -89285,20 +89354,13 @@
89285 *piPartIdxLabel = 0;
89286 }
89287 }
89288 nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
89289 regBase = sqlite3GetTempRange(pParse, nCol);
89290 pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
89291 for(j=0; j<nCol; j++){
89292 i16 idx = pIdx->aiColumn[j];
89293 if( pPk ) idx = sqlite3ColumnOfIndex(pPk, idx);
89294 if( idx<0 || idx==pTab->iPKey ){
89295 sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regBase+j);
89296 }else{
89297 sqlite3VdbeAddOp3(v, OP_Column, iDataCur, idx, regBase+j);
89298 sqlite3ColumnDefault(v, pTab, pIdx->aiColumn[j], -1);
89299 }
89300 }
89301 if( regOut ){
89302 const char *zAff;
89303 if( pTab->pSelect
89304 || OptimizationDisabled(pParse->db, SQLITE_IdxRealAsInt)
@@ -93929,51 +93991,53 @@
93929 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
93930 regIdx, pIdx->nKeyCol);
93931
93932 /* Generate code to handle collisions */
93933 regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
93934 if( HasRowid(pTab) ){
93935 sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
93936 /* Conflict only if the rowid of the existing index entry
93937 ** is different from old-rowid */
93938 if( isUpdate ){
93939 sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
93940 }
93941 }else{
93942 int x;
93943 /* Extract the PRIMARY KEY from the end of the index entry and
93944 ** store it in registers regR..regR+nPk-1 */
93945 if( (isUpdate || onError==OE_Replace) && pIdx!=pPk ){
93946 for(i=0; i<pPk->nKeyCol; i++){
93947 x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
93948 sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);
93949 VdbeComment((v, "%s.%s", pTab->zName,
93950 pTab->aCol[pPk->aiColumn[i]].zName));
93951 }
93952 }
93953 if( isUpdate ){
93954 /* If currently processing the PRIMARY KEY of a WITHOUT ROWID
93955 ** table, only conflict if the new PRIMARY KEY values are actually
93956 ** different from the old.
93957 **
93958 ** For a UNIQUE index, only conflict if the PRIMARY KEY values
93959 ** of the matched index row are different from the original PRIMARY
93960 ** KEY values of this row before the update. */
93961 int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;
93962 int op = OP_Ne;
93963 int regCmp = (pIdx->autoIndex==2 ? regIdx : regR);
93964
93965 for(i=0; i<pPk->nKeyCol; i++){
93966 char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);
93967 x = pPk->aiColumn[i];
93968 if( i==(pPk->nKeyCol-1) ){
93969 addrJump = addrUniqueOk;
93970 op = OP_Eq;
93971 }
93972 sqlite3VdbeAddOp4(v, op,
93973 regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ
93974 );
 
 
93975 }
93976 }
93977 }
93978
93979 /* Generate code that executes if the new index entry is not unique */
@@ -99669,11 +99733,10 @@
99669 }
99670 }else if( eDest!=SRT_Exists ){
99671 /* If the destination is an EXISTS(...) expression, the actual
99672 ** values returned by the SELECT are not required.
99673 */
99674 sqlite3ExprCacheClear(pParse);
99675 sqlite3ExprCodeExprList(pParse, pEList, regResult,
99676 (eDest==SRT_Output)?SQLITE_ECEL_DUP:0);
99677 }
99678 nColumn = nResultCol;
99679
@@ -100636,11 +100699,11 @@
100636 ** If an error occurs, return NULL and leave a message in pParse.
100637 */
100638 SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){
100639 Vdbe *v = pParse->pVdbe;
100640 if( v==0 ){
100641 v = pParse->pVdbe = sqlite3VdbeCreate(pParse->db);
100642 #ifndef SQLITE_OMIT_TRACE
100643 if( v ){
100644 sqlite3VdbeAddOp0(v, OP_Trace);
100645 }
100646 #endif
@@ -102894,18 +102957,27 @@
102894 */
102895 static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){
102896 Vdbe *v = pParse->pVdbe;
102897 int i;
102898 struct AggInfo_func *pFunc;
102899 if( pAggInfo->nFunc+pAggInfo->nColumn==0 ){
102900 return;
102901 }
 
 
 
102902 for(i=0; i<pAggInfo->nColumn; i++){
102903 sqlite3VdbeAddOp2(v, OP_Null, 0, pAggInfo->aCol[i].iMem);
 
102904 }
 
 
 
 
 
 
102905 for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){
102906 sqlite3VdbeAddOp2(v, OP_Null, 0, pFunc->iMem);
102907 if( pFunc->iDistinct>=0 ){
102908 Expr *pE = pFunc->pExpr;
102909 assert( !ExprHasProperty(pE, EP_xIsSelect) );
102910 if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){
102911 sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one "
@@ -102947,11 +103019,10 @@
102947 int addrHitTest = 0;
102948 struct AggInfo_func *pF;
102949 struct AggInfo_col *pC;
102950
102951 pAggInfo->directMode = 1;
102952 sqlite3ExprCacheClear(pParse);
102953 for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
102954 int nArg;
102955 int addrNext = 0;
102956 int regAgg;
102957 ExprList *pList = pF->pExpr->x.pList;
@@ -103480,10 +103551,11 @@
103480 */
103481 memset(&sNC, 0, sizeof(sNC));
103482 sNC.pParse = pParse;
103483 sNC.pSrcList = pTabList;
103484 sNC.pAggInfo = &sAggInfo;
 
103485 sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0;
103486 sAggInfo.pGroupBy = pGroupBy;
103487 sqlite3ExprAnalyzeAggList(&sNC, pEList);
103488 sqlite3ExprAnalyzeAggList(&sNC, pOrderBy);
103489 if( pHaving ){
@@ -103494,10 +103566,11 @@
103494 assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );
103495 sNC.ncFlags |= NC_InAggFunc;
103496 sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);
103497 sNC.ncFlags &= ~NC_InAggFunc;
103498 }
 
103499 if( db->mallocFailed ) goto select_end;
103500
103501 /* Processing for aggregates with GROUP BY is very different and
103502 ** much more complex than aggregates without a GROUP BY.
103503 */
@@ -105398,11 +105471,11 @@
105398 pCol->affinity, &pValue);
105399 if( pValue ){
105400 sqlite3VdbeChangeP4(v, -1, (const char *)pValue, P4_MEM);
105401 }
105402 #ifndef SQLITE_OMIT_FLOATING_POINT
105403 if( iReg>=0 && pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
105404 sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg);
105405 }
105406 #endif
105407 }
105408 }
@@ -105822,14 +105895,14 @@
105822 ** be used eliminates some redundant opcodes.
105823 */
105824 newmask = sqlite3TriggerColmask(
105825 pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError
105826 );
105827 sqlite3VdbeAddOp3(v, OP_Null, 0, regNew, regNew+pTab->nCol-1);
105828 for(i=0; i<pTab->nCol; i++){
105829 if( i==pTab->iPKey ){
105830 /*sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);*/
105831 }else{
105832 j = aXRef[i];
105833 if( j>=0 ){
105834 sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i);
105835 }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask&(1<<i)) ){
@@ -105839,10 +105912,12 @@
105839 ** a new.* reference in a trigger program.
105840 */
105841 testcase( i==31 );
105842 testcase( i==32 );
105843 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
 
 
105844 }
105845 }
105846 }
105847
105848 /* Fire any BEFORE UPDATE triggers. This happens before constraints are
@@ -111951,10 +112026,11 @@
111951 */
111952 if( pTerm==0
111953 && saved_nEq==saved_nSkip
111954 && saved_nEq+1<pProbe->nKeyCol
111955 && pProbe->aiRowEst[saved_nEq+1]>=18 /* TUNING: Minimum for skip-scan */
 
111956 ){
111957 LogEst nIter;
111958 pNew->u.btree.nEq++;
111959 pNew->u.btree.nSkip++;
111960 pNew->aLTerm[pNew->nLTerm++] = 0;
@@ -119669,12 +119745,11 @@
119669
119670 /*
119671 ** Return a static string containing the name corresponding to the error code
119672 ** specified in the argument.
119673 */
119674 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) || \
119675 defined(SQLITE_DEBUG_OS_TRACE)
119676 SQLITE_PRIVATE const char *sqlite3ErrName(int rc){
119677 const char *zName = 0;
119678 int i, origRc = rc;
119679 for(i=0; i<2 && zName==0; i++, rc &= 0xff){
119680 switch( rc ){
@@ -121247,10 +121322,12 @@
121247 #ifdef SQLITE_DEFAULT_LOCKING_MODE
121248 db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;
121249 sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
121250 SQLITE_DEFAULT_LOCKING_MODE);
121251 #endif
 
 
121252
121253 /* Enable the lookaside-malloc subsystem */
121254 setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,
121255 sqlite3GlobalConfig.nLookaside);
121256
@@ -131579,61 +131656,74 @@
131579 }
131580
131581 /* Step 2 */
131582 switch( z[1] ){
131583 case 'a':
131584 stem(&z, "lanoita", "ate", m_gt_0) ||
131585 stem(&z, "lanoit", "tion", m_gt_0);
 
131586 break;
131587 case 'c':
131588 stem(&z, "icne", "ence", m_gt_0) ||
131589 stem(&z, "icna", "ance", m_gt_0);
 
131590 break;
131591 case 'e':
131592 stem(&z, "rezi", "ize", m_gt_0);
131593 break;
131594 case 'g':
131595 stem(&z, "igol", "log", m_gt_0);
131596 break;
131597 case 'l':
131598 stem(&z, "ilb", "ble", m_gt_0) ||
131599 stem(&z, "illa", "al", m_gt_0) ||
131600 stem(&z, "iltne", "ent", m_gt_0) ||
131601 stem(&z, "ile", "e", m_gt_0) ||
131602 stem(&z, "ilsuo", "ous", m_gt_0);
 
 
131603 break;
131604 case 'o':
131605 stem(&z, "noitazi", "ize", m_gt_0) ||
131606 stem(&z, "noita", "ate", m_gt_0) ||
131607 stem(&z, "rota", "ate", m_gt_0);
 
 
131608 break;
131609 case 's':
131610 stem(&z, "msila", "al", m_gt_0) ||
131611 stem(&z, "ssenevi", "ive", m_gt_0) ||
131612 stem(&z, "ssenluf", "ful", m_gt_0) ||
131613 stem(&z, "ssensuo", "ous", m_gt_0);
 
 
131614 break;
131615 case 't':
131616 stem(&z, "itila", "al", m_gt_0) ||
131617 stem(&z, "itivi", "ive", m_gt_0) ||
131618 stem(&z, "itilib", "ble", m_gt_0);
 
 
131619 break;
131620 }
131621
131622 /* Step 3 */
131623 switch( z[0] ){
131624 case 'e':
131625 stem(&z, "etaci", "ic", m_gt_0) ||
131626 stem(&z, "evita", "", m_gt_0) ||
131627 stem(&z, "ezila", "al", m_gt_0);
 
 
131628 break;
131629 case 'i':
131630 stem(&z, "itici", "ic", m_gt_0);
131631 break;
131632 case 'l':
131633 stem(&z, "laci", "ic", m_gt_0) ||
131634 stem(&z, "luf", "", m_gt_0);
 
131635 break;
131636 case 's':
131637 stem(&z, "ssen", "", m_gt_0);
131638 break;
131639 }
@@ -131670,13 +131760,15 @@
131670 if( z[2]=='a' ){
131671 if( m_gt_1(z+3) ){
131672 z += 3;
131673 }
131674 }else if( z[2]=='e' ){
131675 stem(&z, "tneme", "", m_gt_1) ||
131676 stem(&z, "tnem", "", m_gt_1) ||
131677 stem(&z, "tne", "", m_gt_1);
 
 
131678 }
131679 }
131680 break;
131681 case 'o':
131682 if( z[0]=='u' ){
@@ -131691,12 +131783,13 @@
131691 if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
131692 z += 3;
131693 }
131694 break;
131695 case 't':
131696 stem(&z, "eta", "", m_gt_1) ||
131697 stem(&z, "iti", "", m_gt_1);
 
131698 break;
131699 case 'u':
131700 if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
131701 z += 3;
131702 }
131703
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -135,11 +135,11 @@
135 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
136 ** [sqlite_version()] and [sqlite_source_id()].
137 */
138 #define SQLITE_VERSION "3.8.3"
139 #define SQLITE_VERSION_NUMBER 3008003
140 #define SQLITE_SOURCE_ID "2013-12-23 11:33:32 25b8a1c9ba77df3b7c78cbce922cb593d661696d"
141
142 /*
143 ** CAPI3REF: Run-Time Library Version Numbers
144 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
145 **
@@ -9098,11 +9098,11 @@
9098 #define OP_String 25 /* synopsis: r[P2]='P4' (len=P1) */
9099 #define OP_Null 26 /* synopsis: r[P2..P3]=NULL */
9100 #define OP_Blob 27 /* synopsis: r[P2]=P4 (len=P1) */
9101 #define OP_Variable 28 /* synopsis: r[P2]=parameter(P1,P4) */
9102 #define OP_Move 29 /* synopsis: r[P2@P3]=r[P1@P3] */
9103 #define OP_Copy 30 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
9104 #define OP_SCopy 31 /* synopsis: r[P2]=r[P1] */
9105 #define OP_ResultRow 32 /* synopsis: output=r[P1@P2] */
9106 #define OP_CollSeq 33
9107 #define OP_AddImm 34 /* synopsis: r[P1]=r[P1]+P2 */
9108 #define OP_MustBeInt 35
@@ -9263,11 +9263,11 @@
9263
9264 /*
9265 ** Prototypes for the VDBE interface. See comments on the implementation
9266 ** for a description of what each of these routines does.
9267 */
9268 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*);
9269 SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int);
9270 SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int);
9271 SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
9272 SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
9273 SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
@@ -11003,10 +11003,11 @@
11003 u8 useSortingIdx; /* In direct mode, reference the sorting index rather
11004 ** than the source table */
11005 int sortingIdx; /* Cursor number of the sorting index */
11006 int sortingIdxPTab; /* Cursor number of pseudo-table */
11007 int nSortingColumn; /* Number of columns in the sorting index */
11008 int mnReg, mxReg; /* Range of registers allocated for aCol and aFunc */
11009 ExprList *pGroupBy; /* The group by clause */
11010 struct AggInfo_col { /* For each column used in source tables */
11011 Table *pTab; /* Source table */
11012 int iTable; /* Cursor number of the source table */
11013 int iColumn; /* Column number within the source table */
@@ -12452,12 +12453,11 @@
12453 SQLITE_PRIVATE void sqlite3Error(sqlite3*, int, const char*,...);
12454 SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
12455 SQLITE_PRIVATE u8 sqlite3HexToInt(int h);
12456 SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
12457
12458 #if defined(SQLITE_TEST)
 
12459 SQLITE_PRIVATE const char *sqlite3ErrName(int);
12460 #endif
12461
12462 SQLITE_PRIVATE const char *sqlite3ErrStr(int);
12463 SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
@@ -13776,10 +13776,13 @@
13776 Op *aOp; /* Space to hold the virtual machine's program */
13777 Mem *aMem; /* The memory locations */
13778 Mem **apArg; /* Arguments to currently executing user function */
13779 Mem *aColName; /* Column names to return */
13780 Mem *pResultSet; /* Pointer to an array of results */
13781 #ifdef SQLITE_DEBUG
13782 Parse *pParse; /* Parsing context used to create this Vdbe */
13783 #endif
13784 int nMem; /* Number of memory locations currently allocated */
13785 int nOp; /* Number of instructions in the program */
13786 int nOpAlloc; /* Number of slots allocated for aOp[] */
13787 int nLabel; /* Number of labels used */
13788 int *aLabel; /* Space to hold the labels */
@@ -15443,11 +15446,25 @@
15446 ** really care if the VFS receives and understands the information since it
15447 ** is only a hint and can be safely ignored. The sqlite3OsFileControlHint()
15448 ** routine has no return value since the return value would be meaningless.
15449 */
15450 SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
15451 #ifdef SQLITE_TEST
15452 if( op!=SQLITE_FCNTL_COMMIT_PHASETWO ){
15453 /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
15454 ** is using a regular VFS, it is called after the corresponding
15455 ** transaction has been committed. Injecting a fault at this point
15456 ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
15457 ** but the transaction is committed anyway.
15458 **
15459 ** The core must call OsFileControl() though, not OsFileControlHint(),
15460 ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
15461 ** means the commit really has failed and an error should be returned
15462 ** to the user. */
15463 DO_OS_MALLOC_TEST(id);
15464 }
15465 #endif
15466 return id->pMethods->xFileControl(id, op, pArg);
15467 }
15468 SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){
15469 (void)id->pMethods->xFileControl(id, op, pArg);
15470 }
@@ -23098,11 +23115,11 @@
23115 /* 25 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
23116 /* 26 */ "Null" OpHelp("r[P2..P3]=NULL"),
23117 /* 27 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
23118 /* 28 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
23119 /* 29 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
23120 /* 30 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
23121 /* 31 */ "SCopy" OpHelp("r[P2]=r[P1]"),
23122 /* 32 */ "ResultRow" OpHelp("output=r[P1@P2]"),
23123 /* 33 */ "CollSeq" OpHelp(""),
23124 /* 34 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
23125 /* 35 */ "MustBeInt" OpHelp(""),
@@ -61170,11 +61187,12 @@
61187 */
61188
61189 /*
61190 ** Create a new virtual database engine.
61191 */
61192 SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
61193 sqlite3 *db = pParse->db;
61194 Vdbe *p;
61195 p = sqlite3DbMallocZero(db, sizeof(Vdbe) );
61196 if( p==0 ) return 0;
61197 p->db = db;
61198 if( db->pVdbe ){
@@ -61182,10 +61200,13 @@
61200 }
61201 p->pNext = db->pVdbe;
61202 p->pPrev = 0;
61203 db->pVdbe = p;
61204 p->magic = VDBE_MAGIC_INIT;
61205 #if SQLITE_DEBUG
61206 p->pParse = pParse;
61207 #endif
61208 return p;
61209 }
61210
61211 /*
61212 ** Remember the SQL string for a prepared statement.
@@ -61301,10 +61322,19 @@
61322 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
61323 pOp->zComment = 0;
61324 #endif
61325 #ifdef SQLITE_DEBUG
61326 if( p->db->flags & SQLITE_VdbeAddopTrace ){
61327 int jj, kk;
61328 Parse *pParse = p->pParse;
61329 for(jj=kk=0; jj<SQLITE_N_COLCACHE; jj++){
61330 struct yColCache *x = pParse->aColCache + jj;
61331 if( x->iLevel>pParse->iCacheLevel || x->iReg==0 ) continue;
61332 printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn);
61333 kk++;
61334 }
61335 if( kk ) printf("\n");
61336 sqlite3VdbePrintOp(0, i, &p->aOp[i]);
61337 test_addop_breakpoint();
61338 }
61339 #endif
61340 #ifdef VDBE_PROFILE
@@ -62022,11 +62052,21 @@
62052 if( c=='4' ) return pOp->p4.i;
62053 return pOp->p5;
62054 }
62055
62056 /*
62057 ** Compute a string for the "comment" field of a VDBE opcode listing.
62058 **
62059 ** The Synopsis: field in comments in the vdbe.c source file gets converted
62060 ** to an extra string that is appended to the sqlite3OpcodeName(). In the
62061 ** absence of other comments, this synopsis becomes the comment on the opcode.
62062 ** Some translation occurs:
62063 **
62064 ** "PX" -> "r[X]"
62065 ** "PX@PY" -> "r[X..X+Y-1]" or "r[x]" if y is 0 or 1
62066 ** "PX@PY+1" -> "r[X..X+Y]" or "r[x]" if y is 0
62067 ** "PY..PY" -> "r[X..Y]" or "r[x]" if y<=x
62068 */
62069 static int displayComment(
62070 const Op *pOp, /* The opcode to be commented */
62071 const char *zP4, /* Previously obtained value for P4 */
62072 char *zTemp, /* Write result here */
@@ -62056,11 +62096,17 @@
62096 sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1);
62097 if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){
62098 ii += 3;
62099 jj += sqlite3Strlen30(zTemp+jj);
62100 v2 = translateP(zSynopsis[ii], pOp);
62101 if( strncmp(zSynopsis+ii+1,"+1",2)==0 ){
62102 ii += 2;
62103 v2++;
62104 }
62105 if( v2>1 ){
62106 sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1);
62107 }
62108 }else if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){
62109 ii += 4;
62110 }
62111 }
62112 jj += sqlite3Strlen30(zTemp+jj);
@@ -62288,10 +62334,13 @@
62334 #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
62335 displayComment(pOp, zP4, zCom, sizeof(zCom));
62336 #else
62337 zCom[0] = 0
62338 #endif
62339 /* NB: The sqlite3OpcodeName() function is implemented by code created
62340 ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the
62341 ** information from the vdbe.c source text */
62342 fprintf(pOut, zFormat1, pc,
62343 sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,
62344 zCom
62345 );
62346 fflush(pOut);
@@ -67348,11 +67397,11 @@
67397 }while( n-- );
67398 break;
67399 }
67400
67401 /* Opcode: Copy P1 P2 P3 * *
67402 ** Synopsis: r[P2@P3+1]=r[P1@P3+1]
67403 **
67404 ** Make a copy of registers P1..P1+P3 into registers P2..P2+P3.
67405 **
67406 ** This instruction makes a deep copy of the value. A duplicate
67407 ** is made of any string or blob constant. See also OP_SCopy.
@@ -68691,11 +68740,11 @@
68740 /* This is the common case where the desired content fits on the original
68741 ** page - where the content is not on an overflow page */
68742 VdbeMemRelease(pDest);
68743 sqlite3VdbeSerialGet(pC->aRow+aOffset[p2], aType[p2], pDest);
68744 }else{
68745 /* This branch happens only when content is on overflow pages */
68746 t = aType[p2];
68747 if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0
68748 && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0))
68749 || (len = sqlite3VdbeSerialTypeLen(t))==0
68750 ){
@@ -72809,11 +72858,11 @@
72858 sqlite3BtreeLeaveAll(db);
72859 goto blob_open_out;
72860 }
72861 }
72862
72863 pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(pParse);
72864 assert( pBlob->pStmt || db->mallocFailed );
72865 if( pBlob->pStmt ){
72866 Vdbe *v = (Vdbe *)pBlob->pStmt;
72867 int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
72868
@@ -78363,10 +78412,15 @@
78412 ** added to the column cache after this call are removed when the
78413 ** corresponding pop occurs.
78414 */
78415 SQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){
78416 pParse->iCacheLevel++;
78417 #ifdef SQLITE_DEBUG
78418 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
78419 printf("PUSH to %d\n", pParse->iCacheLevel);
78420 }
78421 #endif
78422 }
78423
78424 /*
78425 ** Remove from the column cache any entries that were added since the
78426 ** the previous N Push operations. In other words, restore the cache
@@ -78376,10 +78430,15 @@
78430 int i;
78431 struct yColCache *p;
78432 assert( N>0 );
78433 assert( pParse->iCacheLevel>=N );
78434 pParse->iCacheLevel -= N;
78435 #ifdef SQLITE_DEBUG
78436 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
78437 printf("POP to %d\n", pParse->iCacheLevel);
78438 }
78439 #endif
78440 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
78441 if( p->iReg && p->iLevel>pParse->iCacheLevel ){
78442 cacheEntryClear(pParse, p);
78443 p->iReg = 0;
78444 }
@@ -78470,10 +78529,15 @@
78529 */
78530 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
78531 int i;
78532 struct yColCache *p;
78533
78534 #if SQLITE_DEBUG
78535 if( pParse->db->flags & SQLITE_VdbeAddopTrace ){
78536 printf("CLEAR\n");
78537 }
78538 #endif
78539 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){
78540 if( p->iReg ){
78541 cacheEntryClear(pParse, p);
78542 p->iReg = 0;
78543 }
@@ -79606,11 +79670,21 @@
79670 if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){
79671 sqlite3ExprCodeAtInit(pParse, pExpr, target+i, 0);
79672 }else{
79673 int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i);
79674 if( inReg!=target+i ){
79675 VdbeOp *pOp;
79676 Vdbe *v = pParse->pVdbe;
79677 if( copyOp==OP_Copy
79678 && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy
79679 && pOp->p1+pOp->p3+1==inReg
79680 && pOp->p2+pOp->p3+1==target+i
79681 ){
79682 pOp->p3++;
79683 }else{
79684 sqlite3VdbeAddOp2(v, copyOp, inReg, target+i);
79685 }
79686 }
79687 }
79688 }
79689 return n;
79690 }
@@ -83030,14 +83104,10 @@
83104 {
83105 int rc = SQLITE_OK;
83106 if( pExpr ){
83107 if( pExpr->op!=TK_ID ){
83108 rc = sqlite3ResolveExprNames(pName, pExpr);
 
 
 
 
83109 }else{
83110 pExpr->op = TK_STRING;
83111 }
83112 }
83113 return rc;
@@ -89271,11 +89341,10 @@
89341 Vdbe *v = pParse->pVdbe;
89342 int j;
89343 Table *pTab = pIdx->pTable;
89344 int regBase;
89345 int nCol;
 
89346
89347 if( piPartIdxLabel ){
89348 if( pIdx->pPartIdxWhere ){
89349 *piPartIdxLabel = sqlite3VdbeMakeLabel(v);
89350 pParse->iPartIdxTab = iDataCur;
@@ -89285,20 +89354,13 @@
89354 *piPartIdxLabel = 0;
89355 }
89356 }
89357 nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
89358 regBase = sqlite3GetTempRange(pParse, nCol);
 
89359 for(j=0; j<nCol; j++){
89360 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pIdx->aiColumn[j],
89361 regBase+j);
 
 
 
 
 
 
89362 }
89363 if( regOut ){
89364 const char *zAff;
89365 if( pTab->pSelect
89366 || OptimizationDisabled(pParse->db, SQLITE_IdxRealAsInt)
@@ -93929,51 +93991,53 @@
93991 sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
93992 regIdx, pIdx->nKeyCol);
93993
93994 /* Generate code to handle collisions */
93995 regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField);
93996 if( isUpdate || onError==OE_Replace ){
93997 if( HasRowid(pTab) ){
93998 sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
93999 /* Conflict only if the rowid of the existing index entry
94000 ** is different from old-rowid */
94001 if( isUpdate ){
94002 sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
94003 }
94004 }else{
94005 int x;
94006 /* Extract the PRIMARY KEY from the end of the index entry and
94007 ** store it in registers regR..regR+nPk-1 */
94008 if( pIdx!=pPk ){
94009 for(i=0; i<pPk->nKeyCol; i++){
94010 x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]);
94011 sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i);
94012 VdbeComment((v, "%s.%s", pTab->zName,
94013 pTab->aCol[pPk->aiColumn[i]].zName));
94014 }
94015 }
94016 if( isUpdate ){
94017 /* If currently processing the PRIMARY KEY of a WITHOUT ROWID
94018 ** table, only conflict if the new PRIMARY KEY values are actually
94019 ** different from the old.
94020 **
94021 ** For a UNIQUE index, only conflict if the PRIMARY KEY values
94022 ** of the matched index row are different from the original PRIMARY
94023 ** KEY values of this row before the update. */
94024 int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol;
94025 int op = OP_Ne;
94026 int regCmp = (pIdx->autoIndex==2 ? regIdx : regR);
94027
94028 for(i=0; i<pPk->nKeyCol; i++){
94029 char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]);
94030 x = pPk->aiColumn[i];
94031 if( i==(pPk->nKeyCol-1) ){
94032 addrJump = addrUniqueOk;
94033 op = OP_Eq;
94034 }
94035 sqlite3VdbeAddOp4(v, op,
94036 regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ
94037 );
94038 }
94039 }
94040 }
94041 }
94042
94043 /* Generate code that executes if the new index entry is not unique */
@@ -99669,11 +99733,10 @@
99733 }
99734 }else if( eDest!=SRT_Exists ){
99735 /* If the destination is an EXISTS(...) expression, the actual
99736 ** values returned by the SELECT are not required.
99737 */
 
99738 sqlite3ExprCodeExprList(pParse, pEList, regResult,
99739 (eDest==SRT_Output)?SQLITE_ECEL_DUP:0);
99740 }
99741 nColumn = nResultCol;
99742
@@ -100636,11 +100699,11 @@
100699 ** If an error occurs, return NULL and leave a message in pParse.
100700 */
100701 SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){
100702 Vdbe *v = pParse->pVdbe;
100703 if( v==0 ){
100704 v = pParse->pVdbe = sqlite3VdbeCreate(pParse);
100705 #ifndef SQLITE_OMIT_TRACE
100706 if( v ){
100707 sqlite3VdbeAddOp0(v, OP_Trace);
100708 }
100709 #endif
@@ -102894,18 +102957,27 @@
102957 */
102958 static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){
102959 Vdbe *v = pParse->pVdbe;
102960 int i;
102961 struct AggInfo_func *pFunc;
102962 int nReg = pAggInfo->nFunc + pAggInfo->nColumn;
102963 if( nReg==0 ) return;
102964 #ifdef SQLITE_DEBUG
102965 /* Verify that all AggInfo registers are within the range specified by
102966 ** AggInfo.mnReg..AggInfo.mxReg */
102967 assert( nReg==pAggInfo->mxReg-pAggInfo->mnReg+1 );
102968 for(i=0; i<pAggInfo->nColumn; i++){
102969 assert( pAggInfo->aCol[i].iMem>=pAggInfo->mnReg
102970 && pAggInfo->aCol[i].iMem<=pAggInfo->mxReg );
102971 }
102972 for(i=0; i<pAggInfo->nFunc; i++){
102973 assert( pAggInfo->aFunc[i].iMem>=pAggInfo->mnReg
102974 && pAggInfo->aFunc[i].iMem<=pAggInfo->mxReg );
102975 }
102976 #endif
102977 sqlite3VdbeAddOp3(v, OP_Null, 0, pAggInfo->mnReg, pAggInfo->mxReg);
102978 for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){
 
102979 if( pFunc->iDistinct>=0 ){
102980 Expr *pE = pFunc->pExpr;
102981 assert( !ExprHasProperty(pE, EP_xIsSelect) );
102982 if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){
102983 sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one "
@@ -102947,11 +103019,10 @@
103019 int addrHitTest = 0;
103020 struct AggInfo_func *pF;
103021 struct AggInfo_col *pC;
103022
103023 pAggInfo->directMode = 1;
 
103024 for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
103025 int nArg;
103026 int addrNext = 0;
103027 int regAgg;
103028 ExprList *pList = pF->pExpr->x.pList;
@@ -103480,10 +103551,11 @@
103551 */
103552 memset(&sNC, 0, sizeof(sNC));
103553 sNC.pParse = pParse;
103554 sNC.pSrcList = pTabList;
103555 sNC.pAggInfo = &sAggInfo;
103556 sAggInfo.mnReg = pParse->nMem+1;
103557 sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0;
103558 sAggInfo.pGroupBy = pGroupBy;
103559 sqlite3ExprAnalyzeAggList(&sNC, pEList);
103560 sqlite3ExprAnalyzeAggList(&sNC, pOrderBy);
103561 if( pHaving ){
@@ -103494,10 +103566,11 @@
103566 assert( !ExprHasProperty(sAggInfo.aFunc[i].pExpr, EP_xIsSelect) );
103567 sNC.ncFlags |= NC_InAggFunc;
103568 sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->x.pList);
103569 sNC.ncFlags &= ~NC_InAggFunc;
103570 }
103571 sAggInfo.mxReg = pParse->nMem;
103572 if( db->mallocFailed ) goto select_end;
103573
103574 /* Processing for aggregates with GROUP BY is very different and
103575 ** much more complex than aggregates without a GROUP BY.
103576 */
@@ -105398,11 +105471,11 @@
105471 pCol->affinity, &pValue);
105472 if( pValue ){
105473 sqlite3VdbeChangeP4(v, -1, (const char *)pValue, P4_MEM);
105474 }
105475 #ifndef SQLITE_OMIT_FLOATING_POINT
105476 if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
105477 sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg);
105478 }
105479 #endif
105480 }
105481 }
@@ -105822,14 +105895,14 @@
105895 ** be used eliminates some redundant opcodes.
105896 */
105897 newmask = sqlite3TriggerColmask(
105898 pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError
105899 );
105900 /*sqlite3VdbeAddOp3(v, OP_Null, 0, regNew, regNew+pTab->nCol-1);*/
105901 for(i=0; i<pTab->nCol; i++){
105902 if( i==pTab->iPKey ){
105903 sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
105904 }else{
105905 j = aXRef[i];
105906 if( j>=0 ){
105907 sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i);
105908 }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask&(1<<i)) ){
@@ -105839,10 +105912,12 @@
105912 ** a new.* reference in a trigger program.
105913 */
105914 testcase( i==31 );
105915 testcase( i==32 );
105916 sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i);
105917 }else{
105918 sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i);
105919 }
105920 }
105921 }
105922
105923 /* Fire any BEFORE UPDATE triggers. This happens before constraints are
@@ -111951,10 +112026,11 @@
112026 */
112027 if( pTerm==0
112028 && saved_nEq==saved_nSkip
112029 && saved_nEq+1<pProbe->nKeyCol
112030 && pProbe->aiRowEst[saved_nEq+1]>=18 /* TUNING: Minimum for skip-scan */
112031 && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK
112032 ){
112033 LogEst nIter;
112034 pNew->u.btree.nEq++;
112035 pNew->u.btree.nSkip++;
112036 pNew->aLTerm[pNew->nLTerm++] = 0;
@@ -119669,12 +119745,11 @@
119745
119746 /*
119747 ** Return a static string containing the name corresponding to the error code
119748 ** specified in the argument.
119749 */
119750 #if defined(SQLITE_TEST)
 
119751 SQLITE_PRIVATE const char *sqlite3ErrName(int rc){
119752 const char *zName = 0;
119753 int i, origRc = rc;
119754 for(i=0; i<2 && zName==0; i++, rc &= 0xff){
119755 switch( rc ){
@@ -121247,10 +121322,12 @@
121322 #ifdef SQLITE_DEFAULT_LOCKING_MODE
121323 db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;
121324 sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
121325 SQLITE_DEFAULT_LOCKING_MODE);
121326 #endif
121327
121328 if( rc ) sqlite3Error(db, rc, 0);
121329
121330 /* Enable the lookaside-malloc subsystem */
121331 setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,
121332 sqlite3GlobalConfig.nLookaside);
121333
@@ -131579,61 +131656,74 @@
131656 }
131657
131658 /* Step 2 */
131659 switch( z[1] ){
131660 case 'a':
131661 if( !stem(&z, "lanoita", "ate", m_gt_0) ){
131662 stem(&z, "lanoit", "tion", m_gt_0);
131663 }
131664 break;
131665 case 'c':
131666 if( !stem(&z, "icne", "ence", m_gt_0) ){
131667 stem(&z, "icna", "ance", m_gt_0);
131668 }
131669 break;
131670 case 'e':
131671 stem(&z, "rezi", "ize", m_gt_0);
131672 break;
131673 case 'g':
131674 stem(&z, "igol", "log", m_gt_0);
131675 break;
131676 case 'l':
131677 if( !stem(&z, "ilb", "ble", m_gt_0)
131678 && !stem(&z, "illa", "al", m_gt_0)
131679 && !stem(&z, "iltne", "ent", m_gt_0)
131680 && !stem(&z, "ile", "e", m_gt_0)
131681 ){
131682 stem(&z, "ilsuo", "ous", m_gt_0);
131683 }
131684 break;
131685 case 'o':
131686 if( !stem(&z, "noitazi", "ize", m_gt_0)
131687 && !stem(&z, "noita", "ate", m_gt_0)
131688 ){
131689 stem(&z, "rota", "ate", m_gt_0);
131690 }
131691 break;
131692 case 's':
131693 if( !stem(&z, "msila", "al", m_gt_0)
131694 && !stem(&z, "ssenevi", "ive", m_gt_0)
131695 && !stem(&z, "ssenluf", "ful", m_gt_0)
131696 ){
131697 stem(&z, "ssensuo", "ous", m_gt_0);
131698 }
131699 break;
131700 case 't':
131701 if( !stem(&z, "itila", "al", m_gt_0)
131702 && !stem(&z, "itivi", "ive", m_gt_0)
131703 ){
131704 stem(&z, "itilib", "ble", m_gt_0);
131705 }
131706 break;
131707 }
131708
131709 /* Step 3 */
131710 switch( z[0] ){
131711 case 'e':
131712 if( !stem(&z, "etaci", "ic", m_gt_0)
131713 && !stem(&z, "evita", "", m_gt_0)
131714 ){
131715 stem(&z, "ezila", "al", m_gt_0);
131716 }
131717 break;
131718 case 'i':
131719 stem(&z, "itici", "ic", m_gt_0);
131720 break;
131721 case 'l':
131722 if( !stem(&z, "laci", "ic", m_gt_0) ){
131723 stem(&z, "luf", "", m_gt_0);
131724 }
131725 break;
131726 case 's':
131727 stem(&z, "ssen", "", m_gt_0);
131728 break;
131729 }
@@ -131670,13 +131760,15 @@
131760 if( z[2]=='a' ){
131761 if( m_gt_1(z+3) ){
131762 z += 3;
131763 }
131764 }else if( z[2]=='e' ){
131765 if( !stem(&z, "tneme", "", m_gt_1)
131766 && !stem(&z, "tnem", "", m_gt_1)
131767 ){
131768 stem(&z, "tne", "", m_gt_1);
131769 }
131770 }
131771 }
131772 break;
131773 case 'o':
131774 if( z[0]=='u' ){
@@ -131691,12 +131783,13 @@
131783 if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
131784 z += 3;
131785 }
131786 break;
131787 case 't':
131788 if( !stem(&z, "eta", "", m_gt_1) ){
131789 stem(&z, "iti", "", m_gt_1);
131790 }
131791 break;
131792 case 'u':
131793 if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
131794 z += 3;
131795 }
131796
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.8.3"
111111
#define SQLITE_VERSION_NUMBER 3008003
112
-#define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2"
112
+#define SQLITE_SOURCE_ID "2013-12-23 11:33:32 25b8a1c9ba77df3b7c78cbce922cb593d661696d"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.3"
111 #define SQLITE_VERSION_NUMBER 3008003
112 #define SQLITE_SOURCE_ID "2013-12-17 16:32:56 93121d3097a43997af3c0de65bd9bd7663845fa2"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.3"
111 #define SQLITE_VERSION_NUMBER 3008003
112 #define SQLITE_SOURCE_ID "2013-12-23 11:33:32 25b8a1c9ba77df3b7c78cbce922cb593d661696d"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

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