1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt1873.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,72 @@
1.4 +# 2006 June 27
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.
1.15 +#
1.16 +# This file implements tests to verify that ticket #1873 has been
1.17 +# fixed.
1.18 +#
1.19 +#
1.20 +# $Id: tkt1873.test,v 1.2 2007/10/09 08:29:33 danielk1977 Exp $
1.21 +
1.22 +set testdir [file dirname $argv0]
1.23 +source $testdir/tester.tcl
1.24 +
1.25 +ifcapable !attach {
1.26 + finish_test
1.27 + return
1.28 +}
1.29 +
1.30 +file delete -force test2.db test2.db-journal
1.31 +
1.32 +do_test tkt1873-1.1 {
1.33 + execsql {
1.34 + CREATE TABLE t1(x, y);
1.35 + ATTACH 'test2.db' AS aux;
1.36 + CREATE TABLE aux.t2(x, y);
1.37 + INSERT INTO t1 VALUES(1, 2);
1.38 + INSERT INTO t1 VALUES(3, 4);
1.39 + INSERT INTO t2 VALUES(5, 6);
1.40 + INSERT INTO t2 VALUES(7, 8);
1.41 + }
1.42 +} {}
1.43 +
1.44 +do_test tkt1873-1.2 {
1.45 + set rc [catch {
1.46 + db eval {SELECT * FROM t2 LIMIT 1} {
1.47 + db eval {DETACH aux}
1.48 + }
1.49 + } msg]
1.50 + list $rc $msg
1.51 +} {1 {database aux is locked}}
1.52 +
1.53 +do_test tkt1873-1.3 {
1.54 + set rc [catch {
1.55 + db eval {SELECT * FROM t1 LIMIT 1} {
1.56 + db eval {DETACH aux}
1.57 + }
1.58 + } msg]
1.59 + list $rc $msg
1.60 +} {0 {}}
1.61 +
1.62 +do_test tkt1873-1.4 {
1.63 + catchsql {
1.64 + select * from t2;
1.65 + }
1.66 +} {1 {no such table: t2}}
1.67 +
1.68 +do_test tkt1873-1.5 {
1.69 + catchsql {
1.70 + ATTACH 'test2.db' AS aux;
1.71 + select * from t2;
1.72 + }
1.73 +} {0 {5 6 7 8}}
1.74 +
1.75 +finish_test