From 1c1faf210f4814d0f27e2d719fb46b8ddf31c18b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 30 Jul 2017 20:11:04 +0200 Subject: [PATCH] Some clean up --- lib/MySQL_HostGroups_Manager.cpp | 2 +- lib/ProxySQL_Admin.cpp | 6 +----- lib/ProxySQL_Cluster.cpp | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/MySQL_HostGroups_Manager.cpp b/lib/MySQL_HostGroups_Manager.cpp index c749b6129..ed6e80997 100644 --- a/lib/MySQL_HostGroups_Manager.cpp +++ b/lib/MySQL_HostGroups_Manager.cpp @@ -564,7 +564,7 @@ bool MySQL_HostGroups_Manager::commit() { MySrvC *mysrvc=(MySrvC *)ptr; mysrvc->status=MYSQL_SERVER_STATUS_OFFLINE_HARD; mysrvc->ConnectionsFree->drop_all_connections(); - char *q1="DELETE FROM mysql_servers WHERE mem_pointer=%lld"; + char *q1=(char *)"DELETE FROM mysql_servers WHERE mem_pointer=%lld"; char *q2=(char *)malloc(strlen(q1)+32); sprintf(q2,q1,ptr); mydb->execute(q2); diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index 2fa1c6458..eadb315cf 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -3302,7 +3302,7 @@ char * ProxySQL_Admin::get_variable(char *name) { if (!strcasecmp(name,"telnet_admin_ifaces")) return s_strdup(variables.telnet_admin_ifaces); if (!strcasecmp(name,"telnet_stats_ifaces")) return s_strdup(variables.telnet_stats_ifaces); if (!strcasecmp(name,"cluster_check_interval_ms")) { - sprintf(intbuf,"%lu",variables.cluster_check_interval_ms); + sprintf(intbuf,"%d",variables.cluster_check_interval_ms); return strdup(intbuf); } if (!strcasecmp(name,"refresh_interval")) { @@ -3913,15 +3913,11 @@ void ProxySQL_Admin::stats___proxysql_servers_metrics() { //if (resultset==NULL) return; statsdb->execute("BEGIN"); statsdb->execute("DELETE FROM stats_proxysql_servers_metrics"); - char *a=(char *)"INSERT INTO stats_proxysql_servers_metrics VALUES (\"%s\",\"%s\",)"; - // make sure that the caller has called mysql_servers_wrlock() - char *query=NULL; SQLite3_result *resultset=NULL; resultset=GloProxyCluster->get_stats_proxysql_servers_metrics(); if (resultset) { int rc; sqlite3_stmt *statement1=NULL; - //sqlite3_stmt *statement32=NULL; sqlite3 *mydb3=statsdb->get_db(); char *query1=NULL; query1=(char *)"INSERT INTO stats_proxysql_servers_metrics VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10)"; diff --git a/lib/ProxySQL_Cluster.cpp b/lib/ProxySQL_Cluster.cpp index 419f510f5..7a6371577 100644 --- a/lib/ProxySQL_Cluster.cpp +++ b/lib/ProxySQL_Cluster.cpp @@ -350,7 +350,7 @@ SQLite3_result * ProxySQL_Cluster_Nodes::stats_proxysql_servers_metrics() { pta[0]=strdup(node->get_hostname()); sprintf(buf,"%d", node->get_port()); pta[1]=strdup(buf); - sprintf(buf,"%d", node->get_weight()); + sprintf(buf,"%lu", node->get_weight()); pta[2]=strdup(buf); pta[3]=strdup(node->get_comment()); ProxySQL_Node_Metrics *curr = node->get_metrics_curr(); @@ -396,7 +396,7 @@ SQLite3_result * ProxySQL_Cluster_Nodes::dump_table_proxysql_servers() { pta[0]=strdup(node->get_hostname()); sprintf(buf,"%d", node->get_port()); pta[1]=strdup(buf); - sprintf(buf,"%d", node->get_weight()); + sprintf(buf,"%lu", node->get_weight()); pta[2]=strdup(buf); pta[3]=strdup(node->get_comment()); result->add_row(pta);