os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/openv2.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/openv2.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,41 @@
     1.4 +# 2007 Sep 3
     1.5 +#
     1.6 +# The author disclaims copyright to this source code.  In place of
     1.7 +# a legal notice, here is a blessing:
     1.8 +#
     1.9 +#    May you do good and not evil.
    1.10 +#    May you find forgiveness for yourself and forgive others.
    1.11 +#    May you share freely, never taking more than you give.
    1.12 +#
    1.13 +#***********************************************************************
    1.14 +#
    1.15 +# Tests on the sqlite3_open_v2() interface.
    1.16 +#
    1.17 +# $Id: openv2.test,v 1.1 2007/09/03 15:19:36 drh Exp $
    1.18 +
    1.19 +set testdir [file dirname $argv0]
    1.20 +source $testdir/tester.tcl
    1.21 +
    1.22 +db close
    1.23 +file delete -force test.db test.db-journal
    1.24 +do_test openv2-1.1 {
    1.25 +  set rc [catch {sqlite3 db test.db -create 0} msg]
    1.26 +  lappend rc $msg
    1.27 +} {1 {unable to open database file}}
    1.28 +do_test openv2-1.2 {
    1.29 +  info commands db
    1.30 +} {}
    1.31 +do_test openv2-1.3 {
    1.32 +  sqlite3 db test.db
    1.33 +  db eval {CREATE TABLE t1(x)}
    1.34 +  db close
    1.35 +  sqlite3 db test.db -readonly 1
    1.36 +  db eval {SELECT name FROM sqlite_master}
    1.37 +} {t1}
    1.38 +do_test openv2-1.4 {
    1.39 +  catchsql {
    1.40 +    INSERT INTO t1 VALUES(123)
    1.41 +  }
    1.42 +} {1 {attempt to write a readonly database}}
    1.43 +
    1.44 +finish_test