/ Check-in [41b5f869]
Login

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

Overview
Comment:Cherrypick the recursion fix to test_vfs.c from [065e5a5ea4f82]. Also fix the nan.test module to handle upper/lower case changes in TCL.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.7.2
Files: files | file ages | folders
SHA1: 41b5f86971ed9d7ddca31bd9b43d0a41f03f002b
User & Date: drh 2011-08-26 17:17:50
Context
2011-10-25
20:36
Cherrypick changes [53f5cfe115] and [1f7ef0af8d] in order to fix an issue with DISTINCT check-in: 14bc58ca user: drh tags: branch-3.7.2
2011-08-26
18:04
Merge the branch-3.7.2 changes into the stat3-3.7.2 subbranch. Also fix some test script issues. check-in: a42db19d user: drh tags: stat3-3.7.2
17:17
Cherrypick the recursion fix to test_vfs.c from [065e5a5ea4f82]. Also fix the nan.test module to handle upper/lower case changes in TCL. check-in: 41b5f869 user: drh tags: branch-3.7.2
2011-07-13
18:53
Cherrypicked from trunk: Do not try to use STAT2 for row estimates if the index is unique or nearly so. check-in: d55b64ef user: drh tags: branch-3.7.2
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test_vfs.c.

    77     77   */
    78     78   struct Testvfs {
    79     79     char *zName;                    /* Name of this VFS */
    80     80     sqlite3_vfs *pParent;           /* The VFS to use for file IO */
    81     81     sqlite3_vfs *pVfs;              /* The testvfs registered with SQLite */
    82     82     Tcl_Interp *interp;             /* Interpreter to run script in */
    83     83     Tcl_Obj *pScript;               /* Script to execute */
    84         -  int nScript;                    /* Number of elements in array apScript */
    85         -  Tcl_Obj **apScript;             /* Array version of pScript */
    86     84     TestvfsBuffer *pBuffer;         /* List of shared buffers */
    87     85     int isNoshm;
    88     86   
    89     87     int mask;                       /* Mask controlling [script] and [ioerr] */
    90     88   
    91     89     TestFaultInject ioerr_err;
    92     90     TestFaultInject full_err;
................................................................................
   264    262     Testvfs *p, 
   265    263     const char *zMethod,
   266    264     Tcl_Obj *arg1,
   267    265     Tcl_Obj *arg2,
   268    266     Tcl_Obj *arg3
   269    267   ){
   270    268     int rc;                         /* Return code from Tcl_EvalObj() */
   271         -  int nArg;                       /* Elements in eval'd list */
   272         -  int nScript;
   273         -  Tcl_Obj ** ap;
   274         -
          269  +  Tcl_Obj *pEval;
   275    270     assert( p->pScript );
   276    271   
   277         -  if( !p->apScript ){
   278         -    int nByte;
   279         -    int i;
   280         -    if( TCL_OK!=Tcl_ListObjGetElements(p->interp, p->pScript, &nScript, &ap) ){
   281         -      Tcl_BackgroundError(p->interp);
   282         -      Tcl_ResetResult(p->interp);
   283         -      return;
   284         -    }
   285         -    p->nScript = nScript;
   286         -    nByte = (nScript+TESTVFS_MAX_ARGS)*sizeof(Tcl_Obj *);
   287         -    p->apScript = (Tcl_Obj **)ckalloc(nByte);
   288         -    memset(p->apScript, 0, nByte);
   289         -    for(i=0; i<nScript; i++){
   290         -      p->apScript[i] = ap[i];
   291         -    }
   292         -  }
          272  +  assert( zMethod );
          273  +  assert( p );
          274  +  assert( arg2==0 || arg1!=0 );
          275  +  assert( arg3==0 || arg2!=0 );
   293    276   
   294         -  p->apScript[p->nScript] = Tcl_NewStringObj(zMethod, -1);
   295         -  p->apScript[p->nScript+1] = arg1;
   296         -  p->apScript[p->nScript+2] = arg2;
   297         -  p->apScript[p->nScript+3] = arg3;
          277  +  pEval = Tcl_DuplicateObj(p->pScript);
          278  +  Tcl_IncrRefCount(p->pScript);
          279  +  Tcl_ListObjAppendElement(p->interp, pEval, Tcl_NewStringObj(zMethod, -1));
          280  +  if( arg1 ) Tcl_ListObjAppendElement(p->interp, pEval, arg1);
          281  +  if( arg2 ) Tcl_ListObjAppendElement(p->interp, pEval, arg2);
          282  +  if( arg3 ) Tcl_ListObjAppendElement(p->interp, pEval, arg3);
   298    283   
   299         -  for(nArg=p->nScript; p->apScript[nArg]; nArg++){
   300         -    Tcl_IncrRefCount(p->apScript[nArg]);
   301         -  }
   302         -
   303         -  rc = Tcl_EvalObjv(p->interp, nArg, p->apScript, TCL_EVAL_GLOBAL);
          284  +  rc = Tcl_EvalObjEx(p->interp, pEval, TCL_EVAL_GLOBAL);
   304    285     if( rc!=TCL_OK ){
   305    286       Tcl_BackgroundError(p->interp);
   306    287       Tcl_ResetResult(p->interp);
   307    288     }
   308         -
   309         -  for(nArg=p->nScript; p->apScript[nArg]; nArg++){
   310         -    Tcl_DecrRefCount(p->apScript[nArg]);
   311         -    p->apScript[nArg] = 0;
   312         -  }
   313    289   }
   314    290   
   315    291   
   316    292   /*
   317    293   ** Close an tvfs-file.
   318    294   */
   319    295   static int tvfsClose(sqlite3_file *pFile){
................................................................................
  1070   1046       }
  1071   1047   
  1072   1048       case CMD_SCRIPT: {
  1073   1049         if( objc==3 ){
  1074   1050           int nByte;
  1075   1051           if( p->pScript ){
  1076   1052             Tcl_DecrRefCount(p->pScript);
  1077         -          ckfree((char *)p->apScript);
  1078         -          p->apScript = 0;
  1079         -          p->nScript = 0;
  1080   1053             p->pScript = 0;
  1081   1054           }
  1082   1055           Tcl_GetStringFromObj(objv[2], &nByte);
  1083   1056           if( nByte>0 ){
  1084   1057             p->pScript = Tcl_DuplicateObj(objv[2]);
  1085   1058             Tcl_IncrRefCount(p->pScript);
  1086   1059           }
................................................................................
  1226   1199     return TCL_OK;
  1227   1200   }
  1228   1201   
  1229   1202   static void testvfs_obj_del(ClientData cd){
  1230   1203     Testvfs *p = (Testvfs *)cd;
  1231   1204     if( p->pScript ) Tcl_DecrRefCount(p->pScript);
  1232   1205     sqlite3_vfs_unregister(p->pVfs);
  1233         -  ckfree((char *)p->apScript);
  1234   1206     ckfree((char *)p->pVfs);
  1235   1207     ckfree((char *)p);
  1236   1208   }
  1237   1209   
  1238   1210   /*
  1239   1211   ** Usage:  testvfs VFSNAME ?SWITCHES?
  1240   1212   **

Changes to test/nan.test.

    42     42     db eval {SELECT x, typeof(x) FROM t1}
    43     43   } {{} null}
    44     44   if {$tcl_platform(platform) != "symbian"} {
    45     45     do_test nan-1.1.2 {
    46     46       sqlite3_bind_double $::STMT 1 +Inf
    47     47       sqlite3_step $::STMT
    48     48       sqlite3_reset $::STMT
    49         -    db eval {SELECT x, typeof(x) FROM t1}
           49  +    string tolower [db eval {SELECT x, typeof(x) FROM t1}]
    50     50     } {{} null inf real}
    51     51     do_test nan-1.1.3 {
    52     52       sqlite3_bind_double $::STMT 1 -Inf
    53     53       sqlite3_step $::STMT
    54     54       sqlite3_reset $::STMT
    55         -    db eval {SELECT x, typeof(x) FROM t1}
           55  +    string tolower [db eval {SELECT x, typeof(x) FROM t1}]
    56     56     } {{} null inf real -inf real}
    57     57     do_test nan-1.1.4 {
    58     58       sqlite3_bind_double $::STMT 1 -NaN
    59     59       sqlite3_step $::STMT
    60     60       sqlite3_reset $::STMT
    61         -    db eval {SELECT x, typeof(x) FROM t1}
           61  +    string tolower [db eval {SELECT x, typeof(x) FROM t1}]
    62     62     } {{} null inf real -inf real {} null}
    63     63     do_test nan-1.1.5 {
    64     64       sqlite3_bind_double $::STMT 1 NaN0
    65     65       sqlite3_step $::STMT
    66     66       sqlite3_reset $::STMT
    67         -    db eval {SELECT x, typeof(x) FROM t1}
           67  +    string tolower [db eval {SELECT x, typeof(x) FROM t1}]
    68     68     } {{} null inf real -inf real {} null {} null}
    69     69     do_test nan-1.1.6 {
    70     70       sqlite3_bind_double $::STMT 1 -NaN0
    71     71       sqlite3_step $::STMT
    72     72       sqlite3_reset $::STMT
    73         -    db eval {SELECT x, typeof(x) FROM t1}
           73  +    string tolower [db eval {SELECT x, typeof(x) FROM t1}]
    74     74     } {{} null inf real -inf real {} null {} null {} null}
    75     75     do_test nan-1.1.7 {
    76     76       db eval {
    77     77         UPDATE t1 SET x=x-x;
    78     78         SELECT x, typeof(x) FROM t1;
    79     79       }
    80     80     } {{} null {} null {} null {} null {} null {} null}
................................................................................
   230    230   if {$tcl_platform(platform) != "symbian"} {
   231    231     # Do not run these tests on Symbian, as the Tcl port doesn't like to
   232    232     # convert from floating point value "-inf" to a string.
   233    233     #
   234    234     do_test nan-4.7 {
   235    235       db eval {DELETE FROM t1}
   236    236       db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)"
   237         -    db eval {SELECT x, typeof(x) FROM t1}
          237  +    string tolower [db eval {SELECT x, typeof(x) FROM t1}]
   238    238     } {inf real}
   239    239     do_test nan-4.8 {
   240    240       db eval {DELETE FROM t1}
   241    241       db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)"
   242         -    db eval {SELECT x, typeof(x) FROM t1}
          242  +    string tolower [db eval {SELECT x, typeof(x) FROM t1}]
   243    243     } {-inf real}
   244    244   }
   245    245   do_test nan-4.9 {
   246    246     db eval {DELETE FROM t1}
   247    247     db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)"
   248    248     db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
   249    249   } {Inf real}
................................................................................
   313    313     db eval {SELECT CAST(x AS text), typeof(x) FROM t1}
   314    314   } {-9.88131291682493e-324 real}
   315    315   
   316    316   do_test nan-4.20 {
   317    317     db eval {DELETE FROM t1}
   318    318     set big [string repeat 9 10000].0e-9000
   319    319     db eval "INSERT INTO t1 VALUES($big)"
   320         -  db eval {SELECT x, typeof(x) FROM t1}
          320  +  string tolower [db eval {SELECT x, typeof(x) FROM t1}]
   321    321   } {inf real}
   322    322   
   323    323   
   324    324   
   325    325   finish_test