xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_db_filename.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_DB_FILENAME 3
3.Os
4.Sh NAME
5.Nm sqlite3_db_filename
6.Nd return the filename for a database connection
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft sqlite3_filename
10.Fo sqlite3_db_filename
11.Fa "sqlite3 *db"
12.Fa "const char *zDbName"
13.Fc
14.Sh DESCRIPTION
15The sqlite3_db_filename(D,N) interface returns a pointer to the filename
16associated with database N of connection D.
17If there is no attached database N on the database connection D, or
18if database N is a temporary or in-memory database, then this function
19will return either a NULL pointer or an empty string.
20.Pp
21The string value returned by this routine is owned and managed by the
22database connection.
23The value will be valid until the database N is DETACH-ed or
24until the database connection closes.
25.Pp
26The filename returned by this function is the output of the xFullPathname
27method of the VFS.
28In other words, the filename will be an absolute pathname, even if
29the filename used to open the database originally was a URI or relative
30pathname.
31.Pp
32If the filename pointer returned by this routine is not NULL, then
33it can be used as the filename input parameter to these routines:
34.Bl -bullet
35.It
36.Fn sqlite3_uri_parameter
37.It
38.Fn sqlite3_uri_boolean
39.It
40.Fn sqlite3_uri_int64
41.It
42.Fn sqlite3_filename_database
43.It
44.Fn sqlite3_filename_journal
45.It
46.Fn sqlite3_filename_wal
47.El
48.Pp
49.Sh IMPLEMENTATION NOTES
50These declarations were extracted from the
51interface documentation at line 6613.
52.Bd -literal
53SQLITE_API sqlite3_filename sqlite3_db_filename(sqlite3 *db, const char *zDbName);
54.Ed
55.Sh SEE ALSO
56.Xr sqlite3_filename_database 3 ,
57.Xr sqlite3_uri_parameter 3
58