Add the sqlite3_uri_parameter() interface function for use in building
new VFSes.
FossilOrigin-Name: 6b5de95fb575c7ceb3034068c4f5e0fccb1b15ac
diff --git a/src/main.c b/src/main.c
index d19f5f9..6dd591c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2908,3 +2908,25 @@
#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;
+}