aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-03-17 13:41:51 +0000
committerdrh <drh@noemail.net>2020-03-17 13:41:51 +0000
commite50478d7279b72a9df4836729c9974abfbce08ff (patch)
tree2814321be4903ccb3ed423f4ef62ba9ab946fd1c /src
parentdc4a1687b8b53a4464bbffaf351e25305b6a525e (diff)
downloadsqlite-e50478d7279b72a9df4836729c9974abfbce08ff.tar.gz
sqlite-e50478d7279b72a9df4836729c9974abfbce08ff.zip
Remove the SQLITE_OMIT_BTREECOUNT option. Btree count is required.
FossilOrigin-Name: a9bfa47aeea27e91611ba913d33e6635d2016e2c2ab78f9b0657f1bd8933e1a8
Diffstat (limited to 'src')
-rw-r--r--src/analyze.c14
-rw-r--r--src/btree.c2
-rw-r--r--src/btree.h2
-rw-r--r--src/ctime.c3
-rw-r--r--src/pragma.c2
-rw-r--r--src/select.c5
-rw-r--r--src/vdbe.c2
7 files changed, 9 insertions, 21 deletions
diff --git a/src/analyze.c b/src/analyze.c
index d74687fec..0df9297b7 100644
--- a/src/analyze.c
+++ b/src/analyze.c
@@ -407,7 +407,8 @@ static void statInit(
int n; /* Bytes of space to allocate */
sqlite3 *db; /* Database connection */
#ifdef SQLITE_ENABLE_STAT4
- int mxSample = sqlite3_value_int(argv[2]) ? SQLITE_STAT4_SAMPLES : 0;
+ /* Maximum number of samples. 0 if STAT4 data is not collected */
+ int mxSample = sqlite3_value_int64(argv[2]) ? SQLITE_STAT4_SAMPLES : 0;
#endif
/* Decode the three function arguments */
@@ -422,13 +423,14 @@ static void statInit(
/* Allocate the space required for the StatAccum object */
n = sizeof(*p)
+ sizeof(tRowcnt)*nColUp /* StatAccum.anEq */
- + sizeof(tRowcnt)*nColUp /* StatAccum.anDLt */
+ + sizeof(tRowcnt)*nColUp; /* StatAccum.anDLt */
#ifdef SQLITE_ENABLE_STAT4
- + sizeof(tRowcnt)*nColUp /* StatAccum.anLt */
- + sizeof(StatSample)*(nCol+mxSample) /* StatAccum.aBest[], a[] */
- + sizeof(tRowcnt)*3*nColUp*(nCol+mxSample)
+ if( mxSample ){
+ n += sizeof(tRowcnt)*nColUp /* StatAccum.anLt */
+ + sizeof(StatSample)*(nCol+mxSample) /* StatAccum.aBest[], a[] */
+ + sizeof(tRowcnt)*3*nColUp*(nCol+mxSample);
+ }
#endif
- ;
db = sqlite3_context_db_handle(context);
p = sqlite3DbMallocZero(db, n);
if( p==0 ){
diff --git a/src/btree.c b/src/btree.c
index 083968391..c2103819c 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -9508,7 +9508,6 @@ int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){
return rc;
}
-#ifndef SQLITE_OMIT_BTREECOUNT
/*
** The first argument, pCur, is a cursor opened on some b-tree. Count the
** number of entries in the b-tree and write the result to *pnEntry.
@@ -9581,7 +9580,6 @@ int sqlite3BtreeCount(sqlite3 *db, BtCursor *pCur, i64 *pnEntry){
/* An error has occurred. Return an error code. */
return rc;
}
-#endif
/*
** Return the pager associated with a BTree. This routine is used for
diff --git a/src/btree.h b/src/btree.h
index 4bd41f7f3..2085c0767 100644
--- a/src/btree.h
+++ b/src/btree.h
@@ -336,9 +336,7 @@ int sqlite3BtreeCursorIsValid(BtCursor*);
#endif
int sqlite3BtreeCursorIsValidNN(BtCursor*);
-#ifndef SQLITE_OMIT_BTREECOUNT
int sqlite3BtreeCount(sqlite3*, BtCursor*, i64*);
-#endif
#ifdef SQLITE_TEST
int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
diff --git a/src/ctime.c b/src/ctime.c
index 7a2ace931..336b912e9 100644
--- a/src/ctime.c
+++ b/src/ctime.c
@@ -511,9 +511,6 @@ static const char * const sqlite3azCompileOpt[] = {
#if SQLITE_OMIT_BLOB_LITERAL
"OMIT_BLOB_LITERAL",
#endif
-#if SQLITE_OMIT_BTREECOUNT
- "OMIT_BTREECOUNT",
-#endif
#if SQLITE_OMIT_CAST
"OMIT_CAST",
#endif
diff --git a/src/pragma.c b/src/pragma.c
index c5b5bb667..e2c625549 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -1729,7 +1729,6 @@ void sqlite3Pragma(
}
sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);
sqlite3VdbeJumpHere(v, loopTop-1);
-#ifndef SQLITE_OMIT_BTREECOUNT
if( !isQuick ){
sqlite3VdbeLoadString(v, 2, "wrong # of entries in index ");
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
@@ -1743,7 +1742,6 @@ void sqlite3Pragma(
sqlite3VdbeJumpHere(v, addr);
}
}
-#endif /* SQLITE_OMIT_BTREECOUNT */
}
}
{
diff --git a/src/select.c b/src/select.c
index 3128d482a..fcd2a35eb 100644
--- a/src/select.c
+++ b/src/select.c
@@ -6619,7 +6619,6 @@ int sqlite3Select(
} /* endif pGroupBy. Begin aggregate queries without GROUP BY: */
else {
-#ifndef SQLITE_OMIT_BTREECOUNT
Table *pTab;
if( (pTab = isSimpleCount(p, &sAggInfo))!=0 ){
/* If isSimpleCount() returns a pointer to a Table structure, then
@@ -6677,9 +6676,7 @@ int sqlite3Select(
sqlite3VdbeAddOp2(v, OP_Count, iCsr, sAggInfo.aFunc[0].iMem);
sqlite3VdbeAddOp1(v, OP_Close, iCsr);
explainSimpleCount(pParse, pTab, pBest);
- }else
-#endif /* SQLITE_OMIT_BTREECOUNT */
- {
+ }else{
int regAcc = 0; /* "populate accumulators" flag */
/* If there are accumulator registers but no min() or max() functions
diff --git a/src/vdbe.c b/src/vdbe.c
index 7f0532866..246442b47 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -3193,7 +3193,6 @@ case OP_MakeRecord: {
** Store the number of entries (an integer value) in the table or index
** opened by cursor P1 in register P2
*/
-#ifndef SQLITE_OMIT_BTREECOUNT
case OP_Count: { /* out2 */
i64 nEntry;
BtCursor *pCrsr;
@@ -3208,7 +3207,6 @@ case OP_Count: { /* out2 */
pOut->u.i = nEntry;
goto check_for_interrupt;
}
-#endif
/* Opcode: Savepoint P1 * * P4 *
**