sl@0: # 2006 June 27 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. sl@0: # sl@0: # This file implements tests to verify that ticket #1873 has been sl@0: # fixed. sl@0: # sl@0: # sl@0: # $Id: tkt1873.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: ifcapable !attach { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: file delete -force test2.db test2.db-journal sl@0: sl@0: do_test tkt1873-1.1 { sl@0: execsql { sl@0: CREATE TABLE t1(x, y); sl@0: ATTACH 'test2.db' AS aux; sl@0: CREATE TABLE aux.t2(x, y); sl@0: INSERT INTO t1 VALUES(1, 2); sl@0: INSERT INTO t1 VALUES(3, 4); sl@0: INSERT INTO t2 VALUES(5, 6); sl@0: INSERT INTO t2 VALUES(7, 8); sl@0: } sl@0: } {} sl@0: sl@0: do_test tkt1873-1.2 { sl@0: set rc [catch { sl@0: db eval {SELECT * FROM t2 LIMIT 1} { sl@0: db eval {DETACH aux} sl@0: } sl@0: } msg] sl@0: list $rc $msg sl@0: } {1 {database aux is locked}} sl@0: sl@0: do_test tkt1873-1.3 { sl@0: set rc [catch { sl@0: db eval {SELECT * FROM t1 LIMIT 1} { sl@0: db eval {DETACH aux} sl@0: } sl@0: } msg] sl@0: list $rc $msg sl@0: } {0 {}} sl@0: sl@0: do_test tkt1873-1.4 { sl@0: catchsql { sl@0: select * from t2; sl@0: } sl@0: } {1 {no such table: t2}} sl@0: sl@0: do_test tkt1873-1.5 { sl@0: catchsql { sl@0: ATTACH 'test2.db' AS aux; sl@0: select * from t2; sl@0: } sl@0: } {0 {5 6 7 8}} sl@0: sl@0: finish_test