.Dd January 24, 2024 .Dt SQLITE3_DB_NAME 3 .Os .Sh NAME .Nm sqlite3_db_name .Nd return the schema name for a database connection .Sh SYNOPSIS .In sqlite3.h .Ft const char * .Fo sqlite3_db_name .Fa "sqlite3 *db" .Fa "int N" .Fc .Sh DESCRIPTION The sqlite3_db_name(D,N) interface returns a pointer to the schema name for the N-th database on database connection D, or a NULL pointer of N is out of range. An N value of 0 means the main database file. An N of 1 is the "temp" schema. Larger values of N correspond to various ATTACH-ed databases. .Pp Space to hold the string that is returned by sqlite3_db_name() is managed by SQLite itself. The string might be deallocated by any operation that changes the schema, including ATTACH or DETACH or calls to .Fn sqlite3_serialize or .Fn sqlite3_deserialize , even operations that occur on a different thread. Applications that need to remember the string long-term should make their own copy. Applications that are accessing the same database connection simultaneously on multiple threads should mutex-protect calls to this API and should make their own private copy of the result prior to releasing the mutex. .Sh IMPLEMENTATION NOTES These declarations were extracted from the interface documentation at line 6591. .Bd -literal SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N); .Ed .Sh SEE ALSO .Xr sqlite3_deserialize 3 , .Xr sqlite3_serialize 3