- C Merge\sthe\slatest\strunk\schanges\sinto\sthe\sapple-osx\sbranch.
- D 2011-05-05T15:52:46.864
-C Add\smissing\scomments\sassociated\swith\sreadonly\sshm\schanges.
-D 2011-05-11T17:36:17.276
++C Pull\sin\sthe\spatches\sto\ssupport\sread-only\sWAL\sdatabases\sinto\sa\snew\sbranch\noff\sof\sthe\sapple-osx\sbranch.\s\sThis\salso\spulls\sin\sall\sthe\sother\spending\n3.7.7\schanges\ssuch\sas\sURI\ssupport.
++D 2011-05-12T15:32:51.588
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
-F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
+F Makefile.in 46b5d5017359f89b1aa89ca3581d6ec577738d96
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F Makefile.vxworks c85ec1d8597fe2f7bc225af12ac1666e21379151
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F src/expr.c e3cf0957c6b8faaaf7386a3bc69e53c0dc9705be
F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
F src/fkey.c a43ba8a005fb5efd1deeee06853e3a6120d46a91
-F src/func.c b9117e40975245b8504cf3625d7e321d8d4b63dc
+F src/func.c c02fda657f2366c493198c3e480695fc69972c5f
- F src/global.c 02335177cf6946fe5525c6f0755cf181140debf3
+ F src/global.c 29bfb85611dd816b04f10fba0ca910366e128d38
F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
F src/insert.c 3eea5a53d2644116fb865afaa4699fabe62b441c
F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
-F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
+F src/legacy.c 015826a958f690302d27e096a68d50b3657e4201
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
F src/loadext.c 3ae0d52da013a6326310655be6473fd472347b85
- F src/main.c 3f1e9329c1e689375adf143d4303077d4c14aade
- F src/malloc.c 74c740e8ba22b806cfb980c8c0ddea1cbd54a20e
-F src/main.c a145cea130adfe945ab1fa7e9543c492e3f2f419
++F src/main.c f50e8d60c6ee3c5c1d450e922edb0b1981b76ae8
+ F src/malloc.c 591aedb20ae40813f1045f2ef253438a334775d9
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
-F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206
+F src/mem1.c 46095d62b241466ef51970e592aa3a7a87e443e1
F src/mem2.c e307323e86b5da1853d7111b68fd6b84ad6f09cf
F src/mem3.c 9b237d911ba9904142a804be727cc6664873f8a3
F src/mem5.c c2c63b7067570b00bf33d751c39af24182316f7f
F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
- F src/os_unix.c b206f9d56b6e3021f195914b63f394d28f23e1cd
- F src/os_win.c 4271f0bf733c0b45635ddcfb41c935573de8284c
- F src/pager.c 055239dcdfe12b3f5d97f6f01f85da01e2d6d912
- F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
-F src/os_unix.c 03630dd062c3d1fb9f25e2a227048b709c5babff
++F src/os_unix.c dabbe23efc9de8fb30caad63f73c88e10ab0499e
+ F src/os_win.c ff0e14615a5086fa5ba6926e4ec0dc9cfb5a1a84
+ F src/pager.c 4056376f83f85cea9922a11161087c529e39f7dc
+ F src/pager.h 34c6b029446f06f40847746d22faac0d354dd909
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
F src/pcache.c 09d38c44ab275db581f7a2f6ff8b9bc7f8c0faaa
F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
F src/select.c d9d440809025a58547e39f4f268c2a296bfb56ff
F src/shell.c 72e7e176bf46d5c6518d15ac4ad6847c4bb5df79
- F src/sqlite.h.in 9bf19a5dcf6317b0f091c255edaed0b1fc01dcd0
+ F src/sqlite.h.in adeb2c8019a3851a10e3872f44b34c95c6e409f2
+F src/sqlite3_private.h 2a814d17913732831acf13e7e87860105a3416e4
F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
- F src/sqliteInt.h e70a03bb66d209e279b3edeb57d4fdc42a1d9fda
+ F src/sqliteInt.h 798fb09648cefc159ac9b3ce5e00f5ada1377ed1
F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d
F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf
F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e
F src/tclsqlite.c 501c9a200fd998a268be475be5858febc90b725b
- F src/test1.c 89bc831e1d3ecae3d17eac49e9f59e5f84f6f66b
-F src/test1.c 6ae026cd9d2b1b1e95a372a7460d091705db645d
++F src/test1.c 77ea7bcaab8656e28acee1cb4e327dd730476fcb
F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31
- F src/test3.c 056093cfef69ff4227a6bdb9108564dc7f45e4bc
+ F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432
F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7
F src/test5.c e1a19845625144caf038031234a12185e40d315c
F src/test6.c c7256cc21d2409486d094277d5b017e8eced44ba
F src/trigger.c 144cc18bb701f3286484aae4292a9531f09278c8
F src/update.c 5bcb56e5c7380a2eecb0e71891dbd4ad7437748f
F src/utf.c d83650c3ea08f7407bd9d0839d9885241c209c60
- F src/util.c 465fe10aabf0ca7d7826a156dab919b0b65c525a
+ F src/util.c 914e860d21496b19a912cd14f6f7a889a22f44e1
F src/vacuum.c 05513dca036a1e7848fe18d5ed1265ac0b32365e
- F src/vdbe.c bf969a63096ebf3209963ddf76e085f5465a7dae
-F src/vdbe.c b2070c926a896e59234e27412a45e261fe752235
++F src/vdbe.c ed2668549331d523812ca4b3b6755299d1eb4c43
F src/vdbe.h 8a675fefdf7119441fe817c800a9a52440c2e797
F src/vdbeInt.h fe8f58d305e629fff02f61f655aca1d299f1f6ae
-F src/vdbeapi.c e0e2672e0a96ae3f8575c8ecd02912a3e8a554a1
+F src/vdbeapi.c 34b6686d9079264bc715f63e41bc2f0d9b98de89
F src/vdbeaux.c 25aa5ba7d46b4fe7c8f33dc132d474242d5f9726
F src/vdbeblob.c c3ccb7c8732858c680f442932e66ad06bb036562
F src/vdbemem.c 0498796b6ffbe45e32960d6a1f5adfb6e419883b
F test/exclusive2.test 343d55130c12c67b8bf10407acec043a6c26c86b
F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
F test/exists.test 5e2d64b4eb5a9d08876599bdae2e1213d2d12e2a
- F test/expr.test 19e8ac40313e2282a47b586d11c4892040990d3a
+ F test/expr.test 67c9fd6f8f829e239dc8b0f4a08a73c08b09196d
-F test/fallocate.test 43dc34b8c24be6baffadc3b4401ee15710ce83c6
+F test/fallocate.test a9927b638567e2e776c112f54d701402a0e74023
F test/filectrl.test 97003734290887566e01dded09dc9e99cb937e9e
F test/filefmt.test f178cfc29501a14565954c961b226e61877dd32c
F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
F test/lock4.test c82268c031d39345d05efa672f80b025481b3ae5
-F test/lock5.test b2abb5e711bc59b0eae00f6c97a36ec9f458fada
-F test/lock6.test ad5b387a3a8096afd3c68a55b9535056431b0cf5
+F test/lock5.test d0d313f059ae5661726d3f197ba6ed8f69257d8e
+F test/lock6.test 83434ae8ca1d1c5e2eaf74d4e44aa24ab62b291c
F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64
- F test/lock_common.tcl d279887a0ab16cdb6d935c1203e64113c5a000e9
+ F test/lock_common.tcl 0c270b121d40959fa2f3add382200c27045b3d95
+F test/lock_proxy.test 95be9c32d79be25cf643b4e41a0aa0e53aa21621
F test/lookaside.test 93f07bac140c5bb1d49f3892d2684decafdc7af2
-F test/main.test 9d7bbfcc1b52c88ba7b2ba6554068ecf9939f252
+F test/main.test 753e2b772c041bd8dbd17c7e4132b3981378eaab
F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
F test/malloc.test e56c9c3358da2c18385aea15a42dc970913986c2
F test/malloc3.test 4128b1e6ffa506103b278ad97af89174f310c7ca
F test/null.test a8b09b8ed87852742343b33441a9240022108993
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
F test/oserror.test 498d8337e9d15543eb7b004fef8594bf204ff43c
- F test/pager1.test d8672fd0af5f4f9b99b06283d00f01547809bebe
+ F test/pager1.test 8baf4470b29511503abcaf1f17d16b16462e4d54
F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
-F test/pagerfault.test 9de4d3e0c59970b4c6cb8dac511fa242f335d8a7
+F test/pagerfault.test bea066b9162e1ab6843c2c1524ebb0965715e956
F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401
F test/pagerfault3.test f16e2efcb5fc9996d1356f7cbc44c998318ae1d7
F test/pageropt.test 8146bf448cf09e87bb1867c2217b921fb5857806
F test/table.test 04ba066432430657712d167ebf28080fe878d305
F test/tableapi.test 2674633fa95d80da917571ebdd759a14d9819126
F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3
-F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c
+F test/tempdb.test 3263e5c3f0604e54d307481e8587327c54544d18
F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a
F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05
- F test/tester.tcl 7fb83d5dd1eff130a0a020d1746f1ccd723c414b
-F test/tester.tcl a791ee74cb6b8f8613079ccc018bf2c8b952a26c
++F test/tester.tcl 51d761878d9934e19fc0eda3c9c5dbc39d02522d
F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
F test/wal5.test 1bbfaa316dc2a1d0d1fac3f4500c38a90055a41b
F test/wal6.test 07aa31ca8892d0527f2c5c5a9a2a87aa421dfaa8
F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
-F test/walbak.test 4df1c7369da0301caeb9a48fa45997fd592380e4
-F test/walbig.test e882bc1d014afffbfa2b6ba36e0f07d30a633ad0
-F test/walcksum.test a37b36375c595e61bdb7e1ec49b5f0979b6fc7ce
-F test/walcrash.test e763841551d6b23677ccb419797c1589dcbdbaf5
-F test/walcrash2.test 019d60b89d96c1937adb2b30b850ac7e86e5a142
-F test/walfault.test 58fce626359c9376fe35101b5c0f2df8040aa839
-F test/walhook.test ed00a40ba7255da22d6b66433ab61fab16a63483
-F test/walmode.test 22ddccd073c817ac9ead62b88ac446e8dedc7d2c
+F test/walbak.test 767e1c9e0ea0cfb907873b332883e66e187fa4bc
+F test/walbig.test 78ac493db2abdb65b9c6cace5b851cc32df1d449
+F test/walcksum.test cf6787f2ee1a6a3da6f0c2b20b9ede5153e4e03f
+F test/walcrash.test 80c1cc3173a0ef09d8303fa556cb0187a36d82ea
+F test/walcrash2.test 929c99d14ee2e3e3ef82585058968a8b12f72706
+F test/walfault.test 7db81f3dac64ce8897196f199c2909078bcabf8d
+F test/walhook.test c934ac5219fee2b4e7653d291db9107b8dc73bba
+F test/walmode.test feb39956ec6f415fbb9dcb12d91243391c2c4715
F test/walnoshm.test a074428046408f4eb5c6a00e09df8cc97ff93317
-F test/walshared.test 6dda2293880c300baf5d791c307f653094585761
-F test/walslow.test d21625e2e99e11c032ce949e8a94661576548933
-F test/walthread.test a25a393c068a2b42b44333fa3fdaae9072f1617c
+ F test/walro.test 1f15853383a976ff8bbec78dd44bc15c4e237392
+F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417
+F test/walslow.test 989854bc5c214700a9f2d545bb158643813b8881
+F test/walthread.test e6e32e93ccebfa401dfc0dd930c79daa3472b0ae
F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
F test/where2.test 43d4becaf5a5df854e6c21d624a1cb84c6904554
F test/where3.test 8e1175c7ef710c70502858fc4fb08d784b3620b9
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
- P 289194d68e891e4977407d07e452e48844777a36 930be6a1bdec8c150caafd790973f7a401fc1970
- R f9953bf7534b463a52ab1fb53587971d
-P cde45a033ee6834900f5f5c272c383408883a74c
-R 77f3671cb0a1ec2771484489a2a100be
-U dan
-Z 826df29e354d14eb64673fd89c39c62e
++P f9b149e53815235aaf92f722e37c4819503d72b3 6a2ea52e6c09a570428161090c2f087c66f714ec
++R b49a9b1444f8fd9af23f810ca3a9099d
++T *bgcolor * #95b28e
++T *branch * apple-wal-readonly
++T *sym-apple-wal-readonly *
++T -sym-apple-osx *
+U drh
- Z 363d2e190ed85f758bd8ad149ca95188
++Z 6c6aea48ffe39f9291f96ce0e3f37ff9
}
return oldLimit; /* IMP: R-53341-35419 */
}
+#if defined(SQLITE_ENABLE_AUTO_PROFILE)
+static void profile_sql(void *aux, const char *sql, u64 ns) {
+#pragma unused(aux)
+ fprintf(stderr, "Query: %s\n Execution Time: %llu ms\n", sql, ns / 1000000);
+}
+#endif
+ /*
+ ** This function is used to parse both URIs and non-URI filenames passed by the
+ ** user to API functions sqlite3_open() or sqlite3_open_v2(), and for database
+ ** URIs specified as part of ATTACH statements.
+ **
+ ** The first argument to this function is the name of the VFS to use (or
+ ** a NULL to signify the default VFS) if the URI does not contain a "vfs=xxx"
+ ** query parameter. The second argument contains the URI (or non-URI filename)
+ ** itself. When this function is called the *pFlags variable should contain
+ ** the default flags to open the database handle with. The value stored in
+ ** *pFlags may be updated before returning if the URI filename contains
+ ** "cache=xxx" or "mode=xxx" query parameters.
+ **
+ ** The third argument, pBtflags, points to an integer containing the flags
+ ** that will be passed as the 5th argument to sqlite3BtreeOpen (BTREE_XXX
+ ** flags). This value will be edited if the URI filename contains a
+ ** "readonly_shm=1" or "readonly_shm=0" query parameter.
+ **
+ ** If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to
+ ** the VFS that should be used to open the database file. *pzFile is set to
+ ** point to a buffer containing the name of the file to open. It is the
+ ** responsibility of the caller to eventually call sqlite3_free() to release
+ ** this buffer.
+ **
+ ** If an error occurs, then an SQLite error code is returned and *pzErrMsg
+ ** may be set to point to a buffer containing an English language error
+ ** message. It is the responsibility of the caller to eventually release
+ ** this buffer by calling sqlite3_free().
+ */
+ int sqlite3ParseUri(
+ const char *zDefaultVfs, /* VFS to use if no "vfs=xxx" query option */
+ const char *zUri, /* Nul-terminated URI to parse */
+ unsigned int *pFlags, /* IN/OUT: SQLITE_OPEN_XXX flags */
+ int *pBtflags, /* IN/OUT: BTREE_XXX flags */
+ sqlite3_vfs **ppVfs, /* OUT: VFS to use */
+ char **pzFile, /* OUT: Filename component of URI */
+ char **pzErrMsg /* OUT: Error message (if rc!=SQLITE_OK) */
+ ){
+ int rc = SQLITE_OK;
+ unsigned int flags = *pFlags;
+ const char *zVfs = zDefaultVfs;
+ char *zFile;
+ char c;
+ int nUri = sqlite3Strlen30(zUri);
+
+ assert( *pzErrMsg==0 );
+
+ if( ((flags & SQLITE_OPEN_URI) || sqlite3GlobalConfig.bOpenUri)
+ && nUri>=5 && memcmp(zUri, "file:", 5)==0
+ ){
+ char *zOpt;
+ int eState; /* Parser state when parsing URI */
+ int iIn; /* Input character index */
+ int iOut = 0; /* Output character index */
+ int nByte = nUri+2; /* Bytes of space to allocate */
+
+ /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen
+ ** method that there may be extra parameters following the file-name. */
+ flags |= SQLITE_OPEN_URI;
+
+ for(iIn=0; iIn<nUri; iIn++) nByte += (zUri[iIn]=='&');
+ zFile = sqlite3_malloc(nByte);
+ if( !zFile ) return SQLITE_NOMEM;
+
+ /* Discard the scheme and authority segments of the URI. */
+ if( zUri[5]=='/' && zUri[6]=='/' ){
+ iIn = 7;
+ while( zUri[iIn] && zUri[iIn]!='/' ) iIn++;
+
+ if( iIn!=7 && (iIn!=16 || memcmp("localhost", &zUri[7], 9)) ){
+ *pzErrMsg = sqlite3_mprintf("invalid uri authority: %.*s",
+ iIn-7, &zUri[7]);
+ rc = SQLITE_ERROR;
+ goto parse_uri_out;
+ }
+ }else{
+ iIn = 5;
+ }
+
+ /* Copy the filename and any query parameters into the zFile buffer.
+ ** Decode %HH escape codes along the way.
+ **
+ ** Within this loop, variable eState may be set to 0, 1 or 2, depending
+ ** on the parsing context. As follows:
+ **
+ ** 0: Parsing file-name.
+ ** 1: Parsing name section of a name=value query parameter.
+ ** 2: Parsing value section of a name=value query parameter.
+ */
+ eState = 0;
+ while( (c = zUri[iIn])!=0 && c!='#' ){
+ iIn++;
+ if( c=='%'
+ && sqlite3Isxdigit(zUri[iIn])
+ && sqlite3Isxdigit(zUri[iIn+1])
+ ){
+ int octet = (sqlite3HexToInt(zUri[iIn++]) << 4);
+ octet += sqlite3HexToInt(zUri[iIn++]);
+
+ assert( octet>=0 && octet<256 );
+ if( octet==0 ){
+ /* This branch is taken when "%00" appears within the URI. In this
+ ** case we ignore all text in the remainder of the path, name or
+ ** value currently being parsed. So ignore the current character
+ ** and skip to the next "?", "=" or "&", as appropriate. */
+ while( (c = zUri[iIn])!=0 && c!='#'
+ && (eState!=0 || c!='?')
+ && (eState!=1 || (c!='=' && c!='&'))
+ && (eState!=2 || c!='&')
+ ){
+ iIn++;
+ }
+ continue;
+ }
+ c = octet;
+ }else if( eState==1 && (c=='&' || c=='=') ){
+ if( zFile[iOut-1]==0 ){
+ /* An empty option name. Ignore this option altogether. */
+ while( zUri[iIn] && zUri[iIn]!='#' && zUri[iIn-1]!='&' ) iIn++;
+ continue;
+ }
+ if( c=='&' ){
+ zFile[iOut++] = '\0';
+ }else{
+ eState = 2;
+ }
+ c = 0;
+ }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){
+ c = 0;
+ eState = 1;
+ }
+ zFile[iOut++] = c;
+ }
+ if( eState==1 ) zFile[iOut++] = '\0';
+ zFile[iOut++] = '\0';
+ zFile[iOut++] = '\0';
+
+ /* Check if there were any options specified that should be interpreted
+ ** here. Options that are interpreted here include "vfs" and those that
+ ** correspond to flags that may be passed to the sqlite3_open_v2()
+ ** method. */
+ zOpt = &zFile[sqlite3Strlen30(zFile)+1];
+ while( zOpt[0] ){
+ int nOpt = sqlite3Strlen30(zOpt);
+ char *zVal = &zOpt[nOpt+1];
+ int nVal = sqlite3Strlen30(zVal);
+
+ if( nOpt==3 && memcmp("vfs", zOpt, 3)==0 ){
+ zVfs = zVal;
+ }else if( nOpt==12 && memcmp("readonly_shm", zOpt, 12)==0 ){
+ if( sqlite3Atoi(zVal) ){
+ *pBtflags |= BTREE_READONLYSHM;
+ }else{
+ *pBtflags &= ~BTREE_READONLYSHM;
+ }
+ }else{
+ struct OpenMode {
+ const char *z;
+ int mode;
+ } *aMode = 0;
+ char *zModeType;
+ int mask;
+ int limit;
+
+ if( nOpt==5 && memcmp("cache", zOpt, 5)==0 ){
+ static struct OpenMode aCacheMode[] = {
+ { "shared", SQLITE_OPEN_SHAREDCACHE },
+ { "private", SQLITE_OPEN_PRIVATECACHE },
+ { 0, 0 }
+ };
+
+ mask = SQLITE_OPEN_SHAREDCACHE|SQLITE_OPEN_PRIVATECACHE;
+ aMode = aCacheMode;
+ limit = mask;
+ zModeType = "cache";
+ }
+ if( nOpt==4 && memcmp("mode", zOpt, 4)==0 ){
+ static struct OpenMode aOpenMode[] = {
+ { "ro", SQLITE_OPEN_READONLY },
+ { "rw", SQLITE_OPEN_READWRITE },
+ { "rwc", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE },
+ { 0, 0 }
+ };
+
+ mask = SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE;
+ aMode = aOpenMode;
+ limit = mask & flags;
+ zModeType = "access";
+ }
+
+ if( aMode ){
+ int i;
+ int mode = 0;
+ for(i=0; aMode[i].z; i++){
+ const char *z = aMode[i].z;
+ if( nVal==sqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){
+ mode = aMode[i].mode;
+ break;
+ }
+ }
+ if( mode==0 ){
+ *pzErrMsg = sqlite3_mprintf("no such %s mode: %s", zModeType, zVal);
+ rc = SQLITE_ERROR;
+ goto parse_uri_out;
+ }
+ if( mode>limit ){
+ *pzErrMsg = sqlite3_mprintf("%s mode not allowed: %s",
+ zModeType, zVal);
+ rc = SQLITE_PERM;
+ goto parse_uri_out;
+ }
+ flags = (flags & ~mask) | mode;
+ }
+ }
+
+ zOpt = &zVal[nVal+1];
+ }
+
+ }else{
+ zFile = sqlite3_malloc(nUri+2);
+ if( !zFile ) return SQLITE_NOMEM;
+ memcpy(zFile, zUri, nUri);
+ zFile[nUri] = '\0';
+ zFile[nUri+1] = '\0';
+ }
+
+ *ppVfs = sqlite3_vfs_find(zVfs);
+ if( *ppVfs==0 ){
+ *pzErrMsg = sqlite3_mprintf("no such vfs: %s", zVfs);
+ rc = SQLITE_ERROR;
+ }
+ parse_uri_out:
+ if( rc!=SQLITE_OK ){
+ sqlite3_free(zFile);
+ zFile = 0;
+ }
+ *pFlags = flags;
+ *pzFile = zFile;
+ return rc;
+ }
+
+
/*
** This routine does the work of opening a database on behalf of
** sqlite3_open() and sqlite3_open16(). The database filename "zFilename"