xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_uri_parameter.3 (revision 82d56013d7b633d116a93943de88e08335357a7c)
1.Dd December 19, 2018
2.Dt SQLITE3_URI_PARAMETER 3
3.Os
4.Sh NAME
5.Nm sqlite3_uri_parameter ,
6.Nm sqlite3_uri_boolean ,
7.Nm sqlite3_uri_int64
8.Nd Obtain Values For URI Parameters
9.Sh SYNOPSIS
10.Ft const char *
11.Fo sqlite3_uri_parameter
12.Fa "const char *zFilename"
13.Fa "const char *zParam"
14.Fc
15.Ft int
16.Fo sqlite3_uri_boolean
17.Fa "const char *zFile"
18.Fa "const char *zParam"
19.Fa "int bDefault"
20.Fc
21.Ft sqlite3_int64
22.Fo sqlite3_uri_int64
23.Fa "const char*"
24.Fa "const char*"
25.Fa "sqlite3_int64"
26.Fc
27.Sh DESCRIPTION
28These are utility routines, useful to VFS implementations, that check
29to see if a database file was a URI that contained a specific query
30parameter, and if so obtains the value of that query parameter.
31.Pp
32If F is the database filename pointer passed into the xOpen() method
33of a VFS implementation when the flags parameter to xOpen() has one
34or more of the SQLITE_OPEN_URI or SQLITE_OPEN_MAIN_DB
35bits set and P is the name of the query parameter, then sqlite3_uri_parameter(F,P)
36returns the value of the P parameter if it exists or a NULL pointer
37if P does not appear as a query parameter on F.
38If P is a query parameter of F has no explicit value, then sqlite3_uri_parameter(F,P)
39returns a pointer to an empty string.
40.Pp
41The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
42parameter and returns true (1) or false (0) according to the value
43of P.
44The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the value
45of query parameter P is one of "yes", "true", or "on" in any case or
46if the value begins with a non-zero number.
47The sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value
48of query parameter P is one of "no", "false", or "off" in any case
49or if the value begins with a numeric zero.
50If P is not a query parameter on F or if the value of P is does not
51match any of the above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
52.Pp
53The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
5464-bit signed integer and returns that integer, or D if P does not
55exist.
56If the value of P is something other than an integer, then zero is
57returned.
58.Pp
59If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL
60and sqlite3_uri_boolean(F,P,B) returns B.
61If F is not a NULL pointer and is not a database file pathname pointer
62that SQLite passed into the xOpen VFS method, then the behavior of
63this routine is undefined and probably undesirable.
64.Sh SEE ALSO
65.Xr SQLITE_OPEN_READONLY 3
66