os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2141.test
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
# 2007 January 03
sl@0
     2
#
sl@0
     3
# The author disclaims copyright to this source code.  In place of
sl@0
     4
# a legal notice, here is a blessing:
sl@0
     5
#
sl@0
     6
#    May you do good and not evil.
sl@0
     7
#    May you find forgiveness for yourself and forgive others.
sl@0
     8
#    May you share freely, never taking more than you give.
sl@0
     9
#
sl@0
    10
#***********************************************************************
sl@0
    11
# This file implements regression tests for SQLite library.
sl@0
    12
#
sl@0
    13
# This file implements tests to verify that ticket #2141 has been
sl@0
    14
# fixed.  
sl@0
    15
#
sl@0
    16
#
sl@0
    17
# $Id: tkt2141.test,v 1.2 2007/09/12 17:01:45 danielk1977 Exp $
sl@0
    18
sl@0
    19
set testdir [file dirname $argv0]
sl@0
    20
source $testdir/tester.tcl
sl@0
    21
sl@0
    22
ifcapable !subquery {
sl@0
    23
  finish_test
sl@0
    24
  return
sl@0
    25
}
sl@0
    26
sl@0
    27
do_test tkt2141-1.1 {
sl@0
    28
  execsql {
sl@0
    29
      CREATE TABLE tab1 (t1_id integer PRIMARY KEY, t1_desc);
sl@0
    30
      INSERT INTO tab1 VALUES(1,'rec 1 tab 1');
sl@0
    31
      CREATE TABLE tab2 (t2_id integer PRIMARY KEY, t2_id_t1, t2_desc);
sl@0
    32
      INSERT INTO tab2 VALUES(1,1,'rec 1 tab 2');
sl@0
    33
      CREATE TABLE tab3 (t3_id integer PRIMARY KEY, t3_id_t2, t3_desc);
sl@0
    34
      INSERT INTO tab3 VALUES(1,1,'aa');
sl@0
    35
      SELECT *
sl@0
    36
      FROM tab1 t1 LEFT JOIN tab2 t2 ON t1.t1_id = t2.t2_id_t1
sl@0
    37
      WHERE t2.t2_id IN
sl@0
    38
           (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2
sl@0
    39
             WHERE t3_id IN (1,2) GROUP BY t2_id);
sl@0
    40
  }
sl@0
    41
} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}}
sl@0
    42
do_test tkt2141-1.2 {
sl@0
    43
  execsql {
sl@0
    44
      SELECT *
sl@0
    45
      FROM tab1 t1 LEFT JOIN tab2 t2 ON t1.t1_id = t2.t2_id_t1
sl@0
    46
      WHERE t2.t2_id IN
sl@0
    47
           (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2
sl@0
    48
             WHERE t3_id IN (1,2));
sl@0
    49
  }
sl@0
    50
} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}}
sl@0
    51
do_test tkt2141-1.3 {
sl@0
    52
  execsql {
sl@0
    53
      SELECT *
sl@0
    54
      FROM tab1 t1 LEFT JOIN tab2 t2
sl@0
    55
      WHERE t2.t2_id IN
sl@0
    56
           (SELECT t2_id FROM tab2, tab3 ON t2_id = t3_id_t2
sl@0
    57
             WHERE t3_id IN (1,2));
sl@0
    58
  }
sl@0
    59
} {1 {rec 1 tab 1} 1 1 {rec 1 tab 2}}
sl@0
    60
sl@0
    61
finish_test