Merge latest trunk changes. Add a couple of readonly shm tests.
FossilOrigin-Name: cde45a033ee6834900f5f5c272c383408883a74c
This commit is contained in:
commit
3640db58d0
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Only\sopen\sa\sread-only\sconnection\sto\sshared-memory\sif\sthe\s"readonly_shm=1"\soption\sis\sspecified\sas\spart\sof\sthe\sdatabase\sfile\sURI\s(and\sif\sa\sread-write\sconnection\sfails).
|
||||
D 2011-05-11T14:57:33.029
|
||||
C Merge\slatest\strunk\schanges.\sAdd\sa\scouple\sof\sreadonly\sshm\stests.
|
||||
D 2011-05-11T15:53:16.929
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -144,7 +144,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
|
||||
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
||||
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
|
||||
F src/loadext.c 3ae0d52da013a6326310655be6473fd472347b85
|
||||
F src/main.c 167fb3285720917e4d1a5c633f558c81b751eca3
|
||||
F src/main.c 951a1af49d13083da09be9d2464052e49fc25830
|
||||
F src/malloc.c 591aedb20ae40813f1045f2ef253438a334775d9
|
||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||
F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206
|
||||
@ -179,7 +179,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
|
||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||
F src/select.c d9d440809025a58547e39f4f268c2a296bfb56ff
|
||||
F src/shell.c 72e7e176bf46d5c6518d15ac4ad6847c4bb5df79
|
||||
F src/sqlite.h.in e7bbcb330ced6b5e25c9db8089c2c77aaefadf7d
|
||||
F src/sqlite.h.in 059514ec27c8f9e11c73695aa57e55d354973e1e
|
||||
F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
|
||||
F src/sqliteInt.h 798fb09648cefc159ac9b3ce5e00f5ada1377ed1
|
||||
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
|
||||
@ -379,7 +379,7 @@ F test/e_resolve.test dcce9308fb13b934ce29591105d031d3e14fbba6
|
||||
F test/e_select.test bf385ae3aa0f014c4933ae66fd3e1302138493eb
|
||||
F test/e_select2.test 5c3d3da19c7b3e90ae444579db2b70098599ab92
|
||||
F test/e_update.test 963d6876064e65f318d1c93aaed36a02b9b389bf
|
||||
F test/e_uri.test dc9e8f06e44030904e6448c995386f325365713a
|
||||
F test/e_uri.test 9ce11319fb9b271bf7392027f913f7830e93e7a7
|
||||
F test/e_vacuum.test 6c09c2af7f2f140518f371c5342100118f779dcf
|
||||
F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea
|
||||
F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
|
||||
@ -841,7 +841,7 @@ F test/unique.test 083c7fff74695bcc27a71d75699deba3595bc9c2
|
||||
F test/unixexcl.test 9d80a54d86d2261f660758928959368ffc36151e
|
||||
F test/unordered.test e81169ce2a8f31b2c6b66af691887e1376ab3ced
|
||||
F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172
|
||||
F test/uri.test e8579b07985b8f4f658eb4e077962a9b2b7b6491
|
||||
F test/uri.test 2d08a6f77bf93ca925743a65802c4aa23aaaf373
|
||||
F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae
|
||||
F test/vacuum.test 29b60e8cc9e573b39676df6c4a75fe9e02d04a09
|
||||
F test/vacuum2.test 91a84c9b08adfc4472097d2e8deb0150214e0e76
|
||||
@ -883,7 +883,7 @@ F test/walfault.test 58fce626359c9376fe35101b5c0f2df8040aa839
|
||||
F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
|
||||
F test/walmode.test 22ddccd073c817ac9ead62b88ac446e8dedc7d2c
|
||||
F test/walnoshm.test a074428046408f4eb5c6a00e09df8cc97ff93317
|
||||
F test/walro.test c204f62fb6a77839bc6ce5adbdcc9df2aac877ca
|
||||
F test/walro.test 1f15853383a976ff8bbec78dd44bc15c4e237392
|
||||
F test/walshared.test 6dda2293880c300baf5d791c307f653094585761
|
||||
F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933
|
||||
F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c
|
||||
@ -936,7 +936,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P bb59f9862da45d25fb51d7821130854828c91c98
|
||||
R 04ad06f1f1eb20213db6e513d8bb75aa
|
||||
P 671ba5fc59f7a958e5a4138d2425b1173a442ad7 3e490915301216e242a5cdeb0febaff12ed53cb9
|
||||
R 1feba9025b47c541dc5cefaffc74e97e
|
||||
U dan
|
||||
Z 112f0ce43ba9dc957c26d5146ee2fe50
|
||||
Z af31082504210cb42f7a67f58917a8ef
|
||||
|
@ -1 +1 @@
|
||||
671ba5fc59f7a958e5a4138d2425b1173a442ad7
|
||||
cde45a033ee6834900f5f5c272c383408883a74c
|
@ -2171,6 +2171,7 @@ static int openDatabase(
|
||||
nocaseCollatingFunc, 0);
|
||||
|
||||
/* Parse the filename/URI argument. */
|
||||
db->openFlags = flags;
|
||||
rc = sqlite3ParseUri(
|
||||
zVfs, zFilename, &flags, &btflags, &db->pVfs, &zOpen, &zErrMsg);
|
||||
if( rc!=SQLITE_OK ){
|
||||
@ -2181,7 +2182,6 @@ static int openDatabase(
|
||||
}
|
||||
|
||||
/* Open the backend database driver */
|
||||
db->openFlags = flags;
|
||||
rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, btflags,
|
||||
flags | SQLITE_OPEN_MAIN_DB);
|
||||
if( rc!=SQLITE_OK ){
|
||||
|
@ -762,6 +762,7 @@ typedef struct sqlite3_mutex sqlite3_mutex;
|
||||
|
||||
/*
|
||||
** CAPI3REF: OS Interface Object
|
||||
** KEYWORDS: VFS VFSes
|
||||
**
|
||||
** An instance of the sqlite3_vfs object defines the interface between
|
||||
** the SQLite core and the underlying operating system. The "vfs"
|
||||
|
@ -319,12 +319,12 @@ foreach {tn uri flags error} {
|
||||
2 {file:test.db?mode=ro} rw {not an error}
|
||||
3 {file:test.db?mode=ro} rwc {not an error}
|
||||
|
||||
4 {file:test.db?mode=rw} ro {access permission denied}
|
||||
4 {file:test.db?mode=rw} ro {access mode not allowed: rw}
|
||||
5 {file:test.db?mode=rw} rw {not an error}
|
||||
6 {file:test.db?mode=rw} rwc {not an error}
|
||||
|
||||
7 {file:test.db?mode=rwc} ro {access permission denied}
|
||||
8 {file:test.db?mode=rwc} rw {access permission denied}
|
||||
7 {file:test.db?mode=rwc} ro {access mode not allowed: rwc}
|
||||
8 {file:test.db?mode=rwc} rw {access mode not allowed: rwc}
|
||||
9 {file:test.db?mode=rwc} rwc {not an error}
|
||||
} {
|
||||
set f(ro) [list SQLITE_OPEN_READONLY SQLITE_OPEN_URI]
|
||||
|
@ -21,6 +21,7 @@ source $testdir/tester.tcl
|
||||
# 4.*: Tests for specifying other options (other than "vfs").
|
||||
# 5.*: Test using a different VFS with an attached database.
|
||||
# 6.*: Test that authorities other than "" and localhost cause errors.
|
||||
# 7.*: Test that a read-write db can be attached to a read-only connection.
|
||||
#
|
||||
|
||||
set testprefix uri
|
||||
@ -157,7 +158,7 @@ foreach {tn mode create_ok write_ok readonly_ok} {
|
||||
} $A($write_ok)
|
||||
|
||||
set A(1) {0 {}}
|
||||
set A(0) {1 {access permission denied}}
|
||||
set A(0) [list 1 "access mode not allowed: $mode"]
|
||||
do_test 4.1.$tn.3 {
|
||||
list [catch {sqlite3 db "file:test.db?mode=$mode" -readonly 1} msg] $msg
|
||||
} $A($readonly_ok)
|
||||
@ -282,5 +283,27 @@ foreach {tn uri res} {
|
||||
catch { sqlite3_close $DB }
|
||||
}
|
||||
|
||||
finish_test
|
||||
forcedelete test.db test.db2
|
||||
do_test 7.1 {
|
||||
sqlite3 db test.db
|
||||
execsql {
|
||||
CREATE TABLE t1(a, b);
|
||||
INSERT INTO t1 VALUES(1, 2);
|
||||
ATTACH 'test.db2' AS aux;
|
||||
CREATE TABLE aux.t2(a, b);
|
||||
INSERT INTO t1 VALUES('a', 'b');
|
||||
}
|
||||
db close
|
||||
} {}
|
||||
do_test 7.2 {
|
||||
sqlite3 db file:test.db?mode=ro
|
||||
execsql { ATTACH 'file:test.db2?mode=rw' AS aux }
|
||||
} {}
|
||||
do_execsql_test 7.3 {
|
||||
INSERT INTO t2 VALUES('c', 'd')
|
||||
} {}
|
||||
do_catchsql_test 7.4 {
|
||||
INSERT INTO t1 VALUES(3, 4)
|
||||
} {1 {attempt to write a readonly database}}
|
||||
|
||||
finish_test
|
||||
|
@ -123,6 +123,37 @@ do_multiclient_test tn {
|
||||
set {} {}
|
||||
} {}
|
||||
do_test 1.2.8 { sql1 "SELECT * FROM t1" } {a b c d e f g h i j k l}
|
||||
|
||||
# Now check that if the readonly_shm option is not supplied, or if it
|
||||
# is set to zero, it is not possible to connect to the database without
|
||||
# read-write access to the shm.
|
||||
do_test 1.3.1 {
|
||||
code1 { db close }
|
||||
code1 { sqlite3 db test.db }
|
||||
csql1 { SELECT * FROM t1 }
|
||||
} {1 {unable to open database file}}
|
||||
|
||||
# Also test that if the -shm file can be opened for read/write access,
|
||||
# it is, even if readonly_shm=1 is present in the URI.
|
||||
do_test 1.3.2.1 {
|
||||
code1 { db close }
|
||||
code2 { db2 close }
|
||||
file exists test.db-shm
|
||||
} {0}
|
||||
do_test 1.3.2.2 {
|
||||
code1 { sqlite3 db file:test.db?readonly_shm=1 }
|
||||
sql1 { SELECT * FROM t1 }
|
||||
} {a b c d e f g h i j k l}
|
||||
do_test 1.3.2.3 {
|
||||
code1 { db close }
|
||||
close [open test.db-shm w]
|
||||
file attributes test.db-shm -permissions r--r--r--
|
||||
code1 { sqlite3 db file:test.db?readonly_shm=1 }
|
||||
csql1 { SELECT * FROM t1 }
|
||||
} {1 {attempt to write a readonly database}}
|
||||
do_test 1.3.2.4 {
|
||||
code1 { sqlite3_extended_errcode db }
|
||||
} {SQLITE_READONLY_RECOVERY}
|
||||
}
|
||||
|
||||
finish_test
|
||||
|
Loading…
x
Reference in New Issue
Block a user