Fossil SCM

Update SQLite to the 3.8.8.3 release

jan.nijtmans 2015-02-25 21:39 trunk
Commit 4bd1014ef06f039a9568cf334ecec6a9f11a44ad
3 files changed +35 -17 +103 -99 +2 -2
+35 -17
--- src/shell.c
+++ src/shell.c
@@ -57,21 +57,41 @@
5757
5858
#if HAVE_READLINE
5959
# include <readline/readline.h>
6060
# include <readline/history.h>
6161
#endif
62
+
6263
#if HAVE_EDITLINE
63
-# undef HAVE_READLINE
64
-# define HAVE_READLINE 1
6564
# include <editline/readline.h>
6665
#endif
67
-#if !HAVE_READLINE
68
-# define add_history(X)
69
-# define read_history(X)
70
-# define write_history(X)
71
-# define stifle_history(X)
66
+
67
+#if HAVE_EDITLINE || HAVE_READLINE
68
+
69
+# define shell_add_history(X) add_history(X)
70
+# define shell_read_history(X) read_history(X)
71
+# define shell_write_history(X) write_history(X)
72
+# define shell_stifle_history(X) stifle_history(X)
73
+# define shell_readline(X) readline(X)
74
+
75
+#elif HAVE_LINENOISE
76
+
77
+# include "linenoise.h"
78
+# define shell_add_history(X) linenoiseHistoryAdd(X)
79
+# define shell_read_history(X) linenoiseHistoryLoad(X)
80
+# define shell_write_history(X) linenoiseHistorySave(X)
81
+# define shell_stifle_history(X) linenoiseHistorySetMaxLen(X)
82
+# define shell_readline(X) linenoise(X)
83
+
84
+#else
85
+
86
+# define shell_read_history(X)
87
+# define shell_write_history(X)
88
+# define shell_stifle_history(X)
89
+
90
+# define SHELL_USE_LOCAL_GETLINE 1
7291
#endif
92
+
7393
7494
#if defined(_WIN32) || defined(WIN32)
7595
# include <io.h>
7696
# include <fcntl.h>
7797
#define isatty(h) _isatty(h)
@@ -449,18 +469,18 @@
449469
char *zResult;
450470
if( in!=0 ){
451471
zResult = local_getline(zPrior, in);
452472
}else{
453473
zPrompt = isContinuation ? continuePrompt : mainPrompt;
454
-#if HAVE_READLINE
455
- free(zPrior);
456
- zResult = readline(zPrompt);
457
- if( zResult && *zResult ) add_history(zResult);
458
-#else
474
+#if SHELL_USE_LOCAL_GETLINE
459475
printf("%s", zPrompt);
460476
fflush(stdout);
461477
zResult = local_getline(zPrior, stdin);
478
+#else
479
+ free(zPrior);
480
+ zResult = shell_readline(zPrompt);
481
+ if( zResult && *zResult ) shell_add_history(zResult);
462482
#endif
463483
}
464484
return zResult;
465485
}
466486
@@ -4632,17 +4652,15 @@
46324652
nHistory = strlen30(zHome) + 20;
46334653
if( (zHistory = malloc(nHistory))!=0 ){
46344654
sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
46354655
}
46364656
}
4637
-#if HAVE_READLINE
4638
- if( zHistory ) read_history(zHistory);
4639
-#endif
4657
+ if( zHistory ) shell_read_history(zHistory);
46404658
rc = process_input(&data, 0);
46414659
if( zHistory ){
4642
- stifle_history(100);
4643
- write_history(zHistory);
4660
+ shell_stifle_history(100);
4661
+ shell_write_history(zHistory);
46444662
free(zHistory);
46454663
}
46464664
}else{
46474665
rc = process_input(&data, stdin);
46484666
}
46494667
--- src/shell.c
+++ src/shell.c
@@ -57,21 +57,41 @@
57
58 #if HAVE_READLINE
59 # include <readline/readline.h>
60 # include <readline/history.h>
61 #endif
 
62 #if HAVE_EDITLINE
63 # undef HAVE_READLINE
64 # define HAVE_READLINE 1
65 # include <editline/readline.h>
66 #endif
67 #if !HAVE_READLINE
68 # define add_history(X)
69 # define read_history(X)
70 # define write_history(X)
71 # define stifle_history(X)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72 #endif
 
