Skip to content

Commit 736774d

Browse files
committed
added DB name to logs + table info query
1 parent 9cbe674 commit 736774d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/infoLoggerAdminDB.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int main(int argc, char* argv[])
144144

145145
// connect database
146146
if (mysql_real_connect(&db, dbHost.c_str(), dbUser.c_str(), dbPwd.c_str(), dbName.c_str(), 0, NULL, 0) != 0) {
147-
log.info("Database connected");
147+
log.info("Database %s @ %s connected", dbName.c_str(), dbHost.c_str());
148148
} else {
149149
log.error("Failed to connect database : %s", mysql_error(&db));
150150
return -1;
@@ -171,7 +171,7 @@ int main(int argc, char* argv[])
171171

172172
// execute command(s)
173173
if (optStatus) {
174-
std::string sqlQuery = "select TABLE_NAME,TABLE_ROWS,DATA_LENGTH from information_schema.TABLES where table_name like '" INFOLOGGER_TABLE_MESSAGES "%' order by table_name";
174+
std::string sqlQuery = "select TABLE_NAME,TABLE_ROWS,DATA_LENGTH from information_schema.TABLES where table_name like '" INFOLOGGER_TABLE_MESSAGES "%' and table_schema like '" + dbName + "' order by table_name";
175175
if (mysql_query(&db, sqlQuery.c_str())) {
176176
log.error("Failed to execute %s\n%s", sqlQuery.c_str(), mysql_error(&db));
177177
return -1;

0 commit comments

Comments
 (0)