From: drh Date: Thu, 23 Feb 2017 02:15:33 +0000 (+0000) Subject: Add two NEVER() operators in the sqlite3BtreeRowCountEst() routine. X-Git-Tag: version-3.18.0~81^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=555227bec07e99dddb8b9113d329e48caeba5131;p=thirdparty%2Fsqlite.git Add two NEVER() operators in the sqlite3BtreeRowCountEst() routine. FossilOrigin-Name: 7a959f6d1ea038988cdb4c02d6f37abaec2580a0 --- diff --git a/manifest b/manifest index 9a9acb5caa..39c4d8e77a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\sa\ssingle\sOP_Expire\sat\sthe\svery\send\sof\s"PRAGMA\soptimize",\sand\somit\sthe\nOP_Expire\son\sANALYZE\scommands\sinvoked\sby\sthe\spragma. -D 2017-02-23T00:58:36.868 +C Add\stwo\sNEVER()\soperators\sin\sthe\ssqlite3BtreeRowCountEst()\sroutine. +D 2017-02-23T02:15:33.201 F Makefile.in edb6bcdd37748d2b1c3422ff727c748df7ffe918 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc a89ea37ab5928026001569f056973b9059492fe2 @@ -338,7 +338,7 @@ F src/auth.c 930b376a9c56998557367e6f7f8aaeac82a2a792 F src/backup.c faf17e60b43233c214aae6a8179d24503a61e83b F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33 F src/btmutex.c 0e9ce2d56159b89b9bc8e197e023ee11e39ff8ca -F src/btree.c a4ab1fb5cdeea88c4f76216e41cfecfa505c8c43 +F src/btree.c 19746a7db19308053ff6cb2ac002834822809e54 F src/btree.h bf64dfeeddeebdb775a5eba0098bbc00d073290d F src/btreeInt.h cd55d39d9916270837a88c12e701047cba0729b0 F src/build.c 43f903c9082040ced2b421543cb0300c2973647d @@ -1558,7 +1558,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 9fced545a6f80c55d6dc4a6106cb2d3569566b3e -R 5ab35d2cee04a5e705af62d3884bb598 +P 188300a337c87b7ee0dd1f4b9a4f1bd80e70cca4 +R ea4c0d1070247cd8f7e1aa7ed210345c U drh -Z d17aa4a4e286313b851b7686a8b74646 +Z 01ff8d763fbc7e4c3e39020edd5b116b diff --git a/manifest.uuid b/manifest.uuid index 7b7c25203c..1e1b04c82c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -188300a337c87b7ee0dd1f4b9a4f1bd80e70cca4 \ No newline at end of file +7a959f6d1ea038988cdb4c02d6f37abaec2580a0 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 4d31661f10..788a2d4d03 100644 --- a/src/btree.c +++ b/src/btree.c @@ -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; }