diff --git a/sqladvisor/main.cc b/sqladvisor/main.cc index 438a9ed..36882a7 100644 --- a/sqladvisor/main.cc +++ b/sqladvisor/main.cc @@ -1339,6 +1339,14 @@ int main(int argc, char **argv) { char *query = NULL; char *sqlparse_path = strdup("/usr/local/sqlparser"); int i = 0; + + if (mysqld_init(sqlparse_path)) { + sql_print_error("加载sqlparser模块有错 \n"); + if(sqlparse_path) free(sqlparse_path); + return -1; + } + if(sqlparse_path) free(sqlparse_path); + ConnectionOptionsInit(&options); context = g_option_context_new("sqladvisor"); g_option_context_add_main_entries(context, entries, NULL); @@ -1363,13 +1371,6 @@ int main(int argc, char **argv) { } } - if (mysqld_init(sqlparse_path)) { - sql_print_error("加载sqlparser模块有错 \n"); - if(sqlparse_path) free(sqlparse_path); - return -1; - } - if(sqlparse_path) free(sqlparse_path); - if (options.username == NULL || options.password == NULL || options.host == NULL || options.dbname == NULL || options.query[0] == NULL) {