From: drh Date: Fri, 14 Feb 2014 20:59:53 +0000 (+0000) Subject: Reduce the number of cases where it is necessary to check for NULL after X-Git-Tag: version-3.8.4~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f78da0e6afdadd579247630c21a80dda3c906ebd;p=thirdparty%2Fsqlite.git Reduce the number of cases where it is necessary to check for NULL after the loop terminating condition. FossilOrigin-Name: 3c1ae447dec8fc2af1c5105134061717594ac0e0 --- diff --git a/manifest b/manifest index b85a23bdd5..d8dd849567 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sOP_IdxGT\sand\sOP_IdxLE\sas\sdistinct\sopcodes.\s\sFormerly\sthese\soperations\swhere\ndone\susing\sOP_IdxGE\sand\sOP_IdxLT\swith\sthe\sP5\sflag\sset.\s\sBut\sVDBE\scode\sis\seasier\nto\sread\swith\sdistinct\sopcode\snames.\s\sAlso\schange\sOP_SeekGe\sto\sOP_SeekGE,\sand\nso\sforth,\sso\sthat\sthe\scapitalization\sis\sconsistent.\s\sThe\swhole\spoint\sof\sthis\nchange\sis\sto\simprove\sthe\sreadability\sof\sVDBE\slistings. -D 2014-02-14T15:13:36.850 +C Reduce\sthe\snumber\sof\scases\swhere\sit\sis\snecessary\sto\scheck\sfor\sNULL\safter\nthe\sloop\sterminating\scondition. +D 2014-02-14T20:59:53.587 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -290,7 +290,7 @@ F src/vtab.c 21b932841e51ebd7d075e2d0ad1415dce8d2d5fd F src/wal.c 76e7fc6de229bea8b30bb2539110f03a494dc3a8 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4 F src/walker.c 11edb74d587bc87b33ca96a5173e3ec1b8389e45 -F src/where.c 43eb827f10d90972578eb0759d01bf0094fcb8c7 +F src/where.c bf849f08ee09f15e507b5d5f4bc5b608761d5fe2 F src/whereInt.h 921f935af8b684ffb49705610bda7284db1db138 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 @@ -1150,7 +1150,7 @@ F tool/vdbe-compress.tcl 0cf56e9263a152b84da86e75a5c0cdcdb7a47891 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 9e573198e107f1b85ee37c52a10343d38968bda1 -R 761a583803ea417c3e82fa617fd0a139 +P b6bea903ac8e1717ed50b221d73bd0be061c7663 +R f976ccc3e6f99e20be380cc680402b19 U drh -Z 39171055bea51b7fba314c7bdb8e0ff5 +Z d8a7427791a9ddd9c5e417477ea3c5a6 diff --git a/manifest.uuid b/manifest.uuid index 7c4fe4fd3a..3ff1fc2f3d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b6bea903ac8e1717ed50b221d73bd0be061c7663 \ No newline at end of file +3c1ae447dec8fc2af1c5105134061717594ac0e0 \ No newline at end of file diff --git a/src/where.c b/src/where.c index 94e939e27f..96ee0e931e 100644 --- a/src/where.c +++ b/src/where.c @@ -3134,17 +3134,15 @@ static Bitmask codeOneLoopStart( sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); } - /* If there are inequality constraints, check that the value - ** of the table column that the inequality contrains is not NULL. - ** If it is, jump to the next iteration of the loop. + /* If there are inequality constraint upper bound but not a lower + ** bound, then check that the value of the table column that the + ** inequality contrains is not NULL since there is alway an implied + ** lower bound of "column>NULL". */ r1 = sqlite3GetTempReg(pParse); - testcase( pLoop->wsFlags & WHERE_BTM_LIMIT ); - testcase( pLoop->wsFlags & WHERE_TOP_LIMIT ); - if( (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 + if( (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==WHERE_TOP_LIMIT && (j = pIdx->aiColumn[nEq])>=0 && pIdx->pTable->aCol[j].notNull==0 - && (nEq || (pLoop->wsFlags & WHERE_BTM_LIMIT)==0) ){ sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1); VdbeComment((v, "%s", pIdx->pTable->aCol[j].zName));