1: # 2006 June 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 to verify that ticket #1873 has been
14: # fixed.
15: #
16: #
17: # $Id: tkt1873.test,v 1.1.1.1 2012/02/21 17:04:16 misho Exp $
18:
19: set testdir [file dirname $argv0]
20: source $testdir/tester.tcl
21:
22: ifcapable !attach {
23: finish_test
24: return
25: }
26:
27: forcedelete test2.db test2.db-journal
28:
29: do_test tkt1873-1.1 {
30: execsql {
31: CREATE TABLE t1(x, y);
32: ATTACH 'test2.db' AS aux;
33: CREATE TABLE aux.t2(x, y);
34: INSERT INTO t1 VALUES(1, 2);
35: INSERT INTO t1 VALUES(3, 4);
36: INSERT INTO t2 VALUES(5, 6);
37: INSERT INTO t2 VALUES(7, 8);
38: }
39: } {}
40:
41: do_test tkt1873-1.2 {
42: set rc [catch {
43: db eval {SELECT * FROM t2 LIMIT 1} {
44: db eval {DETACH aux}
45: }
46: } msg]
47: list $rc $msg
48: } {1 {database aux is locked}}
49:
50: do_test tkt1873-1.3 {
51: set rc [catch {
52: db eval {SELECT * FROM t1 LIMIT 1} {
53: db eval {DETACH aux}
54: }
55: } msg]
56: list $rc $msg
57: } {0 {}}
58:
59: do_test tkt1873-1.4 {
60: catchsql {
61: select * from t2;
62: }
63: } {1 {no such table: t2}}
64:
65: do_test tkt1873-1.5 {
66: catchsql {
67: ATTACH 'test2.db' AS aux;
68: select * from t2;
69: }
70: } {0 {5 6 7 8}}
71:
72: finish_test
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>