73
74 #if defined(_WIN32) || defined(WIN32)
75 # include <io.h>
76 # include <fcntl.h>
77 #define isatty(h) _isatty(h)
@@ -449,18 +469,18 @@
449 char *zResult;
450 if( in!=0 ){
451 zResult = local_getline(zPrior, in);
452 }else{
453 zPrompt = isContinuation ? continuePrompt : mainPrompt;
454 #if HAVE_READLINE
455 free(zPrior);
456 zResult = readline(zPrompt);
457 if( zResult && *zResult ) add_history(zResult);
458 #else
459 printf("%s", zPrompt);
460 fflush(stdout);
461 zResult = local_getline(zPrior, stdin);
 
 
 
 
462 #endif
463 }
464 return zResult;
465 }
466
@@ -4632,17 +4652,15 @@
4632 nHistory = strlen30(zHome) + 20;
4633 if( (zHistory = malloc(nHistory))!=0 ){
4634 sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
4635 }
4636 }
4637 #if HAVE_READLINE
4638 if( zHistory ) read_history(zHistory);
4639 #endif
4640 rc = process_input(&data, 0);
4641 if( zHistory ){
4642 stifle_history(100);
4643 write_history(zHistory);
4644 free(zHistory);
4645 }
4646 }else{
4647 rc = process_input(&data, stdin);
4648 }
4649
--- src/shell.c
+++ src/shell.c
@@ -57,21 +57,41 @@
57
58 #if HAVE_READLINE
59 # include <readline/readline.h>
60 # include <readline/history.h>
61 #endif
62
63 #if HAVE_EDITLINE
 
 
64 # include <editline/readline.h>
65 #endif
66
67 #if HAVE_EDITLINE || HAVE_READLINE
68
69 # define shell_add_history(X) add_history(X)
70 # define shell_read_history(X) read_history(X)
71 # define shell_write_history(X) write_history(X)
72 # define shell_stifle_history(X) stifle_history(X)
73 # define shell_readline(X) readline(X)
74
75 #elif HAVE_LINENOISE
76
77 # include "linenoise.h"
78 # define shell_add_history(X) linenoiseHistoryAdd(X)
79 # define shell_read_history(X) linenoiseHistoryLoad(X)
80 # define shell_write_history(X) linenoiseHistorySave(X)
81 # define shell_stifle_history(X) linenoiseHistorySetMaxLen(X)
82 # define shell_readline(X) linenoise(X)
83
84 #else
85
86 # define shell_read_history(X)
87 # define shell_write_history(X)
88 # define shell_stifle_history(X)
89
90 # define SHELL_USE_LOCAL_GETLINE 1
91 #endif
92
93
94 #if defined(_WIN32) || defined(WIN32)
95 # include <io.h>
96 # include <fcntl.h>
97 #define isatty(h) _isatty(h)
@@ -449,18 +469,18 @@
469 char *zResult;
470 if( in!=0 ){
471 zResult = local_getline(zPrior, in);
472 }else{
473 zPrompt = isContinuation ? continuePrompt : mainPrompt;
474 #if SHELL_USE_LOCAL_GETLINE
 
 
 
 
475 printf("%s", zPrompt);
476 fflush(stdout);
477 zResult = local_getline(zPrior, stdin);
478 #else
479 free(zPrior);
480 zResult = shell_readline(zPrompt);
481 if( zResult && *zResult ) shell_add_history(zResult);
482 #endif
483 }
484 return zResult;
485 }
486
@@ -4632,17 +4652,15 @@
4652 nHistory = strlen30(zHome) + 20;
4653 if( (zHistory = malloc(nHistory))!=0 ){
4654 sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
4655 }
4656 }
4657 if( zHistory ) shell_read_history(zHistory);
 
 
4658 rc = process_input(&data, 0);
4659 if( zHistory ){
4660 shell_stifle_history(100);
4661 shell_write_history(zHistory);
4662 free(zHistory);
4663 }
4664 }else{
4665 rc = process_input(&data, stdin);
4666 }
4667
+103 -99
--- 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.8.8.2. By combining all the individual C code files into this
3
+** version 3.8.8.3. 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.
@@ -276,13 +276,13 @@
276276
**
277277
** See also: [sqlite3_libversion()],
278278
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
279279
** [sqlite_version()] and [sqlite_source_id()].
280280
*/
281
-#define SQLITE_VERSION "3.8.8.2"
281
+#define SQLITE_VERSION "3.8.8.3"
282282
#define SQLITE_VERSION_NUMBER 3008008
283
-#define SQLITE_SOURCE_ID "2015-01-30 14:30:45 7757fc721220e136620a89c9d28247f28bbbc098"
283
+#define SQLITE_SOURCE_ID "2015-02-25 13:29:11 9d6c1880fb75660bbabd693175579529785f8a6b"
284284
285285
/*
286286
** CAPI3REF: Run-Time Library Version Numbers
287287
** KEYWORDS: sqlite3_version, sqlite3_sourceid
288288
**
@@ -116549,10 +116549,11 @@
116549116549
pLoop = pLevel->pWLoop;
116550116550
idxCols = 0;
116551116551
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
116552116552
if( pLoop->prereq==0
116553116553
&& (pTerm->wtFlags & TERM_VIRTUAL)==0
116554
+ && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
116554116555
&& sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){
116555116556
pPartial = sqlite3ExprAnd(pParse->db, pPartial,
116556116557
sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
116557116558
}
116558116559
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
@@ -119629,11 +119630,15 @@
119629119630
*/
119630119631
static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){
119631119632
int i;
119632119633
WhereTerm *pTerm;
119633119634
for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
119634
- if( sqlite3ExprImpliesExpr(pTerm->pExpr, pWhere, iTab) ) return 1;
119635
+ if( sqlite3ExprImpliesExpr(pTerm->pExpr, pWhere, iTab)
119636
+ && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
119637
+ ){
119638
+ return 1;
119639
+ }
119635119640
}
119636119641
return 0;
119637119642
}
119638119643
119639119644
/*
@@ -131384,10 +131389,15 @@
131384131389
struct Fts3Phrase {
131385131390
/* Cache of doclist for this phrase. */
131386131391
Fts3Doclist doclist;
131387131392
int bIncr; /* True if doclist is loaded incrementally */
131388131393
int iDoclistToken;
131394
+
131395
+ /* Used by sqlite3Fts3EvalPhrasePoslist() if this is a descendent of an
131396
+ ** OR condition. */
131397
+ char *pOrPoslist;
131398
+ i64 iOrDocid;
131389131399
131390131400
/* Variables below this point are populated by fts3_expr.c when parsing
131391131401
** a MATCH expression. Everything above is part of the evaluation phase.
131392131402
*/
131393131403
int nToken; /* Number of tokens in the phrase */
@@ -136335,10 +136345,26 @@
136335136345
fts3EvalNextRow(pCsr, pRight, pRc);
136336136346
}
136337136347
}
136338136348
pExpr->iDocid = pLeft->iDocid;
136339136349
pExpr->bEof = (pLeft->bEof || pRight->bEof);
136350
+ if( pExpr->eType==FTSQUERY_NEAR && pExpr->bEof ){
136351
+ if( pRight->pPhrase && pRight->pPhrase->doclist.aAll ){
136352
+ Fts3Doclist *pDl = &pRight->pPhrase->doclist;
136353
+ while( *pRc==SQLITE_OK && pRight->bEof==0 ){
136354
+ memset(pDl->pList, 0, pDl->nList);
136355
+ fts3EvalNextRow(pCsr, pRight, pRc);
136356
+ }
136357
+ }
136358
+ if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){
136359
+ Fts3Doclist *pDl = &pLeft->pPhrase->doclist;
136360
+ while( *pRc==SQLITE_OK && pLeft->bEof==0 ){
136361
+ memset(pDl->pList, 0, pDl->nList);
136362
+ fts3EvalNextRow(pCsr, pLeft, pRc);
136363
+ }
136364
+ }
136365
+ }
136340136366
}
136341136367
break;
136342136368
}
136343136369
136344136370
case FTSQUERY_OR: {
@@ -136707,10 +136733,11 @@
136707136733
}
136708136734
*pRc = fts3EvalPhraseStart(pCsr, 0, pPhrase);
136709136735
}
136710136736
pPhrase->doclist.pNextDocid = 0;
136711136737
pPhrase->doclist.iDocid = 0;
136738
+ pPhrase->pOrPoslist = 0;
136712136739
}
136713136740
136714136741
pExpr->iDocid = 0;
136715136742
pExpr->bEof = 0;
136716136743
pExpr->bStart = 0;
@@ -136952,10 +136979,11 @@
136952136979
}
136953136980
136954136981
iDocid = pExpr->iDocid;
136955136982
pIter = pPhrase->doclist.pList;
136956136983
if( iDocid!=pCsr->iPrevId || pExpr->bEof ){
136984
+ int rc = SQLITE_OK;
136957136985
int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */
136958136986
int iMul; /* +1 if csr dir matches index dir, else -1 */
136959136987
int bOr = 0;
136960136988
u8 bEof = 0;
136961136989
u8 bTreeEof = 0;
@@ -136977,76 +137005,47 @@
136977137005
136978137006
/* This is the descendent of an OR node. In this case we cannot use
136979137007
** an incremental phrase. Load the entire doclist for the phrase
136980137008
** into memory in this case. */
136981137009
if( pPhrase->bIncr ){
136982
- int rc = SQLITE_OK;
136983
- int bEofSave = pExpr->bEof;
136984
- fts3EvalRestart(pCsr, pExpr, &rc);
136985
- while( rc==SQLITE_OK && !pExpr->bEof ){
136986
- fts3EvalNextRow(pCsr, pExpr, &rc);
136987
- if( bEofSave==0 && pExpr->iDocid==iDocid ) break;
136988
- }
136989
- pIter = pPhrase->doclist.pList;
137010
+ int bEofSave = pNear->bEof;
137011
+ fts3EvalRestart(pCsr, pNear, &rc);
137012
+ while( rc==SQLITE_OK && !pNear->bEof ){
137013
+ fts3EvalNextRow(pCsr, pNear, &rc);
137014
+ if( bEofSave==0 && pNear->iDocid==iDocid ) break;
137015
+ }
136990137016
assert( rc!=SQLITE_OK || pPhrase->bIncr==0 );
136991
- if( rc!=SQLITE_OK ) return rc;
136992
- }
136993
-
136994
- iMul = ((pCsr->bDesc==bDescDoclist) ? 1 : -1);
136995
- while( bTreeEof==1
136996
- && pNear->bEof==0
136997
- && (DOCID_CMP(pNear->iDocid, pCsr->iPrevId) * iMul)<0
136998
- ){
136999
- int rc = SQLITE_OK;
137000
- fts3EvalNextRow(pCsr, pExpr, &rc);
137001
- if( rc!=SQLITE_OK ) return rc;
137002
- iDocid = pExpr->iDocid;
137003
- pIter = pPhrase->doclist.pList;
137004
- }
137005
-
137006
- bEof = (pPhrase->doclist.nAll==0);
137007
- assert( bDescDoclist==0 || bDescDoclist==1 );
137008
- assert( pCsr->bDesc==0 || pCsr->bDesc==1 );
137009
-
137010
- if( bEof==0 ){
137011
- if( pCsr->bDesc==bDescDoclist ){
137017
+ }
137018
+ if( bTreeEof ){
137019
+ while( rc==SQLITE_OK && !pNear->bEof ){
137020
+ fts3EvalNextRow(pCsr, pNear, &rc);
137021
+ }
137022
+ }
137023
+ if( rc!=SQLITE_OK ) return rc;
137024
+
137025
+ pIter = pPhrase->pOrPoslist;
137026
+ iDocid = pPhrase->iOrDocid;
137027
+ if( pCsr->bDesc==bDescDoclist ){
137028
+ bEof = (pIter >= (pPhrase->doclist.aAll + pPhrase->doclist.nAll));
137029
+ while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
137030
+ sqlite3Fts3DoclistNext(
137031
+ bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137032
+ &pIter, &iDocid, &bEof
137033
+ );
137034
+ }
137035
+ }else{
137036
+ bEof = !pPhrase->doclist.nAll || (pIter && pIter<=pPhrase->doclist.aAll);
137037
+ while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
137012137038
int dummy;
137013
- if( pNear->bEof ){
137014
- /* This expression is already at EOF. So position it to point to the
137015
- ** last entry in the doclist at pPhrase->doclist.aAll[]. Variable
137016
- ** iDocid is already set for this entry, so all that is required is
137017
- ** to set pIter to point to the first byte of the last position-list
137018
- ** in the doclist.
137019
- **
137020
- ** It would also be correct to set pIter and iDocid to zero. In
137021
- ** this case, the first call to sqltie3Fts4DoclistPrev() below
137022
- ** would also move the iterator to point to the last entry in the
137023
- ** doclist. However, this is expensive, as to do so it has to
137024
- ** iterate through the entire doclist from start to finish (since
137025
- ** it does not know the docid for the last entry). */
137026
- pIter = &pPhrase->doclist.aAll[pPhrase->doclist.nAll-1];
137027
- fts3ReversePoslist(pPhrase->doclist.aAll, &pIter);
137028
- }
137029
- while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
137030
- sqlite3Fts3DoclistPrev(
137031
- bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137032
- &pIter, &iDocid, &dummy, &bEof
137033
- );
137034
- }
137035
- }else{
137036
- if( pNear->bEof ){
137037
- pIter = 0;
137038
- iDocid = 0;
137039
- }
137040
- while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
137041
- sqlite3Fts3DoclistNext(
137042
- bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137043
- &pIter, &iDocid, &bEof
137044
- );
137045
- }
137046
- }
137047
- }
137039
+ sqlite3Fts3DoclistPrev(
137040
+ bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137041
+ &pIter, &iDocid, &dummy, &bEof
137042
+ );
137043
+ }
137044
+ }
137045
+ pPhrase->pOrPoslist = pIter;
137046
+ pPhrase->iOrDocid = iDocid;
137048137047
137049137048
if( bEof || iDocid!=pCsr->iPrevId ) pIter = 0;
137050137049
}
137051137050
if( pIter==0 ) return SQLITE_OK;
137052137051
@@ -137056,13 +137055,16 @@
137056137055
}else{
137057137056
iThis = 0;
137058137057
}
137059137058
while( iThis<iCol ){
137060137059
fts3ColumnlistCopy(0, &pIter);
137061
- if( *pIter==0x00 ) return 0;
137060
+ if( *pIter==0x00 ) return SQLITE_OK;
137062137061
pIter++;
137063137062
pIter += fts3GetVarint32(pIter, &iThis);
137063
+ }
137064
+ if( *pIter==0x00 ){
137065
+ pIter = 0;
137064137066
}
137065137067
137066137068
*ppOut = ((iCol==iThis)?pIter:0);
137067137069
return SQLITE_OK;
137068137070
}
@@ -147286,41 +147288,43 @@
147286147288
sIter.pCsr = pCsr;
147287147289
sIter.iCol = iCol;
147288147290
sIter.nSnippet = nSnippet;
147289147291
sIter.nPhrase = nList;
147290147292
sIter.iCurrent = -1;
147291
- (void)fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter);
147292
-
147293
- /* Set the *pmSeen output variable. */
147294
- for(i=0; i<nList; i++){
147295
- if( sIter.aPhrase[i].pHead ){
147296
- *pmSeen |= (u64)1 << i;
147297
- }
147298
- }
147299
-
147300
- /* Loop through all candidate snippets. Store the best snippet in
147301
- ** *pFragment. Store its associated 'score' in iBestScore.
147302
- */
147303
- pFragment->iCol = iCol;
147304
- while( !fts3SnippetNextCandidate(&sIter) ){
147305
- int iPos;
147306
- int iScore;
147307
- u64 mCover;
147308
- u64 mHighlight;
147309
- fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover, &mHighlight);
147310
- assert( iScore>=0 );
147311
- if( iScore>iBestScore ){
147312
- pFragment->iPos = iPos;
147313
- pFragment->hlmask = mHighlight;
147314
- pFragment->covered = mCover;
147315
- iBestScore = iScore;
147316
- }
147317
- }
147318
-
147293
+ rc = fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter);
147294
+ if( rc==SQLITE_OK ){
147295
+
147296
+ /* Set the *pmSeen output variable. */
147297
+ for(i=0; i<nList; i++){
147298
+ if( sIter.aPhrase[i].pHead ){
147299
+ *pmSeen |= (u64)1 << i;
147300
+ }
147301
+ }
147302
+
147303
+ /* Loop through all candidate snippets. Store the best snippet in
147304
+ ** *pFragment. Store its associated 'score' in iBestScore.
147305
+ */
147306
+ pFragment->iCol = iCol;
147307
+ while( !fts3SnippetNextCandidate(&sIter) ){
147308
+ int iPos;
147309
+ int iScore;
147310
+ u64 mCover;
147311
+ u64 mHighlite;
147312
+ fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover,&mHighlite);
147313
+ assert( iScore>=0 );
147314
+ if( iScore>iBestScore ){
147315
+ pFragment->iPos = iPos;
147316
+ pFragment->hlmask = mHighlite;
147317
+ pFragment->covered = mCover;
147318
+ iBestScore = iScore;
147319
+ }
147320
+ }
147321
+
147322
+ *piScore = iBestScore;
147323
+ }
147319147324
sqlite3_free(sIter.aPhrase);
147320
- *piScore = iBestScore;
147321
- return SQLITE_OK;
147325
+ return rc;
147322147326
}
147323147327
147324147328
147325147329
/*
147326147330
** Append a string to the string-buffer passed as the first argument.
147327147331
--- 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.8.8.2. 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.
@@ -276,13 +276,13 @@
276 **
277 ** See also: [sqlite3_libversion()],
278 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
279 ** [sqlite_version()] and [sqlite_source_id()].
280 */
281 #define SQLITE_VERSION "3.8.8.2"
282 #define SQLITE_VERSION_NUMBER 3008008
283 #define SQLITE_SOURCE_ID "2015-01-30 14:30:45 7757fc721220e136620a89c9d28247f28bbbc098"
284
285 /*
286 ** CAPI3REF: Run-Time Library Version Numbers
287 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
288 **
@@ -116549,10 +116549,11 @@
116549 pLoop = pLevel->pWLoop;
116550 idxCols = 0;
116551 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
116552 if( pLoop->prereq==0
116553 && (pTerm->wtFlags & TERM_VIRTUAL)==0
 
116554 && sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){
116555 pPartial = sqlite3ExprAnd(pParse->db, pPartial,
116556 sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
116557 }
116558 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
@@ -119629,11 +119630,15 @@
119629 */
119630 static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){
119631 int i;
119632 WhereTerm *pTerm;
119633 for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
119634 if( sqlite3ExprImpliesExpr(pTerm->pExpr, pWhere, iTab) ) return 1;
 
 
 
 
119635 }
119636 return 0;
119637 }
119638
119639 /*
@@ -131384,10 +131389,15 @@
131384 struct Fts3Phrase {
131385 /* Cache of doclist for this phrase. */
131386 Fts3Doclist doclist;
131387 int bIncr; /* True if doclist is loaded incrementally */
131388 int iDoclistToken;
 
 
 
 
 
