blob: 99bc7255e2d7aacf3024f79140f6dc0b228e3a5a [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
drhaf3906a2016-03-14 17:05:04 +000020# This module bypasses the "-key" logic in tester.tcl, so it cannot run
21# with the codec enabled.
22do_not_use_codec
23
dan617dc862013-05-16 11:57:28 +000024do_execsql_test 1.0 {
25 CREATE TABLE t1(x);
26 INSERT INTO t1 VALUES('one');
27 INSERT INTO t1 VALUES('two');
28 INSERT INTO t1 VALUES('three');
29}
30db close
31
32do_test 1.1 {
33 set DB [sqlite3_open test.db]
34 sqlite3_close_v2 $DB
35} {SQLITE_OK}
36
37do_test 1.2.1 {
38 set DB [sqlite3_open test.db]
39 set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
40 sqlite3_close_v2 $DB
41} {SQLITE_OK}
42do_test 1.2.2 {
43 sqlite3_finalize $STMT
44} {SQLITE_OK}
45
46do_test 1.3.1 {
47 set DB [sqlite3_open test.db]
48 set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
49 sqlite3_step $STMT
50 sqlite3_close_v2 $DB
51} {SQLITE_OK}
52
53do_test 1.3.2 {
54 sqlite3_column_text $STMT 0
55} {one}
56
57do_test 1.3.3 {
58 sqlite3_finalize $STMT
59} {SQLITE_OK}
60
61do_test 1.4.1 {
62 set DB [sqlite3_open test.db]
63 set STMT [sqlite3_prepare $DB "SELECT * FROM t1" -1 dummy]
64 sqlite3_step $STMT
65 sqlite3_close_v2 $DB
66} {SQLITE_OK}
67
68do_test 1.4.2 {
69 list [sqlite3_step $STMT] [sqlite3_column_text $STMT 0]
70} {SQLITE_ROW two}
71
72do_test 1.4.3 {
73 list [catch {
74 sqlite3_prepare $DB "SELECT * FROM sqlite_master" -1 dummy
75 } msg] $msg
drhff4fa772017-07-10 12:07:53 +000076} {1 {(21) bad parameter or other API misuse}}
dan617dc862013-05-16 11:57:28 +000077
78do_test 1.4.4 {
79 sqlite3_finalize $STMT
80} {SQLITE_OK}
81
82finish_test