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