mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-04 20:02:48 +03:00
Redesign for better legacy compatibility. Add the sqlite3_uri_key() interface.
FossilOrigin-Name: bcb43d11c4d0be36888c9e968ccdf85e7d7fccd72a29866f85c014e0562d4b93
This commit is contained in:
@@ -2794,7 +2794,7 @@ char *sqlite3_vsnprintf(int,char*,const char*, va_list);
|
||||
**
|
||||
** The SQLite core uses these three routines for all of its own
|
||||
** internal memory allocation needs. "Core" in the previous sentence
|
||||
** does not include operating-system specific VFS implementation. The
|
||||
** does not include operating-system specific [VFS] implementation. The
|
||||
** Windows VFS uses native malloc() and free() for some operations.
|
||||
**
|
||||
** ^The sqlite3_malloc() routine returns a pointer to a block
|
||||
@@ -3494,14 +3494,13 @@ int sqlite3_open_v2(
|
||||
/*
|
||||
** CAPI3REF: Obtain Values For URI Parameters
|
||||
**
|
||||
** These are utility routines, useful to VFS implementations, that check
|
||||
** to see if a database file was a URI that contained a specific query
|
||||
** These are utility routines, useful to [VFS|custom VFS implementations],
|
||||
** that check if a database file was a URI that contained a specific query
|
||||
** parameter, and if so obtains the value of that query parameter.
|
||||
**
|
||||
** If F is the database filename pointer passed into the xOpen() method of
|
||||
** a VFS implementation when the flags parameter to xOpen() has one or
|
||||
** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and
|
||||
** P is the name of the query parameter, then
|
||||
** a VFS implementation or it is the return value of [sqlite3_db_filename()]
|
||||
** and if P is the name of the query parameter, then
|
||||
** sqlite3_uri_parameter(F,P) returns the value of the P
|
||||
** parameter if it exists or a NULL pointer if P does not appear as a
|
||||
** query parameter on F. If P is a query parameter of F and it
|
||||
@@ -3523,40 +3522,60 @@ int sqlite3_open_v2(
|
||||
** 64-bit signed integer and returns that integer, or D if P does not
|
||||
** exist. If the value of P is something other than an integer, then
|
||||
** zero is returned.
|
||||
**
|
||||
** The sqlite3_uri_key(F,N) returns a pointer to the name (not
|
||||
** the value) of the N-th query parameter for filename F, or a NULL
|
||||
** pointer if N is less than zero or greater than the number of query
|
||||
** parameters minus 1. The N value is zero-based so N should be 0 to obtain
|
||||
** the name of the first query parameter, 1 for the second parameter, and
|
||||
** so forth.
|
||||
**
|
||||
** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
|
||||
** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
|
||||
** is not a database file pathname pointer that SQLite passed into the xOpen
|
||||
** VFS method, then the behavior of this routine is undefined and probably
|
||||
** undesirable.
|
||||
** is not a database file pathname pointer that the SQLite core passed
|
||||
** into the xOpen VFS method, then the behavior of this routine is undefined
|
||||
** and probably undesirable.
|
||||
**
|
||||
** Beginning with SQLite [version 3.31.0] ([dateof:3.31.0]) the input F
|
||||
** parameter can also be the name of a rollback journal file or WAL file
|
||||
** in addition to the main database file. Prior to version 3.31.0, these
|
||||
** routines would only work if F was the name of the main database file.
|
||||
** When the F parameter is the name of the rollback journal or WAL file,
|
||||
** it has access to all the same query parameters as were found on the
|
||||
** main database file.
|
||||
**
|
||||
** See the [URI filename] documentation for additional information.
|
||||
*/
|
||||
const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
|
||||
int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
|
||||
sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
|
||||
const char *sqlite3_uri_key(const char *zFilename, int N);
|
||||
|
||||
/*
|
||||
** CAPI3REF: Translate filenames
|
||||
**
|
||||
** These routines are available to VFS implementations for translating
|
||||
** filenames between the main database file, the journal file, and the
|
||||
** WAL file.
|
||||
** These routines are available to [VFS|custom VFS implementations] for
|
||||
** translating filenames between the main database file, the journal file,
|
||||
** and the WAL file.
|
||||
**
|
||||
** If F is the name of an sqlite database file, journal file, or WAL file
|
||||
** then sqlite3_filename_database(F) returns the name of the corresponding
|
||||
** database file.
|
||||
** passed by the SQLite core into the VFS, then sqlite3_filename_database(F)
|
||||
** returns the name of the corresponding database file.
|
||||
**
|
||||
** If F is the name of an sqlite database file, journal file, or WAL file
|
||||
** then sqlite3_filename_journal(F) returns the name of the corresponding
|
||||
** rollback journal file.
|
||||
** passed by the SQLite core into the VFS, or if F is a database filename
|
||||
** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F)
|
||||
** returns the name of the corresponding rollback journal file.
|
||||
**
|
||||
** If F is the name of an sqlite database file, journal file, or WAL file
|
||||
** then sqlite3_filename_wal(F) returns the name of the corresponding
|
||||
** that was passed by the SQLite core into the VFS, or if F is a database
|
||||
** filename obtained from [sqlite3_db_filename()], then
|
||||
** sqlite3_filename_wal(F) returns the name of the corresponding
|
||||
** WAL file.
|
||||
**
|
||||
** In all of the above, if F is not the name of a database, journal or WAL
|
||||
** filename passed into the VFS from the SQLite core, then the result is
|
||||
** filename passed into the VFS from the SQLite core and F is not the
|
||||
** return value from [sqlite3_db_filename()], then the result is
|
||||
** undefined and is likely a memory access violation.
|
||||
*/
|
||||
const char *sqlite3_filename_database(const char*);
|
||||
@@ -6006,6 +6025,17 @@ sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
|
||||
** xFullPathname method of the [VFS]. ^In other words, the filename
|
||||
** will be an absolute pathname, even if the filename used
|
||||
** to open the database originally was a URI or relative pathname.
|
||||
**
|
||||
** If the filename pointer returned by this routine is not NULL, then it
|
||||
** can be used as the filename input parameter to these routines:
|
||||
** <ul>
|
||||
** <li> [sqlite3_uri_parameter()]
|
||||
** <li> [sqlite3_uri_boolean()]
|
||||
** <li> [sqlite3_uri_int64()]
|
||||
** <li> [sqlite3_filename_database()]
|
||||
** <li> [sqlite3_filename_journal()]
|
||||
** <li> [sqlite3_filename_wal()]
|
||||
** </ul>
|
||||
*/
|
||||
const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user