- changed hits from uint64_t to int;
- QP_rule_t has a pointer to its parent : this is done to speed up lookup
- implemented get_current_query_rules() to execute SAVE MYSQL QUERY RULES FROM RUNTIME (issue #93)
- implemented get_stats_query_rules() to save statistics on stats_mysql_query_rules (issue #139)
- created 2 new classes to easily process statistics in Query Processor : QP_rule_text and QP_rule_text_hitsonly
- extended classes SQLite3_row and SQLite3_result
- every __admin_refresh_interval milliseconds Admin refreshes statistics
- defined table stats_mysql_query_rules
- deprecated __attach_configdb_to_admindb() , replaced with __attach_db_to_admindb (used in issue #142)
- to admindb are now attached both configdb and statsdb (issue #142)
- drafted a way to update hits on Query Processor . This method will go away when issue #146 will be implemented
- fixed crashing bug in issue #145
#define ADMIN_SQLITE_TABLE_MYSQL_QUERY_RULES "CREATE TABLE mysql_query_rules (rule_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, active INT CHECK (active IN (0,1)) NOT NULL DEFAULT 0, username VARCHAR, schemaname VARCHAR, flagIN INT NOT NULL DEFAULT 0, match_pattern VARCHAR, negate_match_pattern INT CHECK (negate_match_pattern IN (0,1)) NOT NULL DEFAULT 0, flagOUT INT, replace_pattern VARCHAR, destination_hostgroup INT DEFAULT NULL, cache_ttl INT CHECK(cache_ttl > 0), apply INT CHECK(apply IN (0,1)) NOT NULL DEFAULT 0, FOREIGN KEY (destination_hostgroup) REFERENCES mysql_hostgroups (hostgroup_id))"
#define ADMIN_SQLITE_TABLE_GLOBAL_VARIABLES "CREATE TABLE global_variables (variable_name VARCHAR NOT NULL PRIMARY KEY, variable_value VARCHAR NOT NULL)"
#define STATS_SQLITE_TABLE_MYSQL_QUERY_RULES "CREATE TABLE stats_mysql_query_rules (rule_id INTEGER PRIMARY KEY, hits INT NOT NULL)"
#ifdef DEBUG
#define ADMIN_SQLITE_TABLE_DEBUG_LEVELS "CREATE TABLE debug_levels (module VARCHAR NOT NULL PRIMARY KEY, verbosity INT NOT NULL DEFAULT 0)"
#endif /* DEBUG */
@ -171,7 +179,8 @@ class Standard_ProxySQL_Admin: public ProxySQL_Admin {
@ -779,7 +792,6 @@ bool admin_handler_command_load_or_save(char *query_no_space, unsigned int query
returnfalse;
}
/*
if(
(query_no_space_length==strlen("SAVE MYSQL QUERY RULES TO MEMORY")&&!strncasecmp("SAVE MYSQL QUERY RULES TO MEMORY",query_no_space,query_no_space_length))
||
@ -791,12 +803,11 @@ bool admin_handler_command_load_or_save(char *query_no_space, unsigned int query