sl@0: # 2008 April 10 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file implements regression tests for SQLite library. The sl@0: # focus of this file is is verifying that a virtual table in the sl@0: # TEMP database that is created and dropped within a transaction sl@0: # is handled correctly. Ticket #2994. sl@0: # sl@0: # Also make sure a virtual table on the right-hand side of an IN operator sl@0: # is materialized rather than being used directly. Ticket #3082. sl@0: # sl@0: sl@0: # sl@0: # $Id: vtabB.test,v 1.2 2008/04/25 12:10:15 drh Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: ifcapable !vtab { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: do_test vtabB-1.1 { sl@0: register_echo_module [sqlite3_connection_pointer db] sl@0: execsql { sl@0: CREATE TABLE t1(x); sl@0: BEGIN; sl@0: CREATE VIRTUAL TABLE temp.echo_test1 USING echo(t1); sl@0: DROP TABLE echo_test1; sl@0: ROLLBACK; sl@0: } sl@0: } {} sl@0: sl@0: do_test vtabB-2.1 { sl@0: execsql { sl@0: INSERT INTO t1 VALUES(2); sl@0: INSERT INTO t1 VALUES(3); sl@0: CREATE TABLE t2(y); sl@0: INSERT INTO t2 VALUES(1); sl@0: INSERT INTO t2 VALUES(2); sl@0: CREATE VIRTUAL TABLE echo_t2 USING echo(t2); sl@0: SELECT * FROM t1 WHERE x IN (SELECT rowid FROM t2); sl@0: } sl@0: } {2} sl@0: do_test vtab8-2.2 { sl@0: execsql { sl@0: SELECT rowid FROM echo_t2 sl@0: } sl@0: } {1 2} sl@0: do_test vtabB-2.3 { sl@0: execsql { sl@0: SELECT * FROM t1 WHERE x IN (SELECT rowid FROM t2); sl@0: } sl@0: } {2} sl@0: do_test vtabB-2.4 { sl@0: execsql { sl@0: SELECT * FROM t1 WHERE x IN (SELECT rowid FROM echo_t2); sl@0: } sl@0: } {2} sl@0: do_test vtabB-2.5 { sl@0: execsql { sl@0: SELECT * FROM t1 WHERE x IN (SELECT y FROM t2); sl@0: } sl@0: } {2} sl@0: do_test vtabB-2.6 { sl@0: execsql { sl@0: SELECT * FROM t1 WHERE x IN (SELECT y FROM echo_t2); sl@0: } sl@0: } {2} sl@0: sl@0: finish_test