From b82a8060af221231b291700c591cb75c7805bad6 Mon Sep 17 00:00:00 2001 From: Andreas Ericsson Date: Thu, 8 Apr 2010 16:06:22 +0200 Subject: [PATCH] sql: Introduce sql_db_name() This returns the name of the database we're using, or the default (monitor_reports) if not set. Signed-off-by: Andreas Ericsson --- sql.c | 8 ++++++++ sql.h | 1 + 2 files changed, 9 insertions(+) diff --git a/sql.c b/sql.c index 666fdd6..3faa807 100644 --- a/sql.c +++ b/sql.c @@ -169,6 +169,14 @@ int sql_close(void) return 0; } +const char *sql_db_name(void) +{ + if (!db.name) + return "monitor_reports"; + + return db.name; +} + const char *sql_table_name(void) { if (!db.table) diff --git a/sql.h b/sql.h index 4de331c..d086f7a 100644 --- a/sql.h +++ b/sql.h @@ -19,6 +19,7 @@ extern void sql_free_result(SQL_RESULT *result); extern int sql_query(const char *fmt, ...) __attribute__((__format__(__printf__, 1, 2))); +extern const char *sql_db_name(); extern const char *sql_table_name(); #endif -- 2.11.4.GIT