From: dan Date: Fri, 6 May 2011 18:34:54 +0000 (+0000) Subject: Update comments and documentation associated with new URI parsing code. Add test... X-Git-Tag: version-3.7.7~129^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=286ab7c2b11cca77c83b68760a6c03d256e71b15;p=thirdparty%2Fsqlite.git Update comments and documentation associated with new URI parsing code. Add test file e_uri.test, containing tests mapped to documentation regarding URI filenames. FossilOrigin-Name: 92751788eae082e3104838cb6dd8b9793cb325d1 --- diff --git a/manifest b/manifest index b62b84089c..e5d13928ae 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Have\sthe\sxFullpath\smethod\sin\sos_win.c\sdiscard\sthe\sinitial\s"/"\sif\sa\sfilename\sbegins\swith\s"/X:",\swhere\sX\sis\sany\salphabetic\scharacter.\sAlso\sfix\ssome\stest\sissues\sin\suri.test. -D 2011-05-05T18:53:48.721 +C Update\scomments\sand\sdocumentation\sassociated\swith\snew\sURI\sparsing\scode.\sAdd\stest\sfile\se_uri.test,\scontaining\stests\smapped\sto\sdocumentation\sregarding\sURI\sfilenames. +D 2011-05-06T18:34:54.463 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 872493d84fed9b9c910e1b7b2427a3e28dbe995a +F src/main.c 145f04d5d8a6a391093b8e6a3b37511ac79e05c3 F src/malloc.c 74c740e8ba22b806cfb980c8c0ddea1cbd54a20e F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 00bd8265c81abb665c48fea1e0c234eb3b922206 @@ -179,14 +179,14 @@ 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 f865bde9a0af4cd77b85265df71a9d760e5def18 +F src/sqlite.h.in 6acf3863a9ac8cd613029ff4d477519406632d78 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 F src/sqliteInt.h 5a7bf51f767fb67b484f09d73cccff683731af22 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c 501c9a200fd998a268be475be5858febc90b725b -F src/test1.c e0e4af306b678da05334c2ccaf0377ae8f06e911 +F src/test1.c f506164085bc4cbbb4b5c14b9c6de153f1aeafc5 F src/test2.c 80d323d11e909cf0eb1b6fbb4ac22276483bcf31 F src/test3.c 124ff9735fb6bb7d41de180d6bac90e7b1509432 F src/test4.c d1e5a5e904d4b444cf572391fdcb017638e36ff7 @@ -379,6 +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 26c3ba638e38b9a92272174564df41e7c48e25a1 F test/e_vacuum.test 6c09c2af7f2f140518f371c5342100118f779dcf F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398 @@ -840,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 f21a5cd025ccedf0c6d4c5e365bb47e163098c04 +F test/uri.test e8579b07985b8f4f658eb4e077962a9b2b7b6491 F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae F test/vacuum.test 29b60e8cc9e573b39676df6c4a75fe9e02d04a09 F test/vacuum2.test 91a84c9b08adfc4472097d2e8deb0150214e0e76 @@ -934,7 +935,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P ea562d6d67c2f2ef8baca02a77634c21b945196f -R ab4f619c8bbf9faf6cdcf553d75032d8 +P fe57a8f621944fd2af5a4e9349c8fd77c4aba237 +R 3f5b227194b2ccadbce712d322c27966 U dan -Z d81fc059a3e07abc471a058222e61ec9 +Z 5f09c493780289f14c0820ca02b5d7dc diff --git a/manifest.uuid b/manifest.uuid index 1014b9c417..4ea86418d5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fe57a8f621944fd2af5a4e9349c8fd77c4aba237 \ No newline at end of file +92751788eae082e3104838cb6dd8b9793cb325d1 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 9021b8514b..bcfd2deb04 100644 --- a/src/main.c +++ b/src/main.c @@ -1791,9 +1791,28 @@ int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){ } /* -** This function is used to parse URIs passed by the user to API functions -** sqlite3_open() or sqlite3_open_v2(), and for database URIs specified as -** part of ATTACH statements. +** 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. +** +** 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 */ @@ -1819,8 +1838,12 @@ int sqlite3ParseUri( int iIn; /* Input character index */ int iOut = 0; /* Output character index */ int nByte = nUri+2; /* Bytes of space to allocate */ - for(iIn=0; iIn mode: ^(This option may be set to either "ro", "rw" or "rwc". -** Attempting to set it to any other value is an error)^. ^If "ro" is -** specified, then the database is opened for read-only access, just as if -** the [SQLITE_OPEN_READONLY] flag had been set in the third argument to -** sqlite3_prepare_v2(). ^If the mode option is set to "rw", then the -** database is opened for read-write (but not create) access, as if -** SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had been set. -** ^Value "rwc" is equivalent to setting both SQLITE_OPEN_READWRITE and -** SQLITE_OPEN_CREATE. -** ^If sqlite3_open_v2() is used, it is an error to specify a value for -** the mode parameter that is less restrictive than that specified by the -** flags passed as the third parameter. +** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is +** present, then the VFS specified by the option takes precedence over +** the value passed as the fourth parameter to sqlite3_open_v2(). +** +**
  • mode: ^(The mode parameter may be set to either "ro", "rw" or +** "rwc". Attempting to set it to any other value is an error)^. +** ^If "ro" is specified, then the database is opened for read-only +** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the +** third argument to sqlite3_prepare_v2(). ^If the mode option is set to +** "rw", then the database is opened for read-write (but not create) +** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had +** been set. ^Value "rwc" is equivalent to setting both +** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If sqlite3_open_v2() is +** used, it is an error to specify a value for the mode parameter that is +** less restrictive than that specified by the flags passed as the third +** parameter. ** **
  • cache: ^The cache parameter may be set to either "shared" or ** "private". ^Setting it to "shared" is equivalent to setting the @@ -2487,10 +2487,8 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** ** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db ** Windows only: Open the file "data.db" on fred's desktop on drive -** C:. If the "C:/" component were omitted from this URI, then the -** file "\Documents and Settings\fred\Desktop\data.db" would be opened -** on the current drive. Note that the %20 escaping in this example -** is not strictly necessary - space characters can be used literally +** C:. Note that the %20 escaping in this example is not strictly +** necessary - space characters can be used literally ** in URI filenames. ** file:data.db?mode=ro&cache=private ** Open file "data.db" in the current directory for read-only access. diff --git a/src/test1.c b/src/test1.c index b79bbd0826..8e30123433 100644 --- a/src/test1.c +++ b/src/test1.c @@ -3845,6 +3845,76 @@ static int test_open( return TCL_OK; } +/* +** Usage: sqlite3_open_v2 FILENAME FLAGS VFS +*/ +static int test_open_v2( + void * clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + const char *zFilename; + const char *zVfs; + int flags = 0; + sqlite3 *db; + int rc; + char zBuf[100]; + + int nFlag; + Tcl_Obj **apFlag; + int i; + + if( objc!=4 ){ + Tcl_WrongNumArgs(interp, 1, objv, "FILENAME FLAGS VFS"); + return TCL_ERROR; + } + zFilename = Tcl_GetString(objv[1]); + zVfs = Tcl_GetString(objv[3]); + if( zVfs[0]==0x00 ) zVfs = 0; + + rc = Tcl_ListObjGetElements(interp, objv[2], &nFlag, &apFlag); + if( rc!=TCL_OK ) return rc; + for(i=0; i