3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # This file implements tests to verify that ticket #1644 is
14 # fixed. Ticket #1644 complains that precompiled statements
15 # are not expired correctly as a result of changes to TEMP
19 set testdir [file dirname $argv0]
20 source $testdir/tester.tcl
22 ifcapable !tempdb||!view {
27 # Create two tables T1 and T2 and make V1 point to T1.
31 INSERT INTO t1 VALUES(1);
33 INSERT INTO t2 VALUES(99);
34 CREATE TEMP VIEW v1 AS SELECT * FROM t1;
39 # The "SELECT * FROM v1" should be in the TCL interface cache below.
40 # It will continue to point to T1 unless the cache is invalidated when
46 CREATE TEMP VIEW v1 AS SELECT * FROM t2;
51 # Cache an access to the T1 table.
59 # Create a temp table T1. Make sure the cache is invalidated so that
60 # the statement is recompiled and refers to the empty temp table.
64 CREATE TEMP TABLE t1(x);
74 CREATE TEMP TABLE temp_t1(a, b);
76 set ::DB [sqlite3_connection_pointer db]
77 set ::STMT [sqlite3_prepare $::DB "SELECT * FROM temp_t1" -1 DUMMY]
81 list [sqlite3_step $::STMT] [sqlite3_finalize $::STMT]
82 } {SQLITE_ERROR SQLITE_SCHEMA}
86 CREATE TABLE real_t1(a, b);
87 CREATE TEMP VIEW temp_v1 AS SELECT * FROM real_t1;
89 set ::DB [sqlite3_connection_pointer db]
90 set ::STMT [sqlite3_prepare $::DB "SELECT * FROM temp_v1" -1 DUMMY]
94 list [sqlite3_step $::STMT] [sqlite3_finalize $::STMT]
95 } {SQLITE_ERROR SQLITE_SCHEMA}
99 CREATE TEMP VIEW temp_v1 AS SELECT * FROM real_t1 LIMIT 10 OFFSET 10;
101 set ::DB [sqlite3_connection_pointer db]
102 set ::STMT [sqlite3_prepare $::DB "SELECT * FROM temp_v1" -1 DUMMY]
106 list [sqlite3_step $::STMT] [sqlite3_finalize $::STMT]
107 } {SQLITE_ERROR SQLITE_SCHEMA}