os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2141.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2141.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,61 @@
     1.4 +# 2007 January 03
     1.5 +#
     1.6 +# The author disclaims copyright to this source code.  In place of
     1.7 +# a legal notice, here is a blessing:
     1.8 +#
     1.9 +#    May you do good and not evil.
    1.10 +#    May you find forgiveness for yourself and forgive others.
    1.11 +#    May you share freely, never taking more than you give.
    1.12 +#
    1.13 +#***********************************************************************
    1.14 +# This file implements regression tests for SQLite library.
    1.15 +#
    1.16 +# This file implements tests to verify that ticket #2141 has been
    1.17 +# fixed.  
    1.18 +#
    1.19 +#
    1.20 +# $Id: tkt2141.test,v 1.2 2007/09/12 17:01:45 danielk1977 Exp $
    1.21 +
    1.22 +set testdir [file dirname $argv0]
    1.23 +source $testdir/tester.tcl
    1.24 +
    1.25 +ifcapable !subquery {
    1.26 +  finish_test
    1.27 +  return
    1.28 +}
    1.29 +
    1.30 +do_test tkt2141-1.1 {
    1.31 +  execsql {
    1.32 +      CREATE TABLE tab1 (t1_id integer PRIMARY KEY, t1_desc);
    1.33 +      INSERT INTO tab1 VALUES(1,'rec 1 tab 1');
    1.34 +      CREATE TABLE tab2 (t2_id integer PRIMARY KEY, t2_id_t1, t2_desc);
    1.35 +      INSERT INTO tab2 VALUES(1,1,'rec 1 tab 2');
    1.36 +      CREATE TABLE tab3 (t3_id integer PRIMARY KEY, t3_id_t2, t3_desc);
    1.37 +      INSERT INTO tab3 VALUES(1,1,'aa');
    1.38 +      SELECT *
    1.39 +      FROM tab1 t1 LEFT JOIN tab2 t2 ON t1.t1_id = t2.t2_id_t1
    1.40 +      WHERE t2.t2_id IN
    1.41 +           (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2
    1.42 +             WHERE t3_id IN (1,2) GROUP BY t2_id);
    1.43 +  }
    1.44 +} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}}
    1.45 +do_test tkt2141-1.2 {
    1.46 +  execsql {
    1.47 +      SELECT *
    1.48 +      FROM tab1 t1 LEFT JOIN tab2 t2 ON t1.t1_id = t2.t2_id_t1
    1.49 +      WHERE t2.t2_id IN
    1.50 +           (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2
    1.51 +             WHERE t3_id IN (1,2));
    1.52 +  }
    1.53 +} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}}
    1.54 +do_test tkt2141-1.3 {
    1.55 +  execsql {
    1.56 +      SELECT *
    1.57 +      FROM tab1 t1 LEFT JOIN tab2 t2
    1.58 +      WHERE t2.t2_id IN
    1.59 +           (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2
    1.60 +             WHERE t3_id IN (1,2));
    1.61 +  }
    1.62 +} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}}
    1.63 +
    1.64 +finish_test