SQLITE3_DB_NAME(3) Library Functions Manual SQLITE3_DB_NAME(3)

sqlite3_db_namereturn the schema name for a database connection

#include <sqlite3.h>

const char *
sqlite3_db_name(sqlite3 *db, int N);

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.

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 () or (), 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.

These declarations were extracted from the interface documentation at line 6591.

SQLITE_API const char *sqlite3_db_name(sqlite3 *db, int N);

sqlite3_deserialize(3), sqlite3_serialize(3)

January 24, 2024 NetBSD 11.0