os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt3201.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
# 2008 July 4
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
# Specifically, it tests that bug #3201 has been fixed.
sl@0
    13
#
sl@0
    14
# $Id: tkt3201.test,v 1.3 2008/07/12 14:52:21 drh Exp $
sl@0
    15
sl@0
    16
set testdir [file dirname $argv0]
sl@0
    17
source $testdir/tester.tcl
sl@0
    18
sl@0
    19
do_test tkt3201-1 {
sl@0
    20
  execsql {
sl@0
    21
    CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
sl@0
    22
    INSERT INTO t1 VALUES(1, 'one');
sl@0
    23
    INSERT INTO t1 VALUES(2, 'two');
sl@0
    24
  }
sl@0
    25
} {}
sl@0
    26
sl@0
    27
do_test tkt3201-2 {
sl@0
    28
  execsql {
sl@0
    29
    SELECT l.a, r.a FROM t1 AS l, t1 AS r WHERE l.a < r.a;
sl@0
    30
  }
sl@0
    31
} {1 2}
sl@0
    32
sl@0
    33
do_test tkt3201-3 {
sl@0
    34
  execsql {
sl@0
    35
    CREATE TABLE t2(a INTEGER PRIMARY KEY, b TEXT);
sl@0
    36
    INSERT INTO t2 VALUES(2, 'two');
sl@0
    37
  }
sl@0
    38
  execsql {
sl@0
    39
    SELECT l.a, r.a FROM t1 AS l, t2 AS r WHERE l.a < r.a;
sl@0
    40
  }
sl@0
    41
} {1 2}
sl@0
    42
sl@0
    43
do_test tkt3201-4 {
sl@0
    44
  execsql {
sl@0
    45
    DELETE FROM t1 WHERE a = 2;
sl@0
    46
  }
sl@0
    47
  execsql {
sl@0
    48
    SELECT l.a, r.a FROM t1 AS l, t2 AS r WHERE l.a < r.a;
sl@0
    49
  }
sl@0
    50
} {1 2}
sl@0
    51
sl@0
    52
do_test tkt3201-5 {
sl@0
    53
  execsql {
sl@0
    54
    DELETE FROM t1 WHERE a = 2;
sl@0
    55
  }
sl@0
    56
  execsql {
sl@0
    57
    SELECT t1.a, t1.b, t2.a, t2.b FROM t1, t2;
sl@0
    58
  }
sl@0
    59
} {1 one 2 two}
sl@0
    60
sl@0
    61
do_test tkt3201-6 {
sl@0
    62
  execsql {
sl@0
    63
    CREATE TABLE t3(c INTEGER PRIMARY KEY, d TEXT);
sl@0
    64
    INSERT INTO t3 VALUES(2, 'two');
sl@0
    65
  }
sl@0
    66
  execsql { SELECT a, b, c, d FROM t1, t3 }
sl@0
    67
} {1 one 2 two}
sl@0
    68
sl@0
    69
do_test tkt3201-7 {
sl@0
    70
  execsql { SELECT a, b, c, d FROM t1, t3 WHERE a < c }
sl@0
    71
} {1 one 2 two}
sl@0
    72
sl@0
    73
sl@0
    74
finish_test