SQLite

Check-in [251c78a982]
Login

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

Overview
Comment:Fix a bug in the test scripts that was preventing many scripts from running with all.test. Lots of hidden failures now come to light. (CVS 4723)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 251c78a982a33194a052897c37a2a79ae9654452
User & Date: drh 2008-01-18 02:31:56.000
Context
2008-01-18
11:33
Add a couple of missing calls to pagerLeave(). (CVS 4724) (check-in: 87534dfff9 user: danielk1977 tags: trunk)
02:31
Fix a bug in the test scripts that was preventing many scripts from running with all.test. Lots of hidden failures now come to light. (CVS 4723) (check-in: 251c78a982 user: drh tags: trunk)
2008-01-17
22:27
Test coverage for date.c. (CVS 4722) (check-in: a676f949b6 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/expr.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.348 2008/01/17 17:15:56 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Return the 'affinity' of the expression pExpr if any.
**







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.349 2008/01/18 02:31:56 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Return the 'affinity' of the expression pExpr if any.
**
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
    case TK_EQ: {
      assert( TK_LT==OP_Lt );
      assert( TK_LE==OP_Le );
      assert( TK_GT==OP_Gt );
      assert( TK_GE==OP_Ge );
      assert( TK_EQ==OP_Eq );
      assert( TK_NE==OP_Ne );
      if( target==0 ){
        inReg = ++pParse->nMem;
      }
      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
                  r1, r2, inReg, SQLITE_STOREP2);
      break;
    }
    case TK_AND:







<
<
<







2050
2051
2052
2053
2054
2055
2056



2057
2058
2059
2060
2061
2062
2063
    case TK_EQ: {
      assert( TK_LT==OP_Lt );
      assert( TK_LE==OP_Le );
      assert( TK_GT==OP_Gt );
      assert( TK_GE==OP_Ge );
      assert( TK_EQ==OP_Eq );
      assert( TK_NE==OP_Ne );



      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
                  r1, r2, inReg, SQLITE_STOREP2);
      break;
    }
    case TK_AND:
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237

      /* Figure out the affinity to use to create a key from the results
      ** of the expression. affinityStr stores a static string suitable for
      ** P4 of OP_MakeRecord.
      */
      affinity = comparisonAffinity(pExpr);

      if( target==0 ){
        target = inReg = ++pParse->nMem;
      }
      sqlite3VdbeAddOp2(v, OP_Integer, 1, target);

      /* Code the <expr> from "<expr> IN (...)". The temporary table
      ** pExpr->iTable contains the values that make up the (...) set.
      */
      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      j1 = sqlite3VdbeAddOp1(v, OP_NotNull, r1);







<
<
<







2218
2219
2220
2221
2222
2223
2224



2225
2226
2227
2228
2229
2230
2231

      /* Figure out the affinity to use to create a key from the results
      ** of the expression. affinityStr stores a static string suitable for
      ** P4 of OP_MakeRecord.
      */
      affinity = comparisonAffinity(pExpr);




      sqlite3VdbeAddOp2(v, OP_Integer, 1, target);

      /* Code the <expr> from "<expr> IN (...)". The temporary table
      ** pExpr->iTable contains the values that make up the (...) set.
      */
      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      j1 = sqlite3VdbeAddOp1(v, OP_NotNull, r1);
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
    ** Z is stored in pExpr->pList->a[1].pExpr.
    */
    case TK_BETWEEN: {
      Expr *pLeft = pExpr->pLeft;
      struct ExprList_item *pLItem = pExpr->pList->a;
      Expr *pRight = pLItem->pExpr;

      if( target==0 ){
        inReg = target = ++pParse->nMem;
      }
      r1 = sqlite3ExprCodeTemp(pParse, pLeft, &regFree1);
      r2 = sqlite3ExprCodeTemp(pParse, pRight, &regFree2);
      r3 = sqlite3GetTempReg(pParse);
      codeCompare(pParse, pLeft, pRight, OP_Ge,
                  r1, r2, r3, SQLITE_STOREP2);
      pLItem++;
      pRight = pLItem->pExpr;







<
<
<







2261
2262
2263
2264
2265
2266
2267



2268
2269
2270
2271
2272
2273
2274
    ** Z is stored in pExpr->pList->a[1].pExpr.
    */
    case TK_BETWEEN: {
      Expr *pLeft = pExpr->pLeft;
      struct ExprList_item *pLItem = pExpr->pList->a;
      Expr *pRight = pLItem->pExpr;




      r1 = sqlite3ExprCodeTemp(pParse, pLeft, &regFree1);
      r2 = sqlite3ExprCodeTemp(pParse, pRight, &regFree2);
      r3 = sqlite3GetTempReg(pParse);
      codeCompare(pParse, pLeft, pRight, OP_Ge,
                  r1, r2, r3, SQLITE_STOREP2);
      pLItem++;
      pRight = pLItem->pExpr;
Changes to test/onefile.test.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: onefile.test,v 1.2 2007/10/03 08:46:45 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
rename finish_test really_finish_test2
proc finish_test {} {
  catch {db close}
  catch {db2 close}
  catch {db3 close}
}
set ISQUICK 1

set INCLUDE {
  conflict.test
  insert.test
  insert2.test
  insert3.test
  rollback.test
  select1.test
  select2.test
  select3.test
  temptable.test
}
#set INCLUDE insert2.test

rename sqlite3 really_sqlite3
proc sqlite3 {args} {
  if {[string range [lindex $args 0] 0 0] ne "-"} {
    lappend args -vfs fs
  }
  uplevel [concat really_sqlite3 $args]
}

rename do_test really_do_test
proc do_test {name args} {
  uplevel really_do_test onefile-$name $args
}

foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
  set tail [file tail $testfile]
  if {[lsearch -exact $INCLUDE $tail]<0} continue
  source $testfile
}

file delete -force test.db test2.db test3.db test4.db

really_finish_test2
rename do_test {}
rename really_do_test do_test
rename finish_test {}
rename really_finish_test2 finish_test
rename sqlite3 {}
rename really_sqlite3 sqlite3








|











|










|
















|












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file runs all tests.
#
# $Id: onefile.test,v 1.3 2008/01/18 02:31:56 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl
rename finish_test really_finish_test2
proc finish_test {} {
  catch {db close}
  catch {db2 close}
  catch {db3 close}
}
set ISQUICK 1

set onefile_INCLUDE {
  conflict.test
  insert.test
  insert2.test
  insert3.test
  rollback.test
  select1.test
  select2.test
  select3.test
  temptable.test
}
#set onefile_INCLUDE insert2.test

rename sqlite3 really_sqlite3
proc sqlite3 {args} {
  if {[string range [lindex $args 0] 0 0] ne "-"} {
    lappend args -vfs fs
  }
  uplevel [concat really_sqlite3 $args]
}

rename do_test really_do_test
proc do_test {name args} {
  uplevel really_do_test onefile-$name $args
}

foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
  set tail [file tail $testfile]
  if {[lsearch -exact $onefile_INCLUDE $tail]<0} continue
  source $testfile
}

file delete -force test.db test2.db test3.db test4.db

really_finish_test2
rename do_test {}
rename really_do_test do_test
rename finish_test {}
rename really_finish_test2 finish_test
rename sqlite3 {}
rename really_sqlite3 sqlite3