Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a new test file for subqueries. (CVS 2250) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
de8ee3a29e1aafcfa05841cb44da0a05 |
User & Date: | drh 2005-01-21 02:34:44.000 |
Context
2005-01-21
| ||
03:12 | Modify test scripts to work when SQLITE_OMIT_SUBQUERY (along with other OMIT macros) is defined. (CVS 2251) (check-in: bb0254ab14 user: danielk1977 tags: trunk) | |
02:34 | Add a new test file for subqueries. (CVS 2250) (check-in: de8ee3a29e user: drh tags: trunk) | |
00:44 | Change the implementation of ALTER TABLE so that it does not use the IN() operattor. (CVS 2249) (check-in: 06887afb32 user: danielk1977 tags: trunk) | |
Changes
Added test/subquery.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 | # 2005 January 19 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # 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 implements regression tests for SQLite library. The # focus of this script is testing correlated subqueries # # $Id: subquery.test,v 1.1 2005/01/21 02:34:44 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl do_test subquery-1.1 { execsql { BEGIN; CREATE TABLE t1(a,b); INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); INSERT INTO t1 VALUES(5,6); INSERT INTO t1 VALUES(7,8); CREATE TABLE t2(x,y); INSERT INTO t2 VALUES(1,1); INSERT INTO t2 VALUES(3,9); INSERT INTO t2 VALUES(5,25); INSERT INTO t2 VALUES(7,49); COMMIT; } execsql { SELECT a, (SELECT y FROM t2 WHERE x=a) FROM t1 WHERE b<8 } } {1 1 3 9 5 25} do_test subquery-1.2 { execsql { UPDATE t1 SET b=b+(SELECT y FROM t2 WHERE x=a); SELECT * FROM t1; } } {1 3 3 13 5 31 7 57} do_test subquery-1.3 { execsql { SELECT b FROM t1 WHERE EXISTS(SELECT * FROM t2 WHERE y=a) } } {3} do_test subquery-1.4 { execsql { SELECT b FROM t1 WHERE NOT EXISTS(SELECT * FROM t2 WHERE y=a) } } {13 31 57} finish_test |