/ Check-in [ea49ddf6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Test coverage a few extra lines in where.c. (CVS 3756)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ea49ddf64aa6073b8018dc2faaf199704d359412
User & Date: danielk1977 2007-03-30 09:13:14
Context
2007-03-30
11:12
Comment changes in btree.c and added a missing "else" in pragma.c. (CVS 3757) check-in: 9a7d7e31 user: drh tags: trunk
09:13
Test coverage a few extra lines in where.c. (CVS 3756) check-in: ea49ddf6 user: danielk1977 tags: trunk
07:10
Extra test cases to improve coverage of main.c. (CVS 3755) check-in: 19fc3d78 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is reponsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.242 2007/03/28 14:30:09 drh Exp $
           19  +** $Id: where.c,v 1.243 2007/03/30 09:13:14 danielk1977 Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23     23   /*
    24     24   ** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
    25     25   */
    26     26   #define BMS  (sizeof(Bitmask)*8)
................................................................................
   519    519     }
   520    520     pLeft = pList->a[1].pExpr;
   521    521     if( pLeft->op!=TK_COLUMN ){
   522    522       return 0;
   523    523     }
   524    524     pColl = pLeft->pColl;
   525    525     if( pColl==0 ){
          526  +    /* TODO: Coverage testing doesn't get this case. Is it actually possible
          527  +    ** for an expression of type TK_COLUMN to not have an assigned collation 
          528  +    ** sequence at this point?
          529  +    */
   526    530       pColl = db->pDfltColl;
   527    531     }
   528    532     if( (pColl->type!=SQLITE_COLL_BINARY || noCase) &&
   529    533         (pColl->type!=SQLITE_COLL_NOCASE || !noCase) ){
   530    534       return 0;
   531    535     }
   532    536     sqlite3DequoteExpr(pRight);
................................................................................
  1288   1292     /* At this point, the sqlite3_index_info structure that pIdxInfo points
  1289   1293     ** to will have been initialized, either during the current invocation or
  1290   1294     ** during some prior invocation.  Now we just have to customize the
  1291   1295     ** details of pIdxInfo for the current invocation and pass it to
  1292   1296     ** xBestIndex.
  1293   1297     */
  1294   1298   
  1295         -  /* The module name must be defined */
         1299  +  /* The module name must be defined. Also, by this point there must
         1300  +  ** be a pointer to an sqlite3_vtab structure. Otherwise
         1301  +  ** sqlite3ViewGetColumnNames() would have picked up the error. 
         1302  +  */
  1296   1303     assert( pTab->azModuleArg && pTab->azModuleArg[0] );
         1304  +  assert( pTab->pVtab );
         1305  +#if 0
  1297   1306     if( pTab->pVtab==0 ){
  1298   1307       sqlite3ErrorMsg(pParse, "undefined module %s for table %s",
  1299   1308           pTab->azModuleArg[0], pTab->zName);
  1300   1309       return 0.0;
  1301   1310     }
         1311  +#endif
  1302   1312   
  1303   1313     /* Set the aConstraint[].usable fields and initialize all 
  1304   1314     ** output variables to zero.
  1305   1315     **
  1306   1316     ** aConstraint[].usable is true for constraints where the right-hand
  1307   1317     ** side contains only references to tables to the left of the current
  1308   1318     ** table.  In other words, if the constraint is of the form:

Changes to test/misc7.test.

     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   #
    13         -# $Id: misc7.test,v 1.3 2007/03/30 07:10:52 danielk1977 Exp $
           13  +# $Id: misc7.test,v 1.4 2007/03/30 09:13:14 danielk1977 Exp $
    14     14   
    15     15   set testdir [file dirname $argv0]
    16     16   source $testdir/tester.tcl
    17     17   
    18     18   do_test misc7-1 {
    19     19     c_misuse_test
    20     20   } {}
................................................................................
   124    124   } {1}
   125    125   db2 close
   126    126   
   127    127   #--------------------------------------------------------------------
   128    128   # Test that nothing goes horribly wrong when attaching a database
   129    129   # after the omit_readlock pragma has been exercised.
   130    130   #
   131         -do_test misc7-7 {
          131  +do_test misc7-7.1 {
   132    132     file delete -force test2.db
   133    133     file delete -force test2.db-journal
   134    134     execsql {
   135    135       PRAGMA omit_readlock = 1;
   136    136       ATTACH 'test2.db' AS aux;
   137    137       CREATE TABLE aux.hello(world);
   138    138       SELECT name FROM aux.sqlite_master;
   139    139     }
   140    140   } {hello}
          141  +do_test misc7-7.2 {
          142  +  execsql {
          143  +    DETACH aux;
          144  +  }
          145  +} {}
   141    146   
   142    147   # Test malloc failure whilst installing a foriegn key.
   143    148   #
   144    149   ifcapable utf16 {
   145    150     do_test misc7-8 {
   146    151       encoding convertfrom unicode [sqlite3_errmsg16 0x00000000]
   147    152     } {out of memory}
   148    153   }
   149    154   
          155  +do_test misc7-9 {
          156  +  execsql {
          157  +    SELECT * 
          158  +    FROM (SELECT name+1 AS one FROM sqlite_master LIMIT 1 OFFSET 1) 
          159  +    WHERE one LIKE 'hello%';
          160  +  }
          161  +} {}
   150    162   
          163  +#--------------------------------------------------------------------
          164  +# Improve reported coverage by running some debugging code:
          165  +#
          166  +ifcapable vtab {
          167  +  do_test misc7-10 {
          168  +    register_echo_module [sqlite3_connection_pointer db]
          169  +    set sqlite_where_trace 1
          170  +    execsql {
          171  +      CREATE VIRTUAL TABLE t1 USING echo(abc);
          172  +      SELECT a FROM t1 WHERE a = 1 ORDER BY b;
          173  +    }
          174  +  } {1}
          175  +}
   151    176   
   152    177   finish_test
   153         -