AryaWu/sqlite
0
1# 2013 May 142#3# The author disclaims copyright to this source code. In place of4# 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.tcl18set ::testprefix close19 20# This module bypasses the "-key" logic in tester.tcl, so it cannot run21# with the codec enabled.22do_not_use_codec23 24do_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 close31 32do_test 1.1 {33 set DB [sqlite3_open test.db]34 sqlite3_close_v2 $DB35} {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 $DB41} {SQLITE_OK}42do_test 1.2.2 {43 sqlite3_finalize $STMT44} {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 $STMT50 sqlite3_close_v2 $DB51} {SQLITE_OK}52 53do_test 1.3.2 {54 sqlite3_column_text $STMT 055} {one}56 57do_test 1.3.3 {58 sqlite3_finalize $STMT59} {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 $STMT65 sqlite3_close_v2 $DB66} {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 dummy75 } msg] $msg76} {1 {(21) bad parameter or other API misuse}}77 78do_test 1.4.4 {79 sqlite3_finalize $STMT80} {SQLITE_OK}81 82do_test 1.5 {83 set DB [sqlite3_open test.db]84 sqlite3_blob_open $DB main t1 x 2 0 BLOB85 sqlite3_close_v2 $DB86 sqlite3_blob_close $BLOB87} {}88 89finish_test90 