131389
131390 /* Variables below this point are populated by fts3_expr.c when parsing
131391 ** a MATCH expression. Everything above is part of the evaluation phase.
131392 */
131393 int nToken; /* Number of tokens in the phrase */
@@ -136335,10 +136345,26 @@
136335 fts3EvalNextRow(pCsr, pRight, pRc);
136336 }
136337 }
136338 pExpr->iDocid = pLeft->iDocid;
136339 pExpr->bEof = (pLeft->bEof || pRight->bEof);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136340 }
136341 break;
136342 }
136343
136344 case FTSQUERY_OR: {
@@ -136707,10 +136733,11 @@
136707 }
136708 *pRc = fts3EvalPhraseStart(pCsr, 0, pPhrase);
136709 }
136710 pPhrase->doclist.pNextDocid = 0;
136711 pPhrase->doclist.iDocid = 0;
 
136712 }
136713
136714 pExpr->iDocid = 0;
136715 pExpr->bEof = 0;
136716 pExpr->bStart = 0;
@@ -136952,10 +136979,11 @@
136952 }
136953
136954 iDocid = pExpr->iDocid;
136955 pIter = pPhrase->doclist.pList;
136956 if( iDocid!=pCsr->iPrevId || pExpr->bEof ){
 
136957 int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */
136958 int iMul; /* +1 if csr dir matches index dir, else -1 */
136959 int bOr = 0;
136960 u8 bEof = 0;
136961 u8 bTreeEof = 0;
@@ -136977,76 +137005,47 @@
136977
136978 /* This is the descendent of an OR node. In this case we cannot use
136979 ** an incremental phrase. Load the entire doclist for the phrase
136980 ** into memory in this case. */
136981 if( pPhrase->bIncr ){
136982 int rc = SQLITE_OK;
136983 int bEofSave = pExpr->bEof;
136984 fts3EvalRestart(pCsr, pExpr, &rc);
136985 while( rc==SQLITE_OK && !pExpr->bEof ){
136986 fts3EvalNextRow(pCsr, pExpr, &rc);
136987 if( bEofSave==0 && pExpr->iDocid==iDocid ) break;
136988 }
136989 pIter = pPhrase->doclist.pList;
136990 assert( rc!=SQLITE_OK || pPhrase->bIncr==0 );
136991 if( rc!=SQLITE_OK ) return rc;
136992 }
136993
136994 iMul = ((pCsr->bDesc==bDescDoclist) ? 1 : -1);
136995 while( bTreeEof==1
136996 && pNear->bEof==0
136997 && (DOCID_CMP(pNear->iDocid, pCsr->iPrevId) * iMul)<0
136998 ){
136999 int rc = SQLITE_OK;
137000 fts3EvalNextRow(pCsr, pExpr, &rc);
137001 if( rc!=SQLITE_OK ) return rc;
137002 iDocid = pExpr->iDocid;
137003 pIter = pPhrase->doclist.pList;
137004 }
137005
137006 bEof = (pPhrase->doclist.nAll==0);
137007 assert( bDescDoclist==0 || bDescDoclist==1 );
137008 assert( pCsr->bDesc==0 || pCsr->bDesc==1 );
137009
137010 if( bEof==0 ){
137011 if( pCsr->bDesc==bDescDoclist ){
137012 int dummy;
137013 if( pNear->bEof ){
137014 /* This expression is already at EOF. So position it to point to the
137015 ** last entry in the doclist at pPhrase->doclist.aAll[]. Variable
137016 ** iDocid is already set for this entry, so all that is required is
137017 ** to set pIter to point to the first byte of the last position-list
137018 ** in the doclist.
137019 **
137020 ** It would also be correct to set pIter and iDocid to zero. In
137021 ** this case, the first call to sqltie3Fts4DoclistPrev() below
137022 ** would also move the iterator to point to the last entry in the
137023 ** doclist. However, this is expensive, as to do so it has to
137024 ** iterate through the entire doclist from start to finish (since
137025 ** it does not know the docid for the last entry). */
137026 pIter = &pPhrase->doclist.aAll[pPhrase->doclist.nAll-1];
137027 fts3ReversePoslist(pPhrase->doclist.aAll, &pIter);
137028 }
137029 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
137030 sqlite3Fts3DoclistPrev(
137031 bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137032 &pIter, &iDocid, &dummy, &bEof
137033 );
137034 }
137035 }else{
137036 if( pNear->bEof ){
137037 pIter = 0;
137038 iDocid = 0;
137039 }
137040 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
137041 sqlite3Fts3DoclistNext(
137042 bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137043 &pIter, &iDocid, &bEof
137044 );
137045 }
137046 }
137047 }
137048
137049 if( bEof || iDocid!=pCsr->iPrevId ) pIter = 0;
137050 }
137051 if( pIter==0 ) return SQLITE_OK;
137052
@@ -137056,13 +137055,16 @@
137056 }else{
137057 iThis = 0;
137058 }
137059 while( iThis<iCol ){
137060 fts3ColumnlistCopy(0, &pIter);
137061 if( *pIter==0x00 ) return 0;
137062 pIter++;
137063 pIter += fts3GetVarint32(pIter, &iThis);
 
 
 
137064 }
137065
137066 *ppOut = ((iCol==iThis)?pIter:0);
137067 return SQLITE_OK;
137068 }
@@ -147286,41 +147288,43 @@
147286 sIter.pCsr = pCsr;
147287 sIter.iCol = iCol;
147288 sIter.nSnippet = nSnippet;
147289 sIter.nPhrase = nList;
147290 sIter.iCurrent = -1;
147291 (void)fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter);
147292
147293 /* Set the *pmSeen output variable. */
147294 for(i=0; i<nList; i++){
147295 if( sIter.aPhrase[i].pHead ){
147296 *pmSeen |= (u64)1 << i;
147297 }
147298 }
147299
147300 /* Loop through all candidate snippets. Store the best snippet in
147301 ** *pFragment. Store its associated 'score' in iBestScore.
147302 */
147303 pFragment->iCol = iCol;
147304 while( !fts3SnippetNextCandidate(&sIter) ){
147305 int iPos;
147306 int iScore;
147307 u64 mCover;
147308 u64 mHighlight;
147309 fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover, &mHighlight);
147310 assert( iScore>=0 );
147311 if( iScore>iBestScore ){
147312 pFragment->iPos = iPos;
147313 pFragment->hlmask = mHighlight;
147314 pFragment->covered = mCover;
147315 iBestScore = iScore;
147316 }
147317 }
147318
 
 
 
147319 sqlite3_free(sIter.aPhrase);
147320 *piScore = iBestScore;
147321 return SQLITE_OK;
147322 }
147323
147324
147325 /*
147326 ** Append a string to the string-buffer passed as the first argument.
147327
--- 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.8.8.3. 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.
@@ -276,13 +276,13 @@
276 **
277 ** See also: [sqlite3_libversion()],
278 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
279 ** [sqlite_version()] and [sqlite_source_id()].
280 */
281 #define SQLITE_VERSION "3.8.8.3"
282 #define SQLITE_VERSION_NUMBER 3008008
283 #define SQLITE_SOURCE_ID "2015-02-25 13:29:11 9d6c1880fb75660bbabd693175579529785f8a6b"
284
285 /*
286 ** CAPI3REF: Run-Time Library Version Numbers
287 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
288 **
@@ -116549,10 +116549,11 @@
116549 pLoop = pLevel->pWLoop;
116550 idxCols = 0;
116551 for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
116552 if( pLoop->prereq==0
116553 && (pTerm->wtFlags & TERM_VIRTUAL)==0
116554 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
116555 && sqlite3ExprIsTableConstant(pTerm->pExpr, pSrc->iCursor) ){
116556 pPartial = sqlite3ExprAnd(pParse->db, pPartial,
116557 sqlite3ExprDup(pParse->db, pTerm->pExpr, 0));
116558 }
116559 if( termCanDriveIndex(pTerm, pSrc, notReady) ){
@@ -119629,11 +119630,15 @@
119630 */
119631 static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){
119632 int i;
119633 WhereTerm *pTerm;
119634 for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
119635 if( sqlite3ExprImpliesExpr(pTerm->pExpr, pWhere, iTab)
119636 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
119637 ){
119638 return 1;
119639 }
119640 }
119641 return 0;
119642 }
119643
119644 /*
@@ -131384,10 +131389,15 @@
131389 struct Fts3Phrase {
131390 /* Cache of doclist for this phrase. */
131391 Fts3Doclist doclist;
131392 int bIncr; /* True if doclist is loaded incrementally */
131393 int iDoclistToken;
131394
131395 /* Used by sqlite3Fts3EvalPhrasePoslist() if this is a descendent of an
131396 ** OR condition. */
131397 char *pOrPoslist;
131398 i64 iOrDocid;
131399
131400 /* Variables below this point are populated by fts3_expr.c when parsing
131401 ** a MATCH expression. Everything above is part of the evaluation phase.
131402 */
131403 int nToken; /* Number of tokens in the phrase */
@@ -136335,10 +136345,26 @@
136345 fts3EvalNextRow(pCsr, pRight, pRc);
136346 }
136347 }
136348 pExpr->iDocid = pLeft->iDocid;
136349 pExpr->bEof = (pLeft->bEof || pRight->bEof);
136350 if( pExpr->eType==FTSQUERY_NEAR && pExpr->bEof ){
136351 if( pRight->pPhrase && pRight->pPhrase->doclist.aAll ){
136352 Fts3Doclist *pDl = &pRight->pPhrase->doclist;
136353 while( *pRc==SQLITE_OK && pRight->bEof==0 ){
136354 memset(pDl->pList, 0, pDl->nList);
136355 fts3EvalNextRow(pCsr, pRight, pRc);
136356 }
136357 }
136358 if( pLeft->pPhrase && pLeft->pPhrase->doclist.aAll ){
136359 Fts3Doclist *pDl = &pLeft->pPhrase->doclist;
136360 while( *pRc==SQLITE_OK && pLeft->bEof==0 ){
136361 memset(pDl->pList, 0, pDl->nList);
136362 fts3EvalNextRow(pCsr, pLeft, pRc);
136363 }
136364 }
136365 }
136366 }
136367 break;
136368 }
136369
136370 case FTSQUERY_OR: {
@@ -136707,10 +136733,11 @@
136733 }
136734 *pRc = fts3EvalPhraseStart(pCsr, 0, pPhrase);
136735 }
136736 pPhrase->doclist.pNextDocid = 0;
136737 pPhrase->doclist.iDocid = 0;
136738 pPhrase->pOrPoslist = 0;
136739 }
136740
136741 pExpr->iDocid = 0;
136742 pExpr->bEof = 0;
136743 pExpr->bStart = 0;
@@ -136952,10 +136979,11 @@
136979 }
136980
136981 iDocid = pExpr->iDocid;
136982 pIter = pPhrase->doclist.pList;
136983 if( iDocid!=pCsr->iPrevId || pExpr->bEof ){
136984 int rc = SQLITE_OK;
136985 int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */
136986 int iMul; /* +1 if csr dir matches index dir, else -1 */
136987 int bOr = 0;
136988 u8 bEof = 0;
136989 u8 bTreeEof = 0;
@@ -136977,76 +137005,47 @@
137005
137006 /* This is the descendent of an OR node. In this case we cannot use
137007 ** an incremental phrase. Load the entire doclist for the phrase
137008 ** into memory in this case. */
137009 if( pPhrase->bIncr ){
137010 int bEofSave = pNear->bEof;
137011 fts3EvalRestart(pCsr, pNear, &rc);
137012 while( rc==SQLITE_OK && !pNear->bEof ){
137013 fts3EvalNextRow(pCsr, pNear, &rc);
137014 if( bEofSave==0 && pNear->iDocid==iDocid ) break;
137015 }
 
 
137016 assert( rc!=SQLITE_OK || pPhrase->bIncr==0 );
137017 }
137018 if( bTreeEof ){
137019 while( rc==SQLITE_OK && !pNear->bEof ){
137020 fts3EvalNextRow(pCsr, pNear, &rc);
137021 }
137022 }
137023 if( rc!=SQLITE_OK ) return rc;
137024
137025 pIter = pPhrase->pOrPoslist;
137026 iDocid = pPhrase->iOrDocid;
137027 if( pCsr->bDesc==bDescDoclist ){
137028 bEof = (pIter >= (pPhrase->doclist.aAll + pPhrase->doclist.nAll));
137029 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){
137030 sqlite3Fts3DoclistNext(
137031 bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137032 &pIter, &iDocid, &bEof
137033 );
137034 }
137035 }else{
137036 bEof = !pPhrase->doclist.nAll || (pIter && pIter<=pPhrase->doclist.aAll);
137037 while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){
137038 int dummy;
137039 sqlite3Fts3DoclistPrev(
137040 bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll,
137041 &pIter, &iDocid, &dummy, &bEof
137042 );
137043 }
137044 }
137045 pPhrase->pOrPoslist = pIter;
137046 pPhrase->iOrDocid = iDocid;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137047
137048 if( bEof || iDocid!=pCsr->iPrevId ) pIter = 0;
137049 }
137050 if( pIter==0 ) return SQLITE_OK;
137051
@@ -137056,13 +137055,16 @@
137055 }else{
137056 iThis = 0;
137057 }
137058 while( iThis<iCol ){
137059 fts3ColumnlistCopy(0, &pIter);
137060 if( *pIter==0x00 ) return SQLITE_OK;
137061 pIter++;
137062 pIter += fts3GetVarint32(pIter, &iThis);
137063 }
137064 if( *pIter==0x00 ){
137065 pIter = 0;
137066 }
137067
137068 *ppOut = ((iCol==iThis)?pIter:0);
137069 return SQLITE_OK;
137070 }
@@ -147286,41 +147288,43 @@
147288 sIter.pCsr = pCsr;
147289 sIter.iCol = iCol;
147290 sIter.nSnippet = nSnippet;
147291 sIter.nPhrase = nList;
147292 sIter.iCurrent = -1;
147293 rc = fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter);
147294 if( rc==SQLITE_OK ){
147295
147296 /* Set the *pmSeen output variable. */
147297 for(i=0; i<nList; i++){
147298 if( sIter.aPhrase[i].pHead ){
147299 *pmSeen |= (u64)1 << i;
147300 }
147301 }
147302
147303 /* Loop through all candidate snippets. Store the best snippet in
147304 ** *pFragment. Store its associated 'score' in iBestScore.
147305 */
147306 pFragment->iCol = iCol;
147307 while( !fts3SnippetNextCandidate(&sIter) ){
147308 int iPos;
147309 int iScore;
147310 u64 mCover;
147311 u64 mHighlite;
147312 fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover,&mHighlite);
147313 assert( iScore>=0 );
147314 if( iScore>iBestScore ){
147315 pFragment->iPos = iPos;
147316 pFragment->hlmask = mHighlite;
147317 pFragment->covered = mCover;
147318 iBestScore = iScore;
147319 }
147320 }
147321
147322 *piScore = iBestScore;
147323 }
147324 sqlite3_free(sIter.aPhrase);
147325 return rc;
 
147326 }
147327
147328
147329 /*
147330 ** Append a string to the string-buffer passed as the first argument.
147331
+2 -2
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105105
**
106106
** See also: [sqlite3_libversion()],
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110
-#define SQLITE_VERSION "3.8.8.2"
110
+#define SQLITE_VERSION "3.8.8.3"
111111
#define SQLITE_VERSION_NUMBER 3008008
112
-#define SQLITE_SOURCE_ID "2015-01-30 14:30:45 7757fc721220e136620a89c9d28247f28bbbc098"
112
+#define SQLITE_SOURCE_ID "2015-02-25 13:29:11 9d6c1880fb75660bbabd693175579529785f8a6b"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.8.2"
111 #define SQLITE_VERSION_NUMBER 3008008
112 #define SQLITE_SOURCE_ID "2015-01-30 14:30:45 7757fc721220e136620a89c9d28247f28bbbc098"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -105,13 +105,13 @@
105 **
106 ** See also: [sqlite3_libversion()],
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.8.8.3"
111 #define SQLITE_VERSION_NUMBER 3008008
112 #define SQLITE_SOURCE_ID "2015-02-25 13:29:11 9d6c1880fb75660bbabd693175579529785f8a6b"
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