os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/vtabB.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/vtabB.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,79 @@
     1.4 +# 2008 April 10
     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.  The
    1.15 +# focus of this file is is verifying that a virtual table in the
    1.16 +# TEMP database that is created and dropped within a transaction
    1.17 +# is handled correctly.  Ticket #2994.
    1.18 +#
    1.19 +# Also make sure a virtual table on the right-hand side of an IN operator
    1.20 +# is materialized rather than being used directly.  Ticket #3082.
    1.21 +#
    1.22 +
    1.23 +#
    1.24 +# $Id: vtabB.test,v 1.2 2008/04/25 12:10:15 drh Exp $
    1.25 +
    1.26 +set testdir [file dirname $argv0]
    1.27 +source $testdir/tester.tcl
    1.28 +
    1.29 +ifcapable !vtab {
    1.30 +  finish_test
    1.31 +  return
    1.32 +}
    1.33 +
    1.34 +do_test vtabB-1.1 {
    1.35 +  register_echo_module [sqlite3_connection_pointer db]
    1.36 +  execsql {
    1.37 +    CREATE TABLE t1(x);
    1.38 +    BEGIN;
    1.39 +    CREATE VIRTUAL TABLE temp.echo_test1 USING echo(t1);
    1.40 +    DROP TABLE echo_test1;
    1.41 +    ROLLBACK;
    1.42 +  }
    1.43 +} {}
    1.44 +
    1.45 +do_test vtabB-2.1 {
    1.46 +  execsql {
    1.47 +    INSERT INTO t1 VALUES(2);
    1.48 +    INSERT INTO t1 VALUES(3);
    1.49 +    CREATE TABLE t2(y);
    1.50 +    INSERT INTO t2 VALUES(1);
    1.51 +    INSERT INTO t2 VALUES(2);
    1.52 +    CREATE VIRTUAL TABLE echo_t2 USING echo(t2);
    1.53 +    SELECT * FROM t1 WHERE x IN (SELECT rowid FROM t2);
    1.54 +  }
    1.55 +} {2}
    1.56 +do_test vtab8-2.2 {
    1.57 +  execsql {
    1.58 +    SELECT rowid FROM echo_t2
    1.59 +  }
    1.60 +} {1 2}
    1.61 +do_test vtabB-2.3 {
    1.62 +  execsql {
    1.63 +    SELECT * FROM t1 WHERE x IN (SELECT rowid FROM t2);
    1.64 +  }
    1.65 +} {2}
    1.66 +do_test vtabB-2.4 {
    1.67 +  execsql {
    1.68 +    SELECT * FROM t1 WHERE x IN (SELECT rowid FROM echo_t2);
    1.69 +  }
    1.70 +} {2}
    1.71 +do_test vtabB-2.5 {
    1.72 +  execsql {
    1.73 +    SELECT * FROM t1 WHERE x IN (SELECT y FROM t2);
    1.74 +  }
    1.75 +} {2}
    1.76 +do_test vtabB-2.6 {
    1.77 +  execsql {
    1.78 +    SELECT * FROM t1 WHERE x IN (SELECT y FROM echo_t2);
    1.79 +  }
    1.80 +} {2}
    1.81 +
    1.82 +finish_test