/ Check-in [a4d26bcf]
Login

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

Overview
Comment:Bring the begin-concurrent-pnu branch up-to-date with version 3.30.0.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | begin-concurrent-pnu
Files: files | file ages | folders
SHA3-256: a4d26bcfb44a827d610d383b42a142ec807bb31700b9ba0842d9caaa47e8d9c6
User & Date: drh 2019-10-04 16:08:18
Context
2019-10-04
16:08
Bring the begin-concurrent-pnu branch up-to-date with version 3.30.0. Leaf check-in: a4d26bcf user: drh tags: begin-concurrent-pnu
15:03
Version 3.30.0 check-in: c20a3533 user: drh tags: trunk, release, version-3.30.0
2019-09-30
16:43
Merge version 3.30.0 beta 1 changes from trunk. check-in: ac4b6442 user: drh tags: begin-concurrent-pnu
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/fts3/fts3_write.c.

  3793   3793   */
  3794   3794   static int nodeReaderInit(NodeReader *p, const char *aNode, int nNode){
  3795   3795     memset(p, 0, sizeof(NodeReader));
  3796   3796     p->aNode = aNode;
  3797   3797     p->nNode = nNode;
  3798   3798   
  3799   3799     /* Figure out if this is a leaf or an internal node. */
  3800         -  if( p->aNode[0] ){
         3800  +  if( aNode && aNode[0] ){
  3801   3801       /* An internal node. */
  3802   3802       p->iOff = 1 + sqlite3Fts3GetVarint(&p->aNode[1], &p->iChild);
  3803   3803     }else{
  3804   3804       p->iOff = 1;
  3805   3805     }
  3806   3806   
  3807         -  return nodeReaderNext(p);
         3807  +  return aNode ? nodeReaderNext(p) : SQLITE_OK;
  3808   3808   }
  3809   3809   
  3810   3810   /*
  3811   3811   ** This function is called while writing an FTS segment each time a leaf o
  3812   3812   ** node is finished and written to disk. The key (zTerm/nTerm) is guaranteed
  3813   3813   ** to be greater than the largest key on the node just written, but smaller
  3814   3814   ** than or equal to the first key that will be written to the next leaf
................................................................................
  4292   4292           memset(&pNode->block.a[nRoot], 0, FTS3_NODE_PADDING);
  4293   4293         }
  4294   4294   
  4295   4295         for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){
  4296   4296           NodeReader reader;
  4297   4297           pNode = &pWriter->aNodeWriter[i];
  4298   4298   
  4299         -        rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
  4300         -        if( reader.aNode ){
         4299  +        if( pNode->block.a){
         4300  +          rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n);
  4301   4301             while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader);
  4302   4302             blobGrowBuffer(&pNode->key, reader.term.n, &rc);
  4303   4303             if( rc==SQLITE_OK ){
  4304   4304               memcpy(pNode->key.a, reader.term.a, reader.term.n);
  4305   4305               pNode->key.n = reader.term.n;
  4306   4306               if( i>0 ){
  4307   4307                 char *aBlock = 0;

Changes to src/loadext.c.

   459    459   #else
   460    460     0,
   461    461   #endif
   462    462     /* Version 3.28.0 and later */
   463    463     sqlite3_stmt_isexplain,
   464    464     sqlite3_value_frombind,
   465    465     /* Version 3.30.0 and later */
          466  +#ifndef SQLITE_OMIT_VIRTUALTABLE
   466    467     sqlite3_drop_modules,
          468  +#else
          469  +  0,
          470  +#endif
   467    471   };
   468    472   
   469    473   /*
   470    474   ** Attempt to load an SQLite extension library contained in the file
   471    475   ** zFile.  The entry point is zProc.  zProc may be 0 in which case a
   472    476   ** default entry point name (sqlite3_extension_init) is used.  Use
   473    477   ** of the default name is recommended.

Changes to src/mutex.h.

    63     63   #define sqlite3_mutex_notheld(X)  ((void)(X),1)
    64     64   #define sqlite3MutexAlloc(X)      ((sqlite3_mutex*)8)
    65     65   #define sqlite3MutexInit()        SQLITE_OK
    66     66   #define sqlite3MutexEnd()
    67     67   #define MUTEX_LOGIC(X)
    68     68   #else
    69     69   #define MUTEX_LOGIC(X)            X
           70  +int sqlite3_mutex_held(sqlite3_mutex*);
    70     71   #endif /* defined(SQLITE_MUTEX_OMIT) */

