diff options
author | drh <drh@noemail.net> | 2011-05-17 18:53:08 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-05-17 18:53:08 +0000 |
commit | cc487d13fce19666c4977578864dad9264ea1821 (patch) | |
tree | 4060218bbb3c354d938b5377e203ab8b8901a2fa /src | |
parent | 133d7dab17f1a82fbbfa7f0710b6c2dc008d9407 (diff) | |
download | sqlite-cc487d13fce19666c4977578864dad9264ea1821.tar.gz sqlite-cc487d13fce19666c4977578864dad9264ea1821.zip |
Add the sqlite3_uri_parameter() interface function for use in building
new VFSes.
FossilOrigin-Name: 6b5de95fb575c7ceb3034068c4f5e0fccb1b15ac
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 22 | ||||
-rw-r--r-- | src/sqlite.h.in | 20 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index d19f5f901..6dd591ce0 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 4bcba18a9..f955d6374 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -2554,6 +2554,26 @@ int sqlite3_open_v2( ); /* +** 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 ** ** ^The sqlite3_errcode() interface returns the numeric [result code] or |