1# 2004 Jun 27 2# 3# The author disclaims copyright to this source code. In place of 4# a legal notice, here is a blessing: 5# 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. 9# 10#*********************************************************************** 11# This file implements regression tests for SQLite library. 12# 13# This file implements tests for miscellanous features that were 14# left out of other test files. 15# 16# $Id: misc4.test,v 1.3 2004/07/19 17:25:25 drh Exp $ 17 18set testdir [file dirname $argv0] 19source $testdir/tester.tcl 20 21# Prepare a statement that will create a temporary table. Then do 22# a rollback. Then try to execute the prepared statement. 23# 24do_test misc4-1.1 { 25 db close 26 set DB [sqlite3 db test.db] 27 execsql { 28 CREATE TABLE t1(x); 29 INSERT INTO t1 VALUES(1); 30 } 31 set sql {CREATE TEMP TABLE t2 AS SELECT * FROM t1} 32 set stmt [sqlite3_prepare $DB $sql -1 TAIL] 33 execsql { 34 BEGIN; 35 CREATE TABLE t3(a,b,c); 36 INSERT INTO t1 SELECT * FROM t1; 37 ROLLBACK; 38 } 39 sqlite3_step $stmt 40 execsql { 41 SELECT * FROM temp.t2; 42 } 43} {1} 44 45# Drop the temporary table, then rerun the prepared statement to 46# recreate it again. This recreates ticket #807. 47# 48do_test misc4-1.2 { 49 execsql {DROP TABLE t2} 50 sqlite3_reset $stmt 51 sqlite3_step $stmt 52} {SQLITE_ERROR} 53do_test misc4-1.3 { 54 sqlite3_finalize $stmt 55} {SQLITE_SCHEMA} 56 57finish_test 58