diff --git a/include/proxysql_config.h b/include/proxysql_config.h index bc095b76c7..1a98cce359 100644 --- a/include/proxysql_config.h +++ b/include/proxysql_config.h @@ -7,8 +7,8 @@ class SQLite3DB; extern const char* config_header; class ProxySQL_Config { - SQLite3DB* admindb; public: + SQLite3DB* admindb; ProxySQL_Config(SQLite3DB* db); virtual ~ProxySQL_Config(); diff --git a/include/proxysql_restapi.h b/include/proxysql_restapi.h index 9660a12646..b1de2bd825 100644 --- a/include/proxysql_restapi.h +++ b/include/proxysql_restapi.h @@ -22,8 +22,8 @@ class Restapi_Row { }; class ProxySQL_Restapi { - SQLite3DB* admindb; public: + SQLite3DB* admindb; ProxySQL_Restapi(SQLite3DB* db); virtual ~ProxySQL_Restapi(); diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index 84c2e86e47..e672a38ed4 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -778,11 +778,17 @@ int ProxySQL_Test___GetDigestTable(bool reset, bool use_swap) { ProxySQL_Config& ProxySQL_Admin::proxysql_config() { static ProxySQL_Config instance = ProxySQL_Config(admindb); + if (instance.admindb != admindb) { + instance.admindb = admindb; + } return instance; } ProxySQL_Restapi& ProxySQL_Admin::proxysql_restapi() { static ProxySQL_Restapi instance = ProxySQL_Restapi(admindb); + if (instance.admindb != admindb) { + instance.admindb = admindb; + } return instance; }