diff --git a/sqladvisor/main.cc b/sqladvisor/main.cc index 36882a7..b39b625 100644 --- a/sqladvisor/main.cc +++ b/sqladvisor/main.cc @@ -2,6 +2,7 @@ #include #include +#include #include "sql/mysqld.h" #include "sql/sql_class.h" #include "sql/sql_lex.h" @@ -1339,7 +1340,7 @@ int main(int argc, char **argv) { char *query = NULL; char *sqlparse_path = strdup("/usr/local/sqlparser"); int i = 0; - + char *lc = NULL; if (mysqld_init(sqlparse_path)) { sql_print_error("加载sqlparser模块有错 \n"); if(sqlparse_path) free(sqlparse_path); @@ -1347,6 +1348,13 @@ int main(int argc, char **argv) { } if(sqlparse_path) free(sqlparse_path); + lc = setlocale(LC_ALL, ""); + if (NULL == lc) { + sql_print_error("setlocale 有错 \n"); + if(sqlparse_path) free(sqlparse_path); + return -1; + } + ConnectionOptionsInit(&options); context = g_option_context_new("sqladvisor"); g_option_context_add_main_entries(context, entries, NULL);