blob: d5d6391ae5e58be31e669f29d753cc1d970004e5 [file] [log] [blame]
dan617dc862013-05-16 11:57:28 +00001# 2013 May 14
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#
12# Test some specific circumstances to do with shared cache mode.
13#
14
15
16set testdir [file dirname $argv0]
17source $testdir/tester.tcl
18set ::testprefix close
19
20do_execsql_test 1.0 {
21 CREATE TABLE t1(x);
22 INSERT INTO t1 VALUES('one');
23 INSERT INTO t1 VALUES('two');
24 INSERT INTO t1 VALUES('three');
25}
26db close
27
28do_test 1.1 {
29 set DB [sqlite3_open test.db]
30 sqlite3_close_v2 $DB
31} {SQLITE_OK}
32
33do_test 1.2.1 {
34 set DB [sqlite3_open test.db]
35 set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
36 sqlite3_close_v2 $DB
37} {SQLITE_OK}
38do_test 1.2.2 {
39 sqlite3_finalize $STMT
40} {SQLITE_OK}
41
42do_test 1.3.1 {
43 set DB [sqlite3_open test.db]
44 set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
45 sqlite3_step $STMT
46 sqlite3_close_v2 $DB
47} {SQLITE_OK}
48
49do_test 1.3.2 {
50 sqlite3_column_text $STMT 0
51} {one}
52
53do_test 1.3.3 {
54 sqlite3_finalize $STMT
55} {SQLITE_OK}
56
57do_test 1.4.1 {
58 set DB [sqlite3_open test.db]
59 set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
60 sqlite3_step $STMT
61 sqlite3_close_v2 $DB
62} {SQLITE_OK}
63
64do_test 1.4.2 {
65 list [sqlite3_step $STMT] [sqlite3_column_text $STMT 0]
66} {SQLITE_ROW two}
67
68do_test 1.4.3 {
69 list [catch {
70 sqlite3_prepare $DB "SELECT * FROM sqlite_master" -1 dummy
71 } msg] $msg
72} {1 {(21) library routine called out of sequence}}
73
74do_test 1.4.4 {
75 sqlite3_finalize $STMT
76} {SQLITE_OK}
77
78finish_test