1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Add the sqlite3_db_name() interface.

FossilOrigin-Name: 2ad152236c408cbb1f942b221de4bf3cbaa9c35313d7eb07a63f46b6040fc981
This commit is contained in:
drh
2022-05-17 14:59:05 +00:00
parent c7d7ebd755
commit ff16267d7d
6 changed files with 55 additions and 13 deletions

View File

@@ -4626,6 +4626,24 @@ Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){
return iDb<0 ? 0 : db->aDb[iDb].pBt;
}
/*
** Return the name of the N-th database schema. Return NULL if N is out
** of range.
*/
const char *sqlite3_db_name(sqlite3 *db, int N){
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) ){
(void)SQLITE_MISUSE_BKPT;
return 0;
}
#endif
if( N<0 || N>=db->nDb ){
return 0;
}else{
return db->aDb[N].zDbSName;
}
}
/*
** Return the filename of the database associated with a database
** connection.