Changes to src/shell.c.in.

  9415   9415       }else{
  9416   9416         if( mType==0 ) mType = SQLITE_TRACE_STMT;
  9417   9417         sqlite3_trace_v2(p->db, mType, sql_trace_callback, p);
  9418   9418       }
  9419   9419     }else
  9420   9420   #endif /* !defined(SQLITE_OMIT_TRACE) */
  9421   9421   
  9422         -#ifdef SQLITE_DEBUG
         9422  +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_VIRTUALTABLE)
  9423   9423     if( c=='u' && strncmp(azArg[0], "unmodule", n)==0 ){
  9424   9424       int ii;
  9425   9425       int lenOpt;
  9426   9426       char *zOpt;
  9427   9427       if( nArg<2 ){
  9428   9428         raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n");
  9429   9429         rc = 1;

Changes to src/test1.c.

  1127   1127   
  1128   1128     if( argc!=2 ){
  1129   1129       Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
  1130   1130          " DB\"", 0);
  1131   1131       return TCL_ERROR;
  1132   1132     }
  1133   1133     if( getDbPointer(interp, argv[1], &db) ) return TCL_ERROR;
         1134  +#ifndef SQLITE_OMIT_VIRTUALTABLE
  1134   1135     sqlite3_drop_modules(db, argc>2 ? (const char**)(argv+2) : 0);
         1136  +#endif
  1135   1137     return TCL_OK;
  1136   1138   }
  1137   1139   
  1138   1140   /*
  1139   1141   ** Routines to implement the x_count() aggregate function.
  1140   1142   **
  1141   1143   ** x_count() counts the number of non-null arguments.  But there are

Changes to src/vdbe.c.

   550    550       printf(" si:%lld", p->u.i);
   551    551     }else if( (p->flags & (MEM_IntReal))!=0 ){
   552    552       printf(" ir:%lld", p->u.i);
   553    553     }else if( p->flags & MEM_Int ){
   554    554       printf(" i:%lld", p->u.i);
   555    555   #ifndef SQLITE_OMIT_FLOATING_POINT
   556    556     }else if( p->flags & MEM_Real ){
   557         -    printf(" r:%g", p->u.r);
          557  +    printf(" r:%.17g", p->u.r);
   558    558   #endif
   559    559     }else if( sqlite3VdbeMemIsRowSet(p) ){
   560    560       printf(" (rowset)");
   561    561     }else{
   562    562       char zBuf[200];
   563    563       sqlite3VdbeMemPrettyPrint(p, zBuf);
   564    564       printf(" %s", zBuf);

Changes to test/affinity2.test.

   114    114   } {0 '-1' 1}
   115    115   do_execsql_test 507 {
   116    116     SELECT * FROM t0 WHERE +-+'ce' >= t0.c0;
   117    117   } {-1 {}}
   118    118    
   119    119   # 2019-08-30 ticket https://www.sqlite.org/src/info/40812aea1fde9594
   120    120   #
   121         -do_execsql_test 600 {
   122         -  DROP TABLE IF EXISTS t0;
   123         -  CREATE TABLE t0(c0 REAL UNIQUE);
   124         -  INSERT INTO t0(c0) VALUES (3175546974276630385);
   125         -  SELECT 3175546974276630385 < c0 FROM t0;
   126         -} {1}
   127         -do_execsql_test 601 {
   128         -  SELECT 1 FROM t0 WHERE 3175546974276630385 < c0;
   129         -} {1}
          121  +# Due to some differences in floating point computations, these tests do not
          122  +# work under valgrind.
          123  +#
          124  +if {![info exists ::G(valgrind)]} {
          125  +  do_execsql_test 600 {
          126  +    DROP TABLE IF EXISTS t0;
          127  +    CREATE TABLE t0(c0 REAL UNIQUE);
          128  +    INSERT INTO t0(c0) VALUES (3175546974276630385);
          129  +    SELECT 3175546974276630385 < c0 FROM t0;
          130  +  } {1}
          131  +  do_execsql_test 601 {
          132  +    SELECT 1 FROM t0 WHERE 3175546974276630385 < c0;
          133  +  } {1}
          134  +}
   130    135   
   131    136   finish_test

Changes to test/corruptM.test.

    17     17   set testdir [file dirname $argv0]
    18     18   source $testdir/tester.tcl
    19     19   set testprefix corruptM
    20     20   
    21     21   # These tests deal with corrupt database files
    22     22   #
    23     23   database_may_be_corrupt
           24  +
           25  +proc open_db2_and_catchsql {sql} {
           26  +  set rc [catch { sqlite3 db2 test.db } msg]
           27  +  if {$rc} {
           28  +    return [list $rc $msg]
           29  +  }
           30  +  set res [catchsql $sql db2]
           31  +  db2 close
           32  +  set res
           33  +}
    24     34   
    25     35   db close
    26     36   forcedelete test.db
    27     37   sqlite3 db test.db
    28     38   do_execsql_test corruptM-100 {
    29     39     CREATE TABLE t1(a,b,c);
    30     40     INSERT INTO t1 VALUES(111,222,333);
................................................................................
    34     44     SELECT type, name, tbl_name, '|' FROM sqlite_master;
    35     45   } {table t1 t1 | index i1 t1 | view v2 v2 | trigger r1 t1 |}
    36     46   do_execsql_test corruptM-101 {
    37     47     PRAGMA writable_schema=on;
    38     48     UPDATE sqlite_master SET tbl_name=NULL WHERE name='t1';
    39     49     SELECT type, name, tbl_name, '|' FROM sqlite_master;
    40     50   } {table t1 {} | index i1 t1 | view v2 v2 | trigger r1 t1 |}
    41         -sqlite3 db2 test.db
    42     51   do_test corruptM-102 {
    43         -  catchsql {
           52  +  open_db2_and_catchsql {
    44     53       PRAGMA quick_check;
    45         -  } db2
           54  +  }
    46     55   } {1 {malformed database schema (t1)}}
    47         -db2 close
    48     56   
    49     57   do_execsql_test corruptM-110 {
    50     58     UPDATE sqlite_master SET tbl_name='tx' WHERE name='t1';
    51     59     SELECT type, name, tbl_name, '|' FROM sqlite_master;
    52     60   } {table t1 tx | index i1 t1 | view v2 v2 | trigger r1 t1 |}
    53         -sqlite3 db2 test.db
    54     61   do_test corruptM-111 {
    55         -  catchsql {
           62  +  open_db2_and_catchsql {
    56     63       PRAGMA quick_check;
    57         -  } db2
           64  +  }
    58     65   } {1 {malformed database schema (t1)}}
    59         -db2 close
    60     66   do_execsql_test corruptM-112 {
    61     67     UPDATE sqlite_master SET tbl_name='t1', type='tabl' WHERE name='t1';
    62     68     SELECT type, name, tbl_name, '|' FROM sqlite_master;
    63     69   } {tabl t1 t1 | index i1 t1 | view v2 v2 | trigger r1 t1 |}
    64         -sqlite3 db2 test.db
    65     70   do_test corruptM-113 {
    66         -  catchsql {
           71  +  open_db2_and_catchsql {
    67     72       PRAGMA quick_check;
    68         -  } db2
           73  +  }
    69     74   } {1 {malformed database schema (t1)}}
    70         -db2 close
    71     75   do_execsql_test corruptM-114 {
    72     76     UPDATE sqlite_master SET tbl_name='t9',type='table',name='t9'WHERE name='t1';
    73     77     SELECT type, name, tbl_name, '|' FROM sqlite_master;
    74     78   } {table t9 t9 | index i1 t1 | view v2 v2 | trigger r1 t1 |}
    75         -sqlite3 db2 test.db
    76     79   do_test corruptM-114 {
    77         -  catchsql {
           80  +  open_db2_and_catchsql {
    78     81       PRAGMA quick_check;
    79         -  } db2
           82  +  }
    80     83   } {1 {malformed database schema (t9)}}
    81         -db2 close
    82     84   
    83     85   do_execsql_test corruptM-120 {
    84     86     UPDATE sqlite_master SET name='t1',tbl_name='T1' WHERE name='t9';
    85     87     SELECT type, name, tbl_name, '|' FROM sqlite_master;
    86     88   } {table t1 T1 | index i1 t1 | view v2 v2 | trigger r1 t1 |}
    87         -sqlite3 db2 test.db
    88     89   do_test corruptM-121 {
    89         -  catchsql {
           90  +  open_db2_and_catchsql {
    90     91       PRAGMA quick_check;
    91     92       SELECT * FROM t1, v2;
    92         -  } db2
           93  +  } 
    93     94   } {0 {ok 111 222 333 15 22}}
    94         -db2 close
    95     95   
    96     96   do_execsql_test corruptM-130 {
    97     97     UPDATE sqlite_master SET type='view' WHERE name='t1';
    98     98     SELECT type, name, tbl_name, '|' FROM sqlite_master;
    99     99   } {view t1 T1 | index i1 t1 | view v2 v2 | trigger r1 t1 |}
   100         -sqlite3 db2 test.db
   101    100   do_test corruptM-131 {
   102         -  catchsql {
          101  +  open_db2_and_catchsql {
   103    102       PRAGMA quick_check;
   104    103       SELECT * FROM t1, v2;
   105         -  } db2
          104  +  }
   106    105   } {1 {malformed database schema (t1)}}
   107         -db2 close
   108    106   
   109    107   do_execsql_test corruptM-140 {
   110    108     UPDATE sqlite_master SET type='table', tbl_name='t1' WHERE name='t1';
   111    109     UPDATE sqlite_master SET tbl_name='tx' WHERE name='i1';
   112    110     SELECT type, name, tbl_name, '|' FROM sqlite_master;
   113    111   } {table t1 t1 | index i1 tx | view v2 v2 | trigger r1 t1 |}
   114         -sqlite3 db2 test.db
   115    112   do_test corruptM-141 {
   116         -  catchsql {
          113  +  open_db2_and_catchsql {
   117    114       PRAGMA quick_check;
   118    115       SELECT * FROM t1, v2;
   119         -  } db2
          116  +  }
   120    117   } {1 {malformed database schema (i1)}}
   121         -db2 close
   122    118   
   123    119   do_execsql_test corruptM-150 {
   124    120     UPDATE sqlite_master SET type='table', tbl_name='t1' WHERE name='i1';
   125    121     SELECT type, name, tbl_name, '|' FROM sqlite_master;
   126    122   } {table t1 t1 | table i1 t1 | view v2 v2 | trigger r1 t1 |}
   127         -sqlite3 db2 test.db
   128    123   do_test corruptM-151 {
   129         -  catchsql {
          124  +  open_db2_and_catchsql {
   130    125       PRAGMA quick_check;
   131    126       SELECT * FROM t1, v2;
   132         -  } db2
          127  +  }
   133    128   } {1 {malformed database schema (i1)}}
   134         -db2 close
   135    129   
   136    130   do_execsql_test corruptM-160 {
   137    131     UPDATE sqlite_master SET type='view', tbl_name='t1' WHERE name='i1';
   138    132     SELECT type, name, tbl_name, '|' FROM sqlite_master;
   139    133   } {table t1 t1 | view i1 t1 | view v2 v2 | trigger r1 t1 |}
   140         -sqlite3 db2 test.db
   141    134   do_test corruptM-161 {
   142         -  catchsql {
          135  +  open_db2_and_catchsql {
   143    136       PRAGMA quick_check;
   144    137       SELECT * FROM t1, v2;
   145         -  } db2
          138  +  }
   146    139   } {1 {malformed database schema (i1)}}
   147         -db2 close
   148    140   
   149    141   do_execsql_test corruptM-170 {
   150    142     UPDATE sqlite_master SET type='index', tbl_name='t1' WHERE name='i1';
   151    143     UPDATE sqlite_master SET type='table', tbl_name='v2' WHERE name='v2';
   152    144     SELECT type, name, tbl_name, '|' FROM sqlite_master;
   153    145   } {table t1 t1 | index i1 t1 | table v2 v2 | trigger r1 t1 |}
   154         -sqlite3 db2 test.db
   155    146   do_test corruptM-171 {
   156         -  catchsql {
          147  +  open_db2_and_catchsql {
   157    148       PRAGMA quick_check;
   158    149       SELECT * FROM t1, v2;
   159         -  } db2
          150  +  }
   160    151   } {1 {malformed database schema (v2)}}
   161         -db2 close
   162    152   
   163    153   do_execsql_test corruptM-180 {
   164    154     UPDATE sqlite_master SET type='view',name='v3',tbl_name='v3' WHERE name='v2';
   165    155     SELECT type, name, tbl_name, '|' FROM sqlite_master;
   166    156   } {table t1 t1 | index i1 t1 | view v3 v3 | trigger r1 t1 |}
   167         -sqlite3 db2 test.db
   168    157   do_test corruptM-181 {
   169         -  catchsql {
          158  +  open_db2_and_catchsql {
   170    159       PRAGMA quick_check;
   171    160       SELECT * FROM t1, v2;
   172         -  } db2
          161  +  }
   173    162   } {1 {malformed database schema (v3)}}
   174         -db2 close
   175    163   
   176    164   do_execsql_test corruptM-190 {
   177    165     UPDATE sqlite_master SET type='view',name='v2',tbl_name='v2' WHERE name='v3';
   178    166     UPDATE sqlite_master SET type='view' WHERE name='r1';
   179    167     SELECT type, name, tbl_name, '|' FROM sqlite_master;
   180    168   } {table t1 t1 | index i1 t1 | view v2 v2 | view r1 t1 |}
   181         -sqlite3 db2 test.db
   182    169   do_test corruptM-191 {
   183         -  catchsql {
          170  +  open_db2_and_catchsql {
   184    171       PRAGMA quick_check;
   185    172       SELECT * FROM t1, v2;
   186         -  } db2
          173  +  }
   187    174   } {1 {malformed database schema (r1)}}
   188         -db2 close
   189    175   do_execsql_test corruptM-192 {
   190    176     UPDATE sqlite_master SET type='trigger',tbl_name='v2' WHERE name='r1';
   191    177     SELECT type, name, tbl_name, '|' FROM sqlite_master;
   192    178   } {table t1 t1 | index i1 t1 | view v2 v2 | trigger r1 v2 |}
   193         -sqlite3 db2 test.db
   194    179   do_test corruptM-193 {
   195         -  catchsql {
          180  +  open_db2_and_catchsql {
   196    181       PRAGMA quick_check;
   197    182       SELECT * FROM t1, v2;
   198         -  } db2
          183  +  }
   199    184   } {1 {malformed database schema (r1)}}
   200         -db2 close
   201    185   
   202    186   finish_test

Added test/fts4merge5.test.

            1  +# 2019 October 02
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#*************************************************************************
           11  +# This file implements regression tests for SQLite library.  The
           12  +# focus of this script is testing the FTS4 module.
           13  +#
           14  +
           15  +set testdir [file dirname $argv0]
           16  +source $testdir/tester.tcl
           17  +set testprefix fts4merge5
           18  +
           19  +# If SQLITE_ENABLE_FTS3 is defined, omit this file.
           20  +ifcapable !fts3 {
           21  +  finish_test
           22  +  return
           23  +}
           24  +
           25  +source $testdir/genesis.tcl
           26  +
           27  +do_execsql_test 1.1 { 
           28  +  CREATE TABLE t1(docid, words);
           29  +}
           30  +fts_kjv_genesis
           31  +
           32  +do_execsql_test 1.2 {
           33  +  CREATE VIRTUAL TABLE x1 USING fts3; 
           34  +  INSERT INTO x1(x1) VALUES('nodesize=64');
           35  +  INSERT INTO x1(x1) VALUES('maxpending=64');
           36  +}
           37  +
           38  +do_execsql_test 1.3 {
           39  +  INSERT INTO x1(docid, content) SELECT * FROM t1;
           40  +}
           41  +
           42  +for {set tn 1} {1} {incr tn} {
           43  +  set tc1 [db total_changes]
           44  +  do_execsql_test 1.4.$tn.1 {
           45  +    INSERT INTO x1(x1) VALUES('merge=1,2');
           46  +  }
           47  +  set tc2 [db total_changes]
           48  +
           49  +  if {($tc2 - $tc1)<2} break
           50  +
           51  +  do_execsql_test 1.4.$tn.1 {
           52  +    INSERT INTO x1(x1) VALUES('integrity-check');
           53  +  }
           54  +}
           55  +
           56  +
           57  +
           58  +finish_test

Changes to test/permutations.test.

   122    122     vtab_err.test walslow.test walcrash.test walcrash3.test
   123    123     walthread.test rtree3.test indexfault.test securedel2.test
   124    124     sort3.test sort4.test fts4growth.test fts4growth2.test
   125    125     bigsort.test walprotocol.test mmap4.test fuzzer2.test
   126    126     walcrash2.test e_fkey.test backup.test
   127    127   
   128    128     fts4merge.test fts4merge2.test fts4merge4.test fts4check.test
          129  +  fts4merge5.test
   129    130     fts3cov.test fts3snippet.test fts3corrupt2.test fts3an.test
   130    131     fts3defer.test fts4langid.test fts3sort.test fts5unicode.test
   131    132   
   132    133     rtree4.test
   133    134   }]
   134    135   if {[info exists ::env(QUICKTEST_INCLUDE)]} {
   135    136     set allquicktests [concat $allquicktests $::env(QUICKTEST_INCLUDE)]
................................................................................
   451    452     walfault.test  walbak.test  journal2.test    tkt-9d68c883.test
   452    453   } 
   453    454   
   454    455   test_suite "coverage-analyze" -description {
   455    456     Coverage tests for file analyze.c.
   456    457   } -files {
   457    458     analyze3.test analyze4.test analyze5.test analyze6.test
   458         -  analyze7.test analyze8.test analyze9.test analyzeA.test
   459         -  analyze.test analyzeB.test mallocA.test
          459  +  analyze7.test analyze8.test analyze9.test
          460  +  analyze.test mallocA.test
   460    461   } 
   461    462   
   462    463   test_suite "coverage-sorter" -description {
   463    464     Coverage tests for file vdbesort.c.
   464    465   } -files {
   465    466     sort.test sortfault.test
   466    467   } 
................................................................................
   620    621   test_suite "utf16" -description {
   621    622     Run tests using UTF-16 databases
   622    623   } -presql {
   623    624     pragma encoding = 'UTF-16'
   624    625   } -files {
   625    626       alter.test alter3.test
   626    627       analyze.test analyze3.test analyze4.test analyze5.test analyze6.test
   627         -    analyze7.test analyze8.test analyze9.test analyzeA.test analyzeB.test
          628  +    analyze7.test analyze8.test analyze9.test
   628    629       auth.test bind.test blob.test capi2.test capi3.test collate1.test
   629    630       collate2.test collate3.test collate4.test collate5.test collate6.test
   630    631       conflict.test date.test delete.test expr.test fkey1.test func.test
   631    632       hook.test index.test insert2.test insert.test interrupt.test in.test
   632    633       intpkey.test ioerr.test join2.test join.test lastinsert.test
   633    634       laststmtchanges.test limit.test lock2.test lock.test main.test 
   634    635       memdb.test minmax.test misc1.test misc2.test misc3.test notnull.test

Changes to test/releasetest.tcl.

   407    407           set rc 1
   408    408           set errmsg $line
   409    409         }
   410    410       }
   411    411       if {[regexp {runtime error: +(.*)} $line all msg]} {
   412    412         # skip over "value is outside range" errors
   413    413         if {[regexp {value .* is outside the range of representable} $line]} {
          414  +         # noop
          415  +      } elseif {[regexp {overflow: .* cannot be represented} $line]} {
   414    416            # noop
   415    417         } else {
   416    418           incr ::NERRCASE
   417    419           if {$rc==0} {
   418    420             set rc 1
   419    421             set errmsg $msg
   420    422           }

Changes to test/wapptest.tcl.

   821    821         lappend lWappArg [lindex $argv $i]
   822    822       }
   823    823     } else {
   824    824       lappend lTestArg $arg
   825    825     }
   826    826   }
   827    827   
          828  +wapptest_init
   828    829   for {set i 0} {$i < [llength $lTestArg]} {incr i} {
   829         -  switch -- [lindex $lTestArg $i] {
          830  +  set opt [lindex $lTestArg $i]
          831  +  if {[string range $opt 0 1]=="--"} {
          832  +    set opt [string range $opt 1 end]
          833  +  }
          834  +  switch -- $opt {
   830    835       -platform {
   831    836         if {$i==[llength $lTestArg]-1} { wapptest_usage }
   832    837         incr i
   833    838         set arg [lindex $lTestArg $i]
   834    839         set lPlatform [releasetest_data platforms]
   835    840         if {[lsearch $lPlatform $arg]<0} {
   836    841           puts stderr "No such platform: $arg. Platforms are: $lPlatform"
................................................................................
   878    883       default {
   879    884         puts stderr "Unrecognized option: [lindex $lTestArg $i]"
   880    885         wapptest_usage
   881    886       }
   882    887     }
   883    888   }
   884    889   
   885         -wapptest_init
   886    890   if {$G(noui)==0} {
   887    891     wapp-start $lWappArg
   888    892   } else {
   889    893     wapptest_run
   890    894     do_some_stuff
   891    895     vwait forever
   892    896   }
   893    897   

Changes to test/without_rowid1.test.

    12     12   # This file implements regression tests for SQLite library.  The
    13     13   # focus of this file is testing WITHOUT ROWID tables.
    14     14   #
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
    18     18   set testprefix without_rowid1
           19  +
           20  +proc do_execsql_test_if_vtab {tn sql {res {}}} {
           21  +  ifcapable vtab { uplevel [list do_execsql_test $tn $sql $res] }
           22  +}
    19     23   
    20     24   # Create and query a WITHOUT ROWID table.
    21     25   #
    22     26   do_execsql_test without_rowid1-1.0 {
    23     27     CREATE TABLE t1(a,b,c,d, PRIMARY KEY(c,a)) WITHOUT ROWID;
    24     28     CREATE INDEX t1bd ON t1(b, d);
    25     29     INSERT INTO t1 VALUES('journal','sherman','ammonia','helena');
................................................................................
    27     31     INSERT INTO t1 VALUES('journal','sherman','gamma','patriot');
    28     32     INSERT INTO t1 VALUES('arctic','sleep','ammonia','helena');
    29     33     SELECT *, '|' FROM t1 ORDER BY c, a;
    30     34   } {arctic sleep ammonia helena | journal sherman ammonia helena | dynamic juliet flipper command | journal sherman gamma patriot |}
    31     35   
    32     36   integrity_check without_rowid1-1.0ic
    33     37   
    34         -do_execsql_test without_rowid1-1.0ixi {
           38  +do_execsql_test_if_vtab without_rowid1-1.0ixi {
    35     39     SELECT name, key FROM pragma_index_xinfo('t1');
    36     40   } {c 1 a 1 b 0 d 0}
    37     41   
    38     42   do_execsql_test without_rowid1-1.1 {
    39     43     SELECT *, '|' FROM t1 ORDER BY +c, a;
    40     44   } {arctic sleep ammonia helena | journal sherman ammonia helena | dynamic juliet flipper command | journal sherman gamma patriot |}
    41     45   
................................................................................
   115    119     INSERT INTO t4 VALUES('abc', 'def');
   116    120     SELECT * FROM t4;
   117    121   } {abc def}
   118    122   do_execsql_test 2.1.2 {
   119    123     UPDATE t4 SET a = 'ABC';
   120    124     SELECT * FROM t4;
   121    125   } {ABC def}
   122         -do_execsql_test 2.1.3 {
          126  +do_execsql_test_if_vtab 2.1.3 {
   123    127     SELECT name, coll, key FROM pragma_index_xinfo('t4');
   124    128   } {a nocase 1 b BINARY 0}
   125    129   
   126    130   do_execsql_test 2.2.1 {
   127    131     DROP TABLE t4;
   128    132     CREATE TABLE t4 (b, a COLLATE nocase PRIMARY KEY) WITHOUT ROWID;
   129    133     INSERT INTO t4(a, b) VALUES('abc', 'def');
................................................................................
   131    135   } {def abc}
   132    136   
   133    137   do_execsql_test 2.2.2 {
   134    138     UPDATE t4 SET a = 'ABC', b = 'xyz';
   135    139     SELECT * FROM t4;
   136    140   } {xyz ABC}
   137    141   
   138         -do_execsql_test 2.2.3 {
          142  +do_execsql_test_if_vtab 2.2.3 {
   139    143     SELECT name, coll, key FROM pragma_index_xinfo('t4');
   140    144   } {a nocase 1 b BINARY 0}
   141    145   
   142    146   
   143    147   do_execsql_test 2.3.1 {
   144    148     CREATE TABLE t5 (a, b, PRIMARY KEY(b, a)) WITHOUT ROWID;
   145    149     INSERT INTO t5(a, b) VALUES('abc', 'def');
   146    150     UPDATE t5 SET a='abc', b='def';
   147    151   } {}
   148    152   
   149         -do_execsql_test 2.3.2 {
          153  +do_execsql_test_if_vtab 2.3.2 {
   150    154     SELECT name, coll, key FROM pragma_index_xinfo('t5');
   151    155   } {b BINARY 1 a BINARY 1}
   152    156   
   153    157   
   154    158   do_execsql_test 2.4.1 {
   155    159     CREATE TABLE t6 (
   156    160       a COLLATE nocase, b, c UNIQUE, PRIMARY KEY(b, a)
................................................................................
   161    165   } {}
   162    166   
   163    167   do_execsql_test 2.4.2 {
   164    168     SELECT * FROM t6 ORDER BY b, a;
   165    169     SELECT * FROM t6 ORDER BY c;
   166    170   } {ABC def ghi ABC def ghi}
   167    171   
   168         -do_execsql_test 2.4.3 {
          172  +do_execsql_test_if_vtab 2.4.3 {
   169    173     SELECT name, coll, key FROM pragma_index_xinfo('t6');
   170    174   } {b BINARY 1 a nocase 1 c BINARY 0}
   171    175   
   172    176   
   173    177   #-------------------------------------------------------------------------
   174    178   # Unless the destination table is completely empty, the xfer optimization 
   175    179   # is disabled for WITHOUT ROWID tables. The following tests check for

Changes to test/without_rowid6.test.

    11     11   #
    12     12   # Verify that WITHOUT ROWID tables work correctly when the PRIMARY KEY
    13     13   # has redundant columns.
    14     14   #
    15     15   
    16     16   set testdir [file dirname $argv0]
    17     17   source $testdir/tester.tcl
           18  +
           19  +proc do_execsql_test_if_vtab {tn sql {res {}}} {
           20  +  ifcapable vtab { uplevel [list do_execsql_test $tn $sql $res] }
           21  +}
    18     22   
    19     23   do_execsql_test without_rowid6-100 {
    20     24     CREATE TABLE t1(a,b,c,d,e, PRIMARY KEY(a,b,c,a,b,c,d,a,b,c)) WITHOUT ROWID;
    21     25     CREATE INDEX t1a ON t1(b, b);
    22     26     WITH RECURSIVE
    23     27       c(i) AS (VALUES(1) UNION ALL SELECT i+1 FROM c WHERE i<1000)
    24     28     INSERT INTO t1(a,b,c,d,e) SELECT i, i+1000, printf('x%dy',i), 0, 0 FROM c;
    25     29     ANALYZE;
    26     30   } {}
    27         -do_execsql_test without_rowid6-101 {
           31  +do_execsql_test_if_vtab without_rowid6-101 {
    28     32     SELECT name, key FROM pragma_index_xinfo('t1');
    29     33   } {a 1 b 1 c 1 d 1 e 0}
    30     34   do_execsql_test without_rowid6-110 {
    31     35     SELECT c FROM t1 WHERE a=123;
    32     36   } {x123y}
    33     37   do_execsql_test without_rowid6-120 {
    34     38     SELECT c FROM t1 WHERE b=1123;
................................................................................
    50     54       b UNIQUE,
    51     55       c UNIQUE,
    52     56       PRIMARY KEY(b)
    53     57     ) WITHOUT ROWID;
    54     58     INSERT INTO t1(a,b,c) VALUES(1,8,3),(4,5,6),(7,2,9);
    55     59     SELECT a FROM t1 WHERE b>3 ORDER BY b;
    56     60   } {4 1}
    57         -do_execsql_test without_rowid6-201 {
           61  +do_execsql_test_if_vtab without_rowid6-201 {
    58     62     SELECT name, key FROM pragma_index_xinfo('t1');
    59     63   } {b 1 a 0 c 0}
    60     64   do_execsql_test without_rowid6-210 {
    61     65     EXPLAIN QUERY PLAN
    62     66     SELECT a FROM t1 WHERE b>3 ORDER BY b;
    63     67   } {/SEARCH TABLE t1 USING PRIMARY KEY .b>../}
    64     68   do_execsql_test without_rowid6-220 {
................................................................................
   107    111     CREATE TABLE t1(a,b,c,
   108    112       UNIQUE(b,c),
   109    113       PRIMARY KEY(b,c)
   110    114     ) WITHOUT ROWID;
   111    115     INSERT INTO t1(a,b,c) VALUES(1,8,3),(4,5,6),(7,2,9);
   112    116     SELECT a FROM t1 WHERE b>3 ORDER BY b;
   113    117   } {4 1}
   114         -do_execsql_test without_rowid6-501 {
          118  +do_execsql_test_if_vtab without_rowid6-501 {
   115    119     SELECT name, key FROM pragma_index_xinfo('t1');
   116    120   } {b 1 c 1 a 0}
   117    121   do_execsql_test without_rowid6-510 {
   118    122     EXPLAIN QUERY PLAN
   119    123     SELECT a FROM t1 WHERE b>3 ORDER BY b;
   120    124   } {/SEARCH TABLE t1 USING PRIMARY KEY .b>../}
   121    125   do_execsql_test without_rowid6-520 {

Changes to test/without_rowid7.test.

    10     10   #*************************************************************************
    11     11   # This file implements regression tests for SQLite library.  
    12     12   #
    13     13   
    14     14   set testdir [file dirname $argv0]
    15     15   source $testdir/tester.tcl
    16     16   set testprefix without_rowid7
           17  +
           18  +proc do_execsql_test_if_vtab {tn sql {res {}}} {
           19  +  ifcapable vtab { uplevel [list do_execsql_test $tn $sql $res] }
           20  +}
    17     21   
    18     22   do_execsql_test 1.0 {
    19     23     CREATE TABLE t1(a, b COLLATE nocase, PRIMARY KEY(a, a, b)) WITHOUT ROWID;
    20     24   }
    21     25   
    22     26   do_catchsql_test 1.1 {
    23     27     INSERT INTO t1 VALUES(1, 'one'), (1, 'ONE');
................................................................................
    32     36     INSERT INTO t2 VALUES(1, 'one');
    33     37     SELECT b FROM t2;
    34     38   } {one}
    35     39   
    36     40   do_execsql_test 2.2a {
    37     41     PRAGMA index_info(t2);
    38     42   } {0 0 a 1 0 a}
    39         -do_execsql_test 2.2b {
           43  +do_execsql_test_if_vtab 2.2b {
    40     44     SELECT *, '|' FROM pragma_index_info('t2');
    41     45   } {0 0 a | 1 0 a |}
    42     46   do_execsql_test 2.3a {
    43     47     PRAGMA index_xinfo(t2);
    44     48   } {0 0 a 0 nocase 1 1 0 a 0 BINARY 1 2 1 b 0 BINARY 0}
    45         -do_execsql_test 2.3b {
           49  +do_execsql_test_if_vtab 2.3b {
    46     50     SELECT *, '|' FROM pragma_index_xinfo('t2');
    47     51   } {0 0 a 0 nocase 1 | 1 0 a 0 BINARY 1 | 2 1 b 0 BINARY 0 |}
    48     52   
    49     53   do_execsql_test 2.4 {
    50     54     CREATE TABLE t3(a, b, PRIMARY KEY(a COLLATE nocase, a));
    51     55     PRAGMA index_info(t3);
    52     56   } {}
    53     57   
    54     58   
    55     59   
    56     60   finish_test