diff options
author | drh <> | 2022-05-17 14:59:05 +0000 |
---|---|---|
committer | drh <> | 2022-05-17 14:59:05 +0000 |
commit | ff16267d7da5ddbf1edb683d4524e5f8d7d7ae11 (patch) | |
tree | c68c01513cf1a5ef79915a7ea6418c9808f09df1 /src/main.c | |
parent | c7d7ebd75587bec2227befda16c298bf175b5fa9 (diff) | |
download | sqlite-ff16267d7da5ddbf1edb683d4524e5f8d7d7ae11.tar.gz sqlite-ff16267d7da5ddbf1edb683d4524e5f8d7d7ae11.zip |
Add the sqlite3_db_name() interface.
FossilOrigin-Name: 2ad152236c408cbb1f942b221de4bf3cbaa9c35313d7eb07a63f46b6040fc981
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index c40b3162a..3ae1f4fe3 100644 --- a/src/main.c +++ b/src/main.c @@ -4627,6 +4627,24 @@ Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){ } /* +** 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. */ |