Move config file read/write functions to separate file.

pull/2413/head
Valentin Rakush 7 years ago
parent 9954e6b4cb
commit 6bd6c0a34b

@ -9,7 +9,7 @@
#include "ProxySQL_RESTAPI_Server.hpp"
typedef struct { uint32_t hash; uint32_t key; } t_symstruct;
class ProxySQL_Config;
class Scheduler_Row {
public:
@ -269,20 +269,7 @@ class ProxySQL_Admin {
void stats___mysql_prepared_statements_info();
void stats___mysql_gtid_executed();
int Read_Global_Variables_from_configfile(const char *prefix);
int Read_MySQL_Users_from_configfile();
int Read_MySQL_Query_Rules_from_configfile();
int Read_MySQL_Servers_from_configfile();
int Read_Scheduler_from_configfile();
int Read_ProxySQL_Servers_from_configfile();
void addField(std::string& data, const char* name, const char* value, const char* dq="\"");
int Write_Global_Variables_to_configfile(std::string& data);
int Write_MySQL_Users_to_configfile(std::string& data);
int Write_MySQL_Query_Rules_to_configfile(std::string& data);
int Write_MySQL_Servers_to_configfile(std::string& data);
int Write_Scheduler_to_configfile(std::string& data);
int Write_ProxySQL_Servers_to_configfile(std::string& data);
ProxySQL_Config& proxysql_config();
void flush_error_log();
bool GenericRefreshStatistics(const char *query_no_space, unsigned int query_no_space_length, bool admin);

@ -0,0 +1,30 @@
#ifndef __PROXYSQL_CONFIG_H__
#define __PROXYSQL_CONFIG_H__
#include <string>
class SQLite3DB;
class ProxySQL_Config {
SQLite3DB* admindb;
public:
ProxySQL_Config(SQLite3DB* db);
virtual ~ProxySQL_Config();
int Read_Global_Variables_from_configfile(const char *prefix);
int Read_MySQL_Users_from_configfile();
int Read_MySQL_Query_Rules_from_configfile();
int Read_MySQL_Servers_from_configfile();
int Read_Scheduler_from_configfile();
int Read_ProxySQL_Servers_from_configfile();
void addField(std::string& data, const char* name, const char* value, const char* dq="\"");
int Write_Global_Variables_to_configfile(std::string& data);
int Write_MySQL_Users_to_configfile(std::string& data);
int Write_MySQL_Query_Rules_to_configfile(std::string& data);
int Write_MySQL_Servers_to_configfile(std::string& data);
int Write_Scheduler_to_configfile(std::string& data);
int Write_ProxySQL_Servers_to_configfile(std::string& data);
};
#endif

@ -95,7 +95,7 @@ default: libproxysql.a
_OBJ = c_tokenizer.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
_OBJ_CXX = ProxySQL_GloVars.oo network.oo debug.oo configfile.oo Query_Cache.oo SpookyV2.oo MySQL_Authentication.oo gen_utils.oo sqlite3db.oo mysql_connection.oo MySQL_HostGroups_Manager.oo mysql_data_stream.oo MySQL_Thread.oo MySQL_Session.oo MySQL_Protocol.oo mysql_backend.oo Query_Processor.oo ProxySQL_Admin.oo MySQL_Monitor.oo MySQL_Logger.oo thread.oo MySQL_PreparedStatement.oo ProxySQL_Cluster.oo SQLite3_Server.oo ClickHouse_Authentication.oo ClickHouse_Server.oo ProxySQL_Statistics.oo Chart_bundle_js.oo ProxySQL_HTTP_Server.oo ProxySQL_RESTAPI_Server.oo font-awesome.min.css.oo main-bundle.min.css.oo set_parser.oo
_OBJ_CXX = ProxySQL_GloVars.oo network.oo debug.oo configfile.oo Query_Cache.oo SpookyV2.oo MySQL_Authentication.oo gen_utils.oo sqlite3db.oo mysql_connection.oo MySQL_HostGroups_Manager.oo mysql_data_stream.oo MySQL_Thread.oo MySQL_Session.oo MySQL_Protocol.oo mysql_backend.oo Query_Processor.oo ProxySQL_Admin.oo ProxySQL_Config.oo MySQL_Monitor.oo MySQL_Logger.oo thread.oo MySQL_PreparedStatement.oo ProxySQL_Cluster.oo SQLite3_Server.oo ClickHouse_Authentication.oo ClickHouse_Server.oo ProxySQL_Statistics.oo Chart_bundle_js.oo ProxySQL_HTTP_Server.oo ProxySQL_RESTAPI_Server.oo font-awesome.min.css.oo main-bundle.min.css.oo set_parser.oo
OBJ_CXX = $(patsubst %,$(ODIR)/%,$(_OBJ_CXX))
HEADERS = ../include/*.h ../include/*.hpp

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save