From: drh Date: Tue, 17 May 2011 18:53:08 +0000 (+0000) Subject: Add the sqlite3_uri_parameter() interface function for use in building X-Git-Tag: version-3.7.7~112 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cc487d13fce19666c4977578864dad9264ea1821;p=thirdparty%2Fsqlite.git Add the sqlite3_uri_parameter() interface function for use in building new VFSes. FossilOrigin-Name: 6b5de95fb575c7ceb3034068c4f5e0fccb1b15ac --- diff --git a/manifest b/manifest index ab1aadca4c..2c19667b1c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sextended\sreturn\scode\sSQLITE_CORRUPT_VTAB.\sReturned\swhen\sthe\stcontents\sof\sthe\ssqlite\stables\sused\sinternally\sby\sa\svirtual\stable\smodule\sare\sinvalid\sor\sinconsistent. -D 2011-05-17T15:56:16.473 +C Add\sthe\ssqlite3_uri_parameter()\sinterface\sfunction\sfor\suse\sin\sbuilding\nnew\sVFSes. +D 2011-05-17T18:53:08.942 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 11dcc00a8d0e5202def00e81732784fb0cc4fe1d 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 e32d7a44c3307a4a33cfd1a2b06fb46f418ba7fc +F src/main.c d189df8eb4833ca36e93ccf7ba1b5bad6273bfea 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 ee13c23409219c0a5fd3f0c0cd761a5073564a0b +F src/sqlite.h.in 8bbf8d9bc5f1a9474a633a2de7014506f1f06b90 F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754 F src/sqliteInt.h b34bd64a7ade4808fcc301e0bb67ef5051ea49c6 F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d @@ -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 f7c525f5fc31e909721df2b1e66fc62dfb105718 -R 8174cc733f5a883825d78ae2804a3f2d -U dan -Z 5f2d01dc50656b115009ed665e1773e1 +P 8844e8bfb87314fb40ecb92705e8fff88f72bb38 +R 95d48a407a23b64e1866e265afe49282 +U drh +Z 6f0e27514e0a4b3281aede2f373acd02 diff --git a/manifest.uuid b/manifest.uuid index a4856a4e02..7b2519a73f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8844e8bfb87314fb40ecb92705e8fff88f72bb38 \ No newline at end of file +6b5de95fb575c7ceb3034068c4f5e0fccb1b15ac \ No newline at end of file diff --git a/src/main.c b/src/main.c index d19f5f9012..6dd591ce05 100644 --- a/src/main.c +++ b/src/main.c @@ -2908,3 +2908,25 @@ int sqlite3_test_control(int op, ...){ #endif /* SQLITE_OMIT_BUILTIN_TEST */ return rc; } + +/* +** This is a utility routine, useful to VFS implementations, that checks +** to see if a database file was a URI that contained a specific query +** parameter, and if so obtains the value of the query parameter. +** +** The zFilename argument is the filename pointer passed into the xOpen() +** method of a VFS implementation. The zParam argument is the name of the +** query parameter we seek. This routine returns the value of the zParam +** parameter if it exists. If the parameter does not exist, this routine +** returns a NULL pointer. +*/ +const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){ + zFilename += sqlite3Strlen30(zFilename); + while( zFilename[0] ){ + int x = strcmp(zFilename, zParam); + zFilename += sqlite3Strlen30(zFilename); + if( x==0 ) return zFilename; + zFilename += sqlite3Strlen30(zFilename); + } + return 0; +} diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 4bcba18a95..f955d63741 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2553,6 +2553,26 @@ int sqlite3_open_v2( const char *zVfs /* Name of VFS module to use */ ); +/* +** CAPI3REF: Obtain Values For URI Parameters +** +** This is a utility routine, useful to VFS implementations, that checks +** to see if a database file was a URI that contained a specific query +** parameter, and if so obtains the value of the query parameter. +** +** The zFilename argument is the filename pointer passed into the xOpen() +** method of a VFS implementation. The zParam argument is the name of the +** query parameter we seek. This routine returns the value of the zParam +** parameter if it exists. If the parameter does not exist, this routine +** returns a NULL pointer. +** +** If the zFilename argument to this function is not a pointer that SQLite +** passed into the xOpen VFS method, then the behavior of this routine +** is undefined and probably undesirable. +*/ +const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); + + /* ** CAPI3REF: Error Codes And Messages **