Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/test/rdonly.test

Issue 2363173002: [sqlite] Remove obsolete reference version 3.8.7.4. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # 2007 April 24
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 # This file implements regression tests for SQLite library.
12 #
13 # This file implements tests to make sure SQLite treats a database
14 # as readonly if its write version is set to high.
15 #
16 # $Id: rdonly.test,v 1.2 2008/07/08 10:19:58 danielk1977 Exp $
17
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
20
21 # Do not use a codec for tests in this file, as the database file is
22 # manipulated directly using tcl scripts (using the [hexio_write] command).
23 #
24 do_not_use_codec
25
26 # Create a database.
27 #
28 do_test rdonly-1.1 {
29 execsql {
30 CREATE TABLE t1(x);
31 INSERT INTO t1 VALUES(1);
32 SELECT * FROM t1;
33 }
34 } {1}
35 do_test rdonly-1.1.1 {
36 sqlite3_db_readonly db main
37 } {0}
38
39 # Changes the write version from 1 to 3. Verify that the database
40 # can be read but not written.
41 #
42 do_test rdonly-1.2 {
43 db close
44 hexio_get_int [hexio_read test.db 18 1]
45 } 1
46 do_test rdonly-1.3 {
47 hexio_write test.db 18 03
48 sqlite3 db test.db
49 execsql {
50 SELECT * FROM t1;
51 }
52 } {1}
53 do_test rdonly-1.3.1 {
54 sqlite3_db_readonly db main
55 } {1}
56 do_test rdonly-1.4 {
57 catchsql {
58 INSERT INTO t1 VALUES(2)
59 }
60 } {1 {attempt to write a readonly database}}
61
62 # Change the write version back to 1. Verify that the database
63 # is read-write again.
64 #
65 do_test rdonly-1.5 {
66 db close
67 hexio_write test.db 18 01
68 sqlite3 db test.db
69 catchsql {
70 INSERT INTO t1 VALUES(2);
71 SELECT * FROM t1;
72 }
73 } {0 {1 2}}
74
75 # Now, after connection [db] has loaded the database schema, modify the
76 # write-version of the file (and the change-counter, so that the
77 # write-version is reloaded). This way, SQLite does not discover that
78 # the database is read-only until after it is locked.
79 #
80 set ro_version 02
81 ifcapable wal { set ro_version 03 }
82 do_test rdonly-1.6 {
83 hexio_write test.db 18 $ro_version ; # write-version
84 hexio_write test.db 24 11223344 ; # change-counter
85 catchsql {
86 INSERT INTO t1 VALUES(2);
87 }
88 } {1 {attempt to write a readonly database}}
89
90 finish_test
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/randexpr1.tcl ('k') | third_party/sqlite/sqlite-src-3080704/test/regexp1.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698