1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Add two NEVER() operators in the sqlite3BtreeRowCountEst() routine.

FossilOrigin-Name: 7a959f6d1ea038988cdb4c02d6f37abaec2580a0
This commit is contained in:
drh
2017-02-23 02:15:33 +00:00
parent bce0414844
commit 555227bec0
3 changed files with 14 additions and 9 deletions

View File

@@ -5330,8 +5330,13 @@ i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
assert( cursorOwnsBtShared(pCur) );
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
if( pCur->eState!=CURSOR_VALID ) return -1;
if( pCur->apPage[pCur->iPage]->leaf==0 ) return -1;
/* Currently this interface is only called by the OP_IfSmaller
** opcode, and it that case the cursor will always be valid and
** will always point to a leaf node. */
if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
if( NEVER(pCur->apPage[pCur->iPage]->leaf==0) ) return -1;
for(n=1, i=0; i<=pCur->iPage; i++){
n *= pCur->apPage[i]->nCell;
}