OLD | NEW |
1 # 2007 April 24 | 1 # 2007 April 24 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 # Create a database. | 26 # Create a database. |
27 # | 27 # |
28 do_test rdonly-1.1 { | 28 do_test rdonly-1.1 { |
29 execsql { | 29 execsql { |
30 CREATE TABLE t1(x); | 30 CREATE TABLE t1(x); |
31 INSERT INTO t1 VALUES(1); | 31 INSERT INTO t1 VALUES(1); |
32 SELECT * FROM t1; | 32 SELECT * FROM t1; |
33 } | 33 } |
34 } {1} | 34 } {1} |
| 35 |
| 36 # EVIDENCE-OF: R-29639-16887 The sqlite3_db_readonly(D,N) interface |
| 37 # returns 1 if the database N of connection D is read-only, 0 if it is |
| 38 # read/write, or -1 if N is not the name of a database on connection D. |
| 39 # |
35 do_test rdonly-1.1.1 { | 40 do_test rdonly-1.1.1 { |
36 sqlite3_db_readonly db main | 41 sqlite3_db_readonly db main |
37 } {0} | 42 } {0} |
38 | 43 |
39 # Changes the write version from 1 to 3. Verify that the database | 44 # Changes the write version from 1 to 3. Verify that the database |
40 # can be read but not written. | 45 # can be read but not written. |
41 # | 46 # |
42 do_test rdonly-1.2 { | 47 do_test rdonly-1.2 { |
43 db close | 48 db close |
44 hexio_get_int [hexio_read test.db 18 1] | 49 hexio_get_int [hexio_read test.db 18 1] |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 ifcapable wal { set ro_version 03 } | 86 ifcapable wal { set ro_version 03 } |
82 do_test rdonly-1.6 { | 87 do_test rdonly-1.6 { |
83 hexio_write test.db 18 $ro_version ; # write-version | 88 hexio_write test.db 18 $ro_version ; # write-version |
84 hexio_write test.db 24 11223344 ; # change-counter | 89 hexio_write test.db 24 11223344 ; # change-counter |
85 catchsql { | 90 catchsql { |
86 INSERT INTO t1 VALUES(2); | 91 INSERT INTO t1 VALUES(2); |
87 } | 92 } |
88 } {1 {attempt to write a readonly database}} | 93 } {1 {attempt to write a readonly database}} |
89 | 94 |
90 finish_test | 95 finish_test |
OLD | NEW |