AryaWu/sqlite
0
1# 2007 Sep 32#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# Tests on the sqlite3_open_v2() interface.13#14# $Id: openv2.test,v 1.2 2009/06/11 17:32:45 drh Exp $15 16set testdir [file dirname $argv0]17source $testdir/tester.tcl18 19db close20forcedelete test.db test.db-journal21do_test openv2-1.1 {22 set rc [catch {sqlite3 db test.db -create 0} msg]23 lappend rc $msg24} {1 {unable to open database file}}25do_test openv2-1.2 {26 info commands db27} {}28do_test openv2-1.3 {29 sqlite3 db test.db30 db eval {CREATE TABLE t1(x)}31 db close32 sqlite3 db test.db -readonly 133 db eval {SELECT name FROM sqlite_master}34} {t1}35do_test openv2-1.4 {36 catchsql {37 INSERT INTO t1 VALUES(123)38 }39} {1 {attempt to write a readonly database}}40 41# Ticket #390842# Honor SQLITE_OPEN_READONLY even on an in-memory database, even though43# this is pointless.44#45do_test openv2-2.1 {46 db close47 sqlite3 db :memory: -readonly 148 db eval {SELECT * FROM sqlite_master}49} {}50do_test openv2-2.2 {51 catchsql {CREATE TABLE t1(x)}52} {1 {attempt to write a readonly database}}53 54 55finish_test56 