]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add testcase() macros to the automatic index logic to insure that boundary
authordrh <drh@noemail.net>
Thu, 8 Apr 2010 14:15:56 +0000 (14:15 +0000)
committerdrh <drh@noemail.net>
Thu, 8 Apr 2010 14:15:56 +0000 (14:15 +0000)
cases are tested.

FossilOrigin-Name: 7286547847721b8f5f64bc2e7dc236652b1ae985

manifest
manifest.uuid
src/where.c

index 0d26d08bf7685f05dd3889d482a1e188bb86af5b..4c381152ebd1e4a21d6223ad63ce4882c3df1c8c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,8 @@
-C Make\ssure\sF_OK,\sR_OK,\sand\sW_OK\sare\sdefined\sin\stest_demovfs.c.\s\sDefine\sthem\smanually\nif\sthey\sare\snot.\s\sThis\sis\snecessary\sto\sget\sthe\smodule\sto\scompile\son\ssome\ssystems.
-D 2010-04-08T11:35:19
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+C Add\stestcase()\smacros\sto\sthe\sautomatic\sindex\slogic\sto\sinsure\sthat\sboundary\ncases\sare\stested.
+D 2010-04-08T14:15:56
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 4f2f967b7e58a35bb74fb7ec8ae90e0f4ca7868b
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -222,7 +225,7 @@ F src/vdbemem.c 2a82f455f6ca6f78b59fb312f96054c04ae0ead1
 F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2
 F src/vtab.c a0f8a40274e4261696ef57aa806de2776ab72cda
 F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f
-F src/where.c 28c270dc93828e36392ddf85b9fd9400303c589c
+F src/where.c 3a4a32910f4b283648ca60e099597d784640419d
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87
 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45
@@ -796,7 +799,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P bf7b8d863665870a38f0b2335cc71de856a515b4
-R d5c1c467a2fe159dee9601f419d531a4
+P 7c8afc3272fa91e2b5685b009eb674dbc1b5920d
+R ce7264333c7e3b80e3480a436a772632
 U drh
-Z 3c255bfefa1bd6638573105dd556d073
+Z 93a751d218d1476c4e95c450f3e4b2fe
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.6 (GNU/Linux)
+
+iD4DBQFLveUfoxKgR168RlERAlK0AJizHi/WZt4pZH5D99H7Lruh8t+CAJ4npcDg
+ufDfCArvIerz7SKlqMzbFg==
+=6X+r
+-----END PGP SIGNATURE-----
index dd6daf7d9ae50b7d48c364e92326b5dae800824f..f3d2c4c9cc4d87e685569a83551b2b0eca5e2c6c 100644 (file)
@@ -1 +1 @@
-7c8afc3272fa91e2b5685b009eb674dbc1b5920d
\ No newline at end of file
+7286547847721b8f5f64bc2e7dc236652b1ae985
\ No newline at end of file
index 81a74fa9a2a4e6158eda10273859fc91cbbd7b21..8622ba2594d68f8eaf6b6ad448049bdd64ad1b3a 100644 (file)
@@ -1774,6 +1774,8 @@ static void constructAutomaticIndex(
     if( termCanDriveIndex(pTerm, pSrc, notReady) ){
       int iCol = pTerm->u.leftColumn;
       Bitmask cMask = iCol>=BMS ? ((Bitmask)1)<<(BMS-1) : ((Bitmask)1)<<iCol;
+      testcase( iCol==BMS );
+      testcase( iCol==BMS-1 );
       if( (idxCols & cMask)==0 ){
         nColumn++;
         idxCols |= cMask;
@@ -1793,6 +1795,8 @@ static void constructAutomaticIndex(
   */
   extraCols = pSrc->colUsed & (~idxCols | (((Bitmask)1)<<(BMS-1)));
   mxBitCol = (pTable->nCol >= BMS-1) ? BMS-1 : pTable->nCol;
+  testcase( pTable->nCol==BMS-1 );
+  testcase( pTable->nCol==BMS-2 );
   for(i=0; i<mxBitCol; i++){
     if( extraCols & (1<<i) ) nColumn++;
   }
@@ -3700,7 +3704,7 @@ static int nQPlan = 0;              /* Next free slow in _query_plan[] */
 ** Free a WhereInfo structure
 */
 static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
-  if( pWInfo ){
+  if( ALWAYS(pWInfo) ){
     int i;
     for(i=0; i<pWInfo->nLevel; i++){
       sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;