|
@@ -224,7 +224,7 @@ extern "C" {
|
|
|
*/
|
|
*/
|
|
|
#define SQLITE_VERSION "3.8.6"
|
|
#define SQLITE_VERSION "3.8.6"
|
|
|
#define SQLITE_VERSION_NUMBER 3008006
|
|
#define SQLITE_VERSION_NUMBER 3008006
|
|
|
-#define SQLITE_SOURCE_ID "2014-06-30 19:28:57 f925e9baafea625f63105f8013abb3807b418379"
|
|
|
|
|
|
|
+#define SQLITE_SOURCE_ID "2014-07-03 12:18:22 0cc0230ae9cfc9760fd8ef2c25e82576b052dbeb"
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
** CAPI3REF: Run-Time Library Version Numbers
|
|
@@ -84524,7 +84524,16 @@ static void initAvgEq(Index *pIdx){
|
|
|
IndexSample *aSample = pIdx->aSample;
|
|
IndexSample *aSample = pIdx->aSample;
|
|
|
IndexSample *pFinal = &aSample[pIdx->nSample-1];
|
|
IndexSample *pFinal = &aSample[pIdx->nSample-1];
|
|
|
int iCol;
|
|
int iCol;
|
|
|
- for(iCol=0; iCol<pIdx->nKeyCol; iCol++){
|
|
|
|
|
|
|
+ int nCol = 1;
|
|
|
|
|
+ if( pIdx->nSampleCol>1 ){
|
|
|
|
|
+ /* If this is stat4 data, then calculate aAvgEq[] values for all
|
|
|
|
|
+ ** sample columns except the last. The last is always set to 1, as
|
|
|
|
|
+ ** once the trailing PK fields are considered all index keys are
|
|
|
|
|
+ ** unique. */
|
|
|
|
|
+ nCol = pIdx->nSampleCol-1;
|
|
|
|
|
+ pIdx->aAvgEq[nCol] = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ for(iCol=0; iCol<nCol; iCol++){
|
|
|
int i; /* Used to iterate through samples */
|
|
int i; /* Used to iterate through samples */
|
|
|
tRowcnt sumEq = 0; /* Sum of the nEq values */
|
|
tRowcnt sumEq = 0; /* Sum of the nEq values */
|
|
|
tRowcnt nSum = 0; /* Number of terms contributing to sumEq */
|
|
tRowcnt nSum = 0; /* Number of terms contributing to sumEq */
|
|
@@ -84547,7 +84556,6 @@ static void initAvgEq(Index *pIdx){
|
|
|
}
|
|
}
|
|
|
if( avgEq==0 ) avgEq = 1;
|
|
if( avgEq==0 ) avgEq = 1;
|
|
|
pIdx->aAvgEq[iCol] = avgEq;
|
|
pIdx->aAvgEq[iCol] = avgEq;
|
|
|
- if( pIdx->nSampleCol==1 ) break;
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -84606,7 +84614,6 @@ static int loadStatTbl(
|
|
|
|
|
|
|
|
while( sqlite3_step(pStmt)==SQLITE_ROW ){
|
|
while( sqlite3_step(pStmt)==SQLITE_ROW ){
|
|
|
int nIdxCol = 1; /* Number of columns in stat4 records */
|
|
int nIdxCol = 1; /* Number of columns in stat4 records */
|
|
|
- int nAvgCol = 1; /* Number of entries in Index.aAvgEq */
|
|
|
|
|
|
|
|
|
|
char *zIndex; /* Index name */
|
|
char *zIndex; /* Index name */
|
|
|
Index *pIdx; /* Pointer to the index object */
|
|
Index *pIdx; /* Pointer to the index object */
|
|
@@ -84624,13 +84631,17 @@ static int loadStatTbl(
|
|
|
** loaded from the stat4 table. In this case ignore stat3 data. */
|
|
** loaded from the stat4 table. In this case ignore stat3 data. */
|
|
|
if( pIdx==0 || pIdx->nSample ) continue;
|
|
if( pIdx==0 || pIdx->nSample ) continue;
|
|
|
if( bStat3==0 ){
|
|
if( bStat3==0 ){
|
|
|
- nIdxCol = pIdx->nKeyCol+1;
|
|
|
|
|
- nAvgCol = pIdx->nKeyCol;
|
|
|
|
|
|
|
+ assert( !HasRowid(pIdx->pTable) || pIdx->nColumn==pIdx->nKeyCol+1 );
|
|
|
|
|
+ if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
|
|
|
|
|
+ nIdxCol = pIdx->nKeyCol;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ nIdxCol = pIdx->nColumn;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
pIdx->nSampleCol = nIdxCol;
|
|
pIdx->nSampleCol = nIdxCol;
|
|
|
nByte = sizeof(IndexSample) * nSample;
|
|
nByte = sizeof(IndexSample) * nSample;
|
|
|
nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample;
|
|
nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample;
|
|
|
- nByte += nAvgCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */
|
|
|
|
|
|
|
+ nByte += nIdxCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */
|
|
|
|
|
|
|
|
pIdx->aSample = sqlite3DbMallocZero(db, nByte);
|
|
pIdx->aSample = sqlite3DbMallocZero(db, nByte);
|
|
|
if( pIdx->aSample==0 ){
|
|
if( pIdx->aSample==0 ){
|
|
@@ -84638,7 +84649,7 @@ static int loadStatTbl(
|
|
|
return SQLITE_NOMEM;
|
|
return SQLITE_NOMEM;
|
|
|
}
|
|
}
|
|
|
pSpace = (tRowcnt*)&pIdx->aSample[nSample];
|
|
pSpace = (tRowcnt*)&pIdx->aSample[nSample];
|
|
|
- pIdx->aAvgEq = pSpace; pSpace += nAvgCol;
|
|
|
|
|
|
|
+ pIdx->aAvgEq = pSpace; pSpace += nIdxCol;
|
|
|
for(i=0; i<nSample; i++){
|
|
for(i=0; i<nSample; i++){
|
|
|
pIdx->aSample[i].anEq = pSpace; pSpace += nIdxCol;
|
|
pIdx->aSample[i].anEq = pSpace; pSpace += nIdxCol;
|
|
|
pIdx->aSample[i].anLt = pSpace; pSpace += nIdxCol;
|
|
pIdx->aSample[i].anLt = pSpace; pSpace += nIdxCol;
|
|
@@ -112384,7 +112395,7 @@ static void whereKeyStats(
|
|
|
iUpper = i>=pIdx->nSample ? nRow0 : aSample[i].anLt[iCol];
|
|
iUpper = i>=pIdx->nSample ? nRow0 : aSample[i].anLt[iCol];
|
|
|
iLower = aSample[i-1].anEq[iCol] + aSample[i-1].anLt[iCol];
|
|
iLower = aSample[i-1].anEq[iCol] + aSample[i-1].anLt[iCol];
|
|
|
}
|
|
}
|
|
|
- aStat[1] = (pIdx->nKeyCol>iCol ? pIdx->aAvgEq[iCol] : 1);
|
|
|
|
|
|
|
+ aStat[1] = pIdx->aAvgEq[iCol];
|
|
|
if( iLower>=iUpper ){
|
|
if( iLower>=iUpper ){
|
|
|
iGap = 0;
|
|
iGap = 0;
|
|
|
}else{
|
|
}else{
|
|
@@ -127724,7 +127735,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
|
|
|
SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);
|
|
SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);
|
|
|
|
|
|
|
|
/* fts3_unicode2.c (functions generated by parsing unicode text files) */
|
|
/* fts3_unicode2.c (functions generated by parsing unicode text files) */
|
|
|
-#ifdef SQLITE_ENABLE_FTS4_UNICODE61
|
|
|
|
|
|
|
+#ifndef SQLITE_DISABLE_FTS3_UNICODE
|
|
|
SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
|
|
SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
|
|
|
SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
|
|
SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
|
|
|
SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int);
|
|
SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int);
|
|
@@ -131194,7 +131205,7 @@ static void hashDestroy(void *p){
|
|
|
*/
|
|
*/
|
|
|
SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);
|
|
SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);
|
|
|
SQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule);
|
|
SQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule);
|
|
|
-#ifdef SQLITE_ENABLE_FTS4_UNICODE61
|
|
|
|
|
|
|
+#ifndef SQLITE_DISABLE_FTS3_UNICODE
|
|
|
SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const**ppModule);
|
|
SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const**ppModule);
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef SQLITE_ENABLE_ICU
|
|
#ifdef SQLITE_ENABLE_ICU
|
|
@@ -131224,7 +131235,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
|
|
|
sqlite3Fts3IcuTokenizerModule(&pIcu);
|
|
sqlite3Fts3IcuTokenizerModule(&pIcu);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
-#ifdef SQLITE_ENABLE_FTS4_UNICODE61
|
|
|
|
|
|
|
+#ifdef SQLITE_ENABLE_FTS3_UNICODE
|
|
|
sqlite3Fts3UnicodeTokenizer(&pUnicode);
|
|
sqlite3Fts3UnicodeTokenizer(&pUnicode);
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
@@ -131253,7 +131264,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
|
|
|
if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple)
|
|
if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple)
|
|
|
|| sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter)
|
|
|| sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter)
|
|
|
|| sqlite3Fts3HashInsert(pHash, "sublatin", 9, (void *)pSubLatin)
|
|
|| sqlite3Fts3HashInsert(pHash, "sublatin", 9, (void *)pSubLatin)
|
|
|
-#ifdef SQLITE_ENABLE_FTS4_UNICODE61
|
|
|
|
|
|
|
+#ifdef SQLITE_ENABLE_FTS3_UNICODE
|
|
|
|| sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode)
|
|
|| sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode)
|
|
|
#endif
|
|
#endif
|
|
|
#ifdef SQLITE_ENABLE_ICU
|
|
#ifdef SQLITE_ENABLE_ICU
|
|
@@ -144854,7 +144865,7 @@ SQLITE_PRIVATE void sqlite3Fts3SubLatinTokenizerModule(
|
|
|
** Implementation of the "unicode" full-text-search tokenizer.
|
|
** Implementation of the "unicode" full-text-search tokenizer.
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-#ifdef SQLITE_ENABLE_FTS4_UNICODE61
|
|
|
|
|
|
|
+#ifndef SQLITE_DISABLE_FTS3_UNICODE
|
|
|
|
|
|
|
|
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
|
|
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
|
|
|
|
|
|
|
@@ -145229,7 +145240,7 @@ SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const *
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
|
|
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
|
|
|
-#endif /* ifndef SQLITE_ENABLE_FTS4_UNICODE61 */
|
|
|
|
|
|
|
+#endif /* ifndef SQLITE_DISABLE_FTS3_UNICODE */
|
|
|
|
|
|
|
|
/************** End of fts3_unicode.c ****************************************/
|
|
/************** End of fts3_unicode.c ****************************************/
|
|
|
/************** Begin file fts3_unicode2.c ***********************************/
|
|
/************** Begin file fts3_unicode2.c ***********************************/
|
|
@@ -145250,7 +145261,7 @@ SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const *
|
|
|
** DO NOT EDIT THIS MACHINE GENERATED FILE.
|
|
** DO NOT EDIT THIS MACHINE GENERATED FILE.
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
-#if defined(SQLITE_ENABLE_FTS4_UNICODE61)
|
|
|
|
|
|
|
+#ifndef SQLITE_DISABLE_FTS3_UNICODE
|
|
|
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
|
#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4)
|
|
|
|
|
|
|
|
/* #include <assert.h> */
|
|
/* #include <assert.h> */
|
|
@@ -145597,7 +145608,7 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int bRemoveDiacritic){
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|
|
|
#endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
|
|
#endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */
|
|
|
-#endif /* !defined(SQLITE_ENABLE_FTS4_UNICODE61) */
|
|
|
|
|
|
|
+#endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */
|
|
|
|
|
|
|
|
/************** End of fts3_unicode2.c ***************************************/
|
|
/************** End of fts3_unicode2.c ***************************************/
|
|
|
/************** Begin file rtree.c *******************************************/
|
|
/************** Begin file rtree.c *******************************************/
|