dan | 617dc86 | 2013-05-16 11:57:28 +0000 | [diff] [blame] | 1 | # 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 | |
| 16 | set testdir [file dirname $argv0] |
| 17 | source $testdir/tester.tcl |
| 18 | set ::testprefix close |
| 19 | |
drh | af3906a | 2016-03-14 17:05:04 +0000 | [diff] [blame] | 20 | # This module bypasses the "-key" logic in tester.tcl, so it cannot run |
| 21 | # with the codec enabled. |
| 22 | do_not_use_codec |
| 23 | |
dan | 617dc86 | 2013-05-16 11:57:28 +0000 | [diff] [blame] | 24 | do_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 | } |
| 30 | db close |
| 31 | |
| 32 | do_test 1.1 { |
| 33 | set DB [sqlite3_open test.db] |
| 34 | sqlite3_close_v2 $DB |
| 35 | } {SQLITE_OK} |
| 36 | |
| 37 | do_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} |
| 42 | do_test 1.2.2 { |
| 43 | sqlite3_finalize $STMT |
| 44 | } {SQLITE_OK} |
| 45 | |
| 46 | do_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 | |
| 53 | do_test 1.3.2 { |
| 54 | sqlite3_column_text $STMT 0 |
| 55 | } {one} |
| 56 | |
| 57 | do_test 1.3.3 { |
| 58 | sqlite3_finalize $STMT |
| 59 | } {SQLITE_OK} |
| 60 | |
| 61 | do_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 | |
| 68 | do_test 1.4.2 { |
| 69 | list [sqlite3_step $STMT] [sqlite3_column_text $STMT 0] |
| 70 | } {SQLITE_ROW two} |
| 71 | |
| 72 | do_test 1.4.3 { |
| 73 | list [catch { |
| 74 | sqlite3_prepare $DB "SELECT * FROM sqlite_master" -1 dummy |
| 75 | } msg] $msg |
drh | ff4fa77 | 2017-07-10 12:07:53 +0000 | [diff] [blame] | 76 | } {1 {(21) bad parameter or other API misuse}} |
dan | 617dc86 | 2013-05-16 11:57:28 +0000 | [diff] [blame] | 77 | |
| 78 | do_test 1.4.4 { |
| 79 | sqlite3_finalize $STMT |
| 80 | } {SQLITE_OK} |
| 81 | |
| 82 | finish_test |