From: dan Date: Thu, 5 May 2011 12:35:33 +0000 (+0000) Subject: Fix a problem in the URI code preventing the amalgamation from building. Add comments... X-Git-Tag: version-3.7.7~129^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=00142d70a933a36289f9f74720d9da44b72b405e;p=thirdparty%2Fsqlite.git Fix a problem in the URI code preventing the amalgamation from building. Add comments describing SQLITE_CONFIG_URI and SQLITE_OPEN_URI to sqlite.h.in. FossilOrigin-Name: ea562d6d67c2f2ef8baca02a77634c21b945196f --- diff --git a/manifest b/manifest index 0ff82c27c9..32e0f8fc68 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\slatest\strunk\schanges\swith\suri\sbranch. -D 2011-05-04T17:35:12.663 +C Fix\sa\sproblem\sin\sthe\sURI\scode\spreventing\sthe\samalgamation\sfrom\sbuilding.\sAdd\scomments\sdescribing\sSQLITE_CONFIG_URI\sand\sSQLITE_OPEN_URI\sto\ssqlite.h.in. +D 2011-05-05T12:35:33.316 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -179,9 +179,9 @@ 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 90b126a4e8515126799e6e2b7f5ba962283e38bd +F src/sqlite.h.in f865bde9a0af4cd77b85265df71a9d760e5def18 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 -F src/sqliteInt.h d1794da98180a15974a5539eec5410187371adda +F src/sqliteInt.h 5a7bf51f767fb67b484f09d73cccff683731af22 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac64842c86cec2fc1a1d0e5c16d3beb8ad332bf F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e @@ -934,7 +934,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 008cd0ef6b504cf4549468f795aa46f8472f0130 8f9666af5f9459cbd0305a86281d745ea6163acf -R 07deaa464fe0e27da6566a9a8b8c931b +P af279f367e01732560b8b2b6aeb5ede4f04415dd +R b650932bbc0e364498f81d36888b653d U dan -Z 357fb32ea4341029d4a78088d4acc043 +Z 505d1fe8270a91e9ebfb3524cd8d9a43 diff --git a/manifest.uuid b/manifest.uuid index 4ff58741bc..9a80005ad0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -af279f367e01732560b8b2b6aeb5ede4f04415dd \ No newline at end of file +ea562d6d67c2f2ef8baca02a77634c21b945196f \ No newline at end of file diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 50c9e1f594..d394d6c819 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -1427,6 +1427,18 @@ struct sqlite3_mem_methods { ** In a multi-threaded application, the application-defined logger ** function must be threadsafe. ** +**
SQLITE_CONFIG_URI +**
This option takes a single argument of type int. If non-zero, then +** URI handling is globally enabled. If the parameter is zero, then URI handling +** is globally disabled. If URI handling is globally enabled, all filenames +** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or +** specified as part of [ATTACH] commands are interpreted as URIs, regardless +** of whether or not the [SQLITE_OPEN_URI] flag is set when the database +** connection is opened. If it is globally disabled, filenames are +** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the +** database connection is opened. By default, URI handling is globally +** disabled. The default value may be changed by compiling with the +** [SQLITE_USE_URI] symbol defined. ** */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ @@ -2322,7 +2334,7 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); /* ** CAPI3REF: Opening A New Database Connection ** -** ^These routines open an SQLite database file whose name is given by the +** ^These routines open an SQLite database file as specified by the ** filename argument. ^The filename argument is interpreted as UTF-8 for ** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte ** order for sqlite3_open16(). ^(A [database connection] handle is usually @@ -2385,6 +2397,11 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not ** participate in [shared cache mode] even if it is enabled. ** +** ^The fourth parameter to sqlite3_open_v2() is the name of the +** [sqlite3_vfs] object that defines the operating system interface that +** the new database connection should use. ^If the fourth parameter is +** a NULL pointer then the default [sqlite3_vfs] object is used. +** ** ^If the filename is ":memory:", then a private, temporary in-memory database ** is created for the connection. ^This in-memory database will vanish when ** the database connection is closed. Future versions of SQLite might @@ -2397,10 +2414,102 @@ void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** on-disk database will be created. ^This private database will be ** automatically deleted as soon as the database connection is closed. ** -** ^The fourth parameter to sqlite3_open_v2() is the name of the -** [sqlite3_vfs] object that defines the operating system interface that -** the new database connection should use. ^If the fourth parameter is -** a NULL pointer then the default [sqlite3_vfs] object is used. +** ^If URI filename interpretation is enabled, and the filename argument +** begins with "file:", then the filename is interpreted as a URI. ^URI +** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is +** is set in the fourth argument to sqlite3_open_v2(), or if it has +** been enabled globally using the [SQLITE_CONFIG_URI] option with the +** [sqlite3_config()] method. +** +** URI filenames are parsed according to RFC 1738. If the URI contains an +** 'authority', then it must be either an empty string or the string +** "localhost". ^If the authority is not an empty string or "localhost", an +** error is returned to the caller. ^The 'fragment' component of a URI, if +** present, is always ignored. +** +** ^SQLite uses the 'path' component of the URI as the path to the database file +** to open. ^If the path begins with a '/' character, then it is interpreted as +** an absolute path. ^If it does not begin with a '/', it is interpreted as a +** relative path. ^On windows, if the first component of an absolute path is +** of the form "X:", where "X" is any alphabetic character, it is interpreted +** as a drive specification. ^Otherwise, the absolute path is interpreted as +** the full pathname of a file on the current drive. +** +** The query component of a URI may contain parameters that are interpreted +** either by SQLite itself, or by a [sqlite3_vfs | custom VFS implementation]. +** SQLite interprets the following three query parameters: +** +** +** +** ^Specifying an unknown parameter in the query component of a URI is not an +** error. +** +** URI filename examples: +** +** +**
URI filenames Results +**
file:data.db +** Open the file "data.db" in the current directory. +**
file:/home/fred/data.db
+** file:///home/fred/data.db
+** file://localhost/home/fred/data.db
+** Open the database file "/home/fred/data.db". +**
file://darkstar/home/fred/data.db +** An error. "darkstar" is not a recognized authority. +**
+** 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 +** in URI filenames. +**
file:data.db?mode=ro&cache=private +** Open file "data.db" in the current directory for read-only access. +** Regardless of whether or not shared-cache mode is enabled by +** default, use a private cache. +**
file:/home/fred/data.db?vfs=unix-nolock +** Open file "/home/fred/data.db". Use the special VFS "unix-nolock". +**
file:data.db?mode=readonly +** An error. "readonly" is not a valid option for the "mode" parameter. +**
+** +** ^URI hexadecimal escape sequences (%HH) are supported within the path and +** query components of a URI. A hexadecimal escape sequence consists of a +** percent sign - "%" - followed by exactly two hexadecimal digits +** specifying an octet value. ^Before the path or query components of a +** URI filename are interpreted, they are encoded using UTF-8 and all +** hexadecimal escape sequences replaced by a single byte containing the +** corresponding octet. If this process generates an invalid UTF-8 encoding, +** the results are undefined. ** ** Note to Windows users: The encoding used for the filename argument ** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever diff --git a/src/sqliteInt.h b/src/sqliteInt.h index f5608c9ef1..8e18b0f399 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2674,6 +2674,7 @@ void sqlite3AddColumnType(Parse*,Token*); void sqlite3AddDefaultValue(Parse*,ExprSpan*); void sqlite3AddCollateType(Parse*, Token*); void sqlite3EndTable(Parse*,Token*,Token*,Select*); +int sqlite3ParseUri(const char*,const char*,int*,sqlite3_vfs**,char**,char **); Bitvec *sqlite3BitvecCreate(u32); int sqlite3BitvecTest(Bitvec*, u32);