xref: /netbsd-src/external/public-domain/sqlite/man/sqlite3_db_name.3 (revision b9988867a8ad969c45a52aa7628bc932ec98d46b)
1.Dd January 24, 2024
2.Dt SQLITE3_DB_NAME 3
3.Os
4.Sh NAME
5.Nm sqlite3_db_name
6.Nd return the schema name for a database connection
7.Sh SYNOPSIS
8.In sqlite3.h
9.Ft const char *
10.Fo sqlite3_db_name
11.Fa "sqlite3 *db"
12.Fa "int N"
13.Fc
14.Sh DESCRIPTION
15The sqlite3_db_name(D,N) interface returns a pointer to the schema
16name for the N-th database on database connection D, or a NULL pointer
17of N is out of range.
18An N value of 0 means the main database file.
19An N of 1 is the "temp" schema.
20Larger values of N correspond to various ATTACH-ed databases.
21.Pp
22Space to hold the string that is returned by sqlite3_db_name() is managed
23by SQLite itself.
24The string might be deallocated by any operation that changes the schema,
25including ATTACH or DETACH or calls to
26.Fn sqlite3_serialize
27or
28.Fn sqlite3_deserialize ,
29even operations that occur on a different thread.
30Applications that need to remember the string long-term should make
31their own copy.
32Applications that are accessing the same database connection simultaneously
33on multiple threads should mutex-protect calls to this API and should
34make their own private copy of the result prior to releasing the mutex.
35.Sh IMPLEMENTATION NOTES
36These declarations were extracted from the
37interface documentation at line 6591.
38.Bd -literal
39SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N);
40.Ed
41.Sh SEE ALSO
42.Xr sqlite3_deserialize 3 ,
43.Xr sqlite3_serialize 3
44