Fossil SCM

Update the built-in SQLite from upstream, taking over Joe's fix fror MSVC (reported by Ross Berteig)

jan.nijtmans 2013-09-04 11:30 trunk
Commit 9aae838b8b4a18e5c4beb86066fe5c58ea233022
2 files changed +14 -7 +1 -1
+14 -7
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -656,11 +656,11 @@
656656
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
657657
** [sqlite_version()] and [sqlite_source_id()].
658658
*/
659659
#define SQLITE_VERSION "3.8.1"
660660
#define SQLITE_VERSION_NUMBER 3008001
661
-#define SQLITE_SOURCE_ID "2013-09-03 14:43:12 d59f580904e6e7e90fc0a692a3dd4eeff5942479"
661
+#define SQLITE_SOURCE_ID "2013-09-04 04:04:08 8df95bb0b3f72222cf262174247a467c234f9939"
662662
663663
/*
664664
** CAPI3REF: Run-Time Library Version Numbers
665665
** KEYWORDS: sqlite3_version, sqlite3_sourceid
666666
**
@@ -81512,10 +81512,11 @@
8151281512
Stat4Sample *pSample;
8151381513
int i;
8151481514
8151581515
assert( IsStat4 || nEqZero==0 );
8151681516
81517
+#ifdef SQLITE_ENABLE_STAT4
8151781518
if( pNew->isPSample==0 ){
8151881519
Stat4Sample *pUpgrade = 0;
8151981520
assert( pNew->anEq[pNew->iCol]>0 );
8152081521
8152181522
/* This sample is being added because the prefix that ends in column
@@ -81538,10 +81539,11 @@
8153881539
pUpgrade->iCol = pNew->iCol;
8153981540
pUpgrade->anEq[pUpgrade->iCol] = pNew->anEq[pUpgrade->iCol];
8154081541
goto find_new_min;
8154181542
}
8154281543
}
81544
+#endif
8154381545
8154481546
/* If necessary, remove sample iMin to make room for the new sample. */
8154581547
if( p->nSample>=p->mxSample ){
8154681548
Stat4Sample *pMin = &p->a[p->iMin];
8154781549
tRowcnt *anEq = pMin->anEq;
@@ -81569,11 +81571,13 @@
8156981571
p->nSample++;
8157081572
8157181573
/* Zero the first nEqZero entries in the anEq[] array. */
8157281574
memset(pSample->anEq, 0, sizeof(tRowcnt)*nEqZero);
8157381575
81576
+#ifdef SQLITE_ENABLE_STAT4
8157481577
find_new_min:
81578
+#endif
8157581579
if( p->nSample>=p->mxSample ){
8157681580
int iMin = -1;
8157781581
for(i=0; i<p->mxSample; i++){
8157881582
if( p->a[i].isPSample ) continue;
8157981583
if( iMin<0 || sampleIsBetter(p, &p->a[iMin], &p->a[i]) ){
@@ -108194,16 +108198,19 @@
108194108198
UnpackedRecord *pRec, /* Vector of values to consider */
108195108199
int roundUp, /* Round up if true. Round down if false */
108196108200
tRowcnt *aStat /* OUT: stats written here */
108197108201
){
108198108202
IndexSample *aSample = pIdx->aSample;
108199
- int iCol = pRec->nField-1; /* Index of required stats in anEq[] etc. */
108203
+ int iCol; /* Index of required stats in anEq[] etc. */
108200108204
int iMin = 0; /* Smallest sample not yet tested */
108201108205
int i = pIdx->nSample; /* Smallest sample larger than or equal to pRec */
108202108206
int iTest; /* Next sample to test */
108203108207
int res; /* Result of comparison operation */
108204108208
108209
+ assert( pRec!=0 || pParse->db->mallocFailed );
108210
+ if( pRec==0 ) return;
108211
+ iCol = pRec->nField - 1;
108205108212
assert( pIdx->nSample>0 );
108206108213
assert( pRec->nField>0 && iCol<pIdx->nSampleCol );
108207108214
do{
108208108215
iTest = (iMin+i)/2;
108209108216
res = sqlite3VdbeRecordCompare(aSample[iTest].n, aSample[iTest].p, pRec);
@@ -108327,15 +108334,10 @@
108327108334
&& OptimizationEnabled(pParse->db, SQLITE_Stat3)
108328108335
){
108329108336
UnpackedRecord *pRec = pBuilder->pRec;
108330108337
tRowcnt a[2];
108331108338
u8 aff;
108332
- if( nEq==p->nColumn ){
108333
- aff = SQLITE_AFF_INTEGER;
108334
- }else{
108335
- aff = p->pTable->aCol[p->aiColumn[nEq]].affinity;
108336
- }
108337108339
108338108340
/* Variable iLower will be set to the estimate of the number of rows in
108339108341
** the index that are less than the lower bound of the range query. The
108340108342
** lower bound being the concatenation of $P and $L, where $P is the
108341108343
** key-prefix formed by the nEq values matched against the nEq left-most
@@ -108353,10 +108355,15 @@
108353108355
** of iUpper are requested of whereKeyStats() and the smaller used.
108354108356
*/
108355108357
tRowcnt iLower;
108356108358
tRowcnt iUpper;
108357108359
108360
+ if( nEq==p->nColumn ){
108361
+ aff = SQLITE_AFF_INTEGER;
108362
+ }else{
108363
+ aff = p->pTable->aCol[p->aiColumn[nEq]].affinity;
108364
+ }
108358108365
/* Determine iLower and iUpper using ($P) only. */
108359108366
if( nEq==0 ){
108360108367
iLower = 0;
108361108368
iUpper = p->aiRowEst[0];
108362108369
}else{
108363108370
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -656,11 +656,11 @@
656 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
657 ** [sqlite_version()] and [sqlite_source_id()].
658 */
659 #define SQLITE_VERSION "3.8.1"
660 #define SQLITE_VERSION_NUMBER 3008001
661 #define SQLITE_SOURCE_ID "2013-09-03 14:43:12 d59f580904e6e7e90fc0a692a3dd4eeff5942479"
662
663 /*
664 ** CAPI3REF: Run-Time Library Version Numbers
665 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
666 **
@@ -81512,10 +81512,11 @@
81512 Stat4Sample *pSample;
81513 int i;
81514
81515 assert( IsStat4 || nEqZero==0 );
81516
 
81517 if( pNew->isPSample==0 ){
81518 Stat4Sample *pUpgrade = 0;
81519 assert( pNew->anEq[pNew->iCol]>0 );
81520
81521 /* This sample is being added because the prefix that ends in column
@@ -81538,10 +81539,11 @@
81538 pUpgrade->iCol = pNew->iCol;
81539 pUpgrade->anEq[pUpgrade->iCol] = pNew->anEq[pUpgrade->iCol];
81540 goto find_new_min;
81541 }
81542 }
 
81543
81544 /* If necessary, remove sample iMin to make room for the new sample. */
81545 if( p->nSample>=p->mxSample ){
81546 Stat4Sample *pMin = &p->a[p->iMin];
81547 tRowcnt *anEq = pMin->anEq;
@@ -81569,11 +81571,13 @@
81569 p->nSample++;
81570
81571 /* Zero the first nEqZero entries in the anEq[] array. */
81572 memset(pSample->anEq, 0, sizeof(tRowcnt)*nEqZero);
81573
 
81574 find_new_min:
 
81575 if( p->nSample>=p->mxSample ){
81576 int iMin = -1;
81577 for(i=0; i<p->mxSample; i++){
81578 if( p->a[i].isPSample ) continue;
81579 if( iMin<0 || sampleIsBetter(p, &p->a[iMin], &p->a[i]) ){
@@ -108194,16 +108198,19 @@
108194 UnpackedRecord *pRec, /* Vector of values to consider */
108195 int roundUp, /* Round up if true. Round down if false */
108196 tRowcnt *aStat /* OUT: stats written here */
108197 ){
108198 IndexSample *aSample = pIdx->aSample;
108199 int iCol = pRec->nField-1; /* Index of required stats in anEq[] etc. */
108200 int iMin = 0; /* Smallest sample not yet tested */
108201 int i = pIdx->nSample; /* Smallest sample larger than or equal to pRec */
108202 int iTest; /* Next sample to test */
108203 int res; /* Result of comparison operation */
108204
 
 
 
108205 assert( pIdx->nSample>0 );
108206 assert( pRec->nField>0 && iCol<pIdx->nSampleCol );
108207 do{
108208 iTest = (iMin+i)/2;
108209 res = sqlite3VdbeRecordCompare(aSample[iTest].n, aSample[iTest].p, pRec);
@@ -108327,15 +108334,10 @@
108327 && OptimizationEnabled(pParse->db, SQLITE_Stat3)
108328 ){
108329 UnpackedRecord *pRec = pBuilder->pRec;
108330 tRowcnt a[2];
108331 u8 aff;
108332 if( nEq==p->nColumn ){
108333 aff = SQLITE_AFF_INTEGER;
108334 }else{
108335 aff = p->pTable->aCol[p->aiColumn[nEq]].affinity;
108336 }
108337
108338 /* Variable iLower will be set to the estimate of the number of rows in
108339 ** the index that are less than the lower bound of the range query. The
108340 ** lower bound being the concatenation of $P and $L, where $P is the
108341 ** key-prefix formed by the nEq values matched against the nEq left-most
@@ -108353,10 +108355,15 @@
108353 ** of iUpper are requested of whereKeyStats() and the smaller used.
108354 */
108355 tRowcnt iLower;
108356 tRowcnt iUpper;
108357
 
 
 
 
 
108358 /* Determine iLower and iUpper using ($P) only. */
108359 if( nEq==0 ){
108360 iLower = 0;
108361 iUpper = p->aiRowEst[0];
108362 }else{
108363
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -656,11 +656,11 @@
656 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
657 ** [sqlite_version()] and [sqlite_source_id()].
658 */
659 #define SQLITE_VERSION "3.8.1"
660 #define SQLITE_VERSION_NUMBER 3008001
661 #define SQLITE_SOURCE_ID "2013-09-04 04:04:08 8df95bb0b3f72222cf262174247a467c234f9939"
662
663 /*
664 ** CAPI3REF: Run-Time Library Version Numbers
665 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
666 **
@@ -81512,10 +81512,11 @@
81512 Stat4Sample *pSample;
81513 int i;
81514
81515 assert( IsStat4 || nEqZero==0 );
81516
81517 #ifdef SQLITE_ENABLE_STAT4
81518 if( pNew->isPSample==0 ){
81519 Stat4Sample *pUpgrade = 0;
81520 assert( pNew->anEq[pNew->iCol]>0 );
81521
81522 /* This sample is being added because the prefix that ends in column
@@ -81538,10 +81539,11 @@
81539 pUpgrade->iCol = pNew->iCol;
81540 pUpgrade->anEq[pUpgrade->iCol] = pNew->anEq[pUpgrade->iCol];
81541 goto find_new_min;
81542 }
81543 }
81544 #endif
81545
81546 /* If necessary, remove sample iMin to make room for the new sample. */
81547 if( p->nSample>=p->mxSample ){
81548 Stat4Sample *pMin = &p->a[p->iMin];
81549 tRowcnt *anEq = pMin->anEq;
@@ -81569,11 +81571,13 @@
81571 p->nSample++;
81572
81573 /* Zero the first nEqZero entries in the anEq[] array. */
81574 memset(pSample->anEq, 0, sizeof(tRowcnt)*nEqZero);
81575
81576 #ifdef SQLITE_ENABLE_STAT4
81577 find_new_min:
81578 #endif
81579 if( p->nSample>=p->mxSample ){
81580 int iMin = -1;
81581 for(i=0; i<p->mxSample; i++){
81582 if( p->a[i].isPSample ) continue;
81583 if( iMin<0 || sampleIsBetter(p, &p->a[iMin], &p->a[i]) ){
@@ -108194,16 +108198,19 @@
108198 UnpackedRecord *pRec, /* Vector of values to consider */
108199 int roundUp, /* Round up if true. Round down if false */
108200 tRowcnt *aStat /* OUT: stats written here */
108201 ){
108202 IndexSample *aSample = pIdx->aSample;
108203 int iCol; /* Index of required stats in anEq[] etc. */
108204 int iMin = 0; /* Smallest sample not yet tested */
108205 int i = pIdx->nSample; /* Smallest sample larger than or equal to pRec */
108206 int iTest; /* Next sample to test */
108207 int res; /* Result of comparison operation */
108208
108209 assert( pRec!=0 || pParse->db->mallocFailed );
108210 if( pRec==0 ) return;
108211 iCol = pRec->nField - 1;
108212 assert( pIdx->nSample>0 );
108213 assert( pRec->nField>0 && iCol<pIdx->nSampleCol );
108214 do{
108215 iTest = (iMin+i)/2;
108216 res = sqlite3VdbeRecordCompare(aSample[iTest].n, aSample[iTest].p, pRec);
@@ -108327,15 +108334,10 @@
108334 && OptimizationEnabled(pParse->db, SQLITE_Stat3)
108335 ){
108336 UnpackedRecord *pRec = pBuilder->pRec;
108337 tRowcnt a[2];
108338 u8 aff;
 
 
 
 
 
108339
108340 /* Variable iLower will be set to the estimate of the number of rows in
108341 ** the index that are less than the lower bound of the range query. The
108342 ** lower bound being the concatenation of $P and $L, where $P is the
108343 ** key-prefix formed by the nEq values matched against the nEq left-most
@@ -108353,10 +108355,15 @@
108355 ** of iUpper are requested of whereKeyStats() and the smaller used.
108356 */
108357 tRowcnt iLower;
108358 tRowcnt iUpper;
108359
108360 if( nEq==p->nColumn ){
108361 aff = SQLITE_AFF_INTEGER;
108362 }else{
108363 aff = p->pTable->aCol[p->aiColumn[nEq]].affinity;
108364 }
108365 /* Determine iLower and iUpper using ($P) only. */
108366 if( nEq==0 ){
108367 iLower = 0;
108368 iUpper = p->aiRowEst[0];
108369 }else{
108370
+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.1"
111111
#define SQLITE_VERSION_NUMBER 3008001
112
-#define SQLITE_SOURCE_ID "2013-09-03 14:43:12 d59f580904e6e7e90fc0a692a3dd4eeff5942479"
112
+#define SQLITE_SOURCE_ID "2013-09-04 04:04:08 8df95bb0b3f72222cf262174247a467c234f9939"
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.1"
111 #define SQLITE_VERSION_NUMBER 3008001
112 #define SQLITE_SOURCE_ID "2013-09-03 14:43:12 d59f580904e6e7e90fc0a692a3dd4eeff5942479"
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.1"
111 #define SQLITE_VERSION_NUMBER 3008001
112 #define SQLITE_SOURCE_ID "2013-09-04 04:04:08 8df95bb0b3f72222cf262174247a467c234f9939"
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