Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Have flags passed to sqlite3_open_v2() apply to the main and any attached databases. And change things so that any "mode=xxx" or "cache=xxx" options specified as part of a URI for the main database do not also apply to attached databases. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3e490915301216e242a5cdeb0febaff1 |
User & Date: | dan 2011-05-10 18:39:10 |
Context
2011-05-11
| ||
19:00 | URI filename documentation updates. check-in: 8885c867 user: drh tags: trunk | |
15:53 | Merge latest trunk changes. Add a couple of readonly shm tests. check-in: cde45a03 user: dan tags: wal-readonly | |
2011-05-10
| ||
18:39 | Have flags passed to sqlite3_open_v2() apply to the main and any attached databases. And change things so that any "mode=xxx" or "cache=xxx" options specified as part of a URI for the main database do not also apply to attached databases. check-in: 3e490915 user: dan tags: trunk | |
17:43 | Update URI test cases to account for the new error message format. check-in: 5bde5680 user: dan tags: trunk | |
Changes
Changes to src/main.c.
2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 |
assert( db->pDfltColl!=0 );
/* Also add a UTF-8 case-insensitive collation sequence. */
createCollation(db, "NOCASE", SQLITE_UTF8, SQLITE_COLL_NOCASE, 0,
nocaseCollatingFunc, 0);
/* Parse the filename/URI argument. */
rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
if( rc!=SQLITE_OK ){
if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;
sqlite3Error(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
sqlite3_free(zErrMsg);
goto opendb_out;
}
/* Open the backend database driver */
db->openFlags = flags;
rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0,
flags | SQLITE_OPEN_MAIN_DB);
if( rc!=SQLITE_OK ){
if( rc==SQLITE_IOERR_NOMEM ){
rc = SQLITE_NOMEM;
}
sqlite3Error(db, rc, 0);
|
> < |
2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 |
assert( db->pDfltColl!=0 );
/* Also add a UTF-8 case-insensitive collation sequence. */
createCollation(db, "NOCASE", SQLITE_UTF8, SQLITE_COLL_NOCASE, 0,
nocaseCollatingFunc, 0);
/* Parse the filename/URI argument. */
db->openFlags = flags;
rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
if( rc!=SQLITE_OK ){
if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;
sqlite3Error(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
sqlite3_free(zErrMsg);
goto opendb_out;
}
/* Open the backend database driver */
rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0,
flags | SQLITE_OPEN_MAIN_DB);
if( rc!=SQLITE_OK ){
if( rc==SQLITE_IOERR_NOMEM ){
rc = SQLITE_NOMEM;
}
sqlite3Error(db, rc, 0);
|
Changes to test/uri.test.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
278
279
280
281
282
283
284
285
286
|
# # 1.*: That file names are correctly extracted from URIs. # 2.*: That URI options (query parameters) are correctly extracted from URIs. # 3.*: That specifying an unknown VFS causes an error. # 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. # set testprefix uri db close sqlite3_shutdown sqlite3_config_uri 1 ................................................................................ do_test 6.$tn { set DB [sqlite3_open $uri] sqlite3_errmsg $DB } $res catch { sqlite3_close $DB } } finish_test |
>
>
|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
...
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
|
# # 1.*: That file names are correctly extracted from URIs. # 2.*: That URI options (query parameters) are correctly extracted from URIs. # 3.*: That specifying an unknown VFS causes an error. # 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 db close sqlite3_shutdown sqlite3_config_uri 1 ................................................................................ do_test 6.$tn { set DB [sqlite3_open $uri] sqlite3_errmsg $DB } $res catch { sqlite3_close $DB } } 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 |