Skip to content

Commit

Permalink
Merge pull request #1 from tsthght/master
Browse files Browse the repository at this point in the history
修正参数错误日志无法输出的问题
  • Loading branch information
longxuegang committed Mar 7, 2017
2 parents d2442e6 + 26a91bc commit bf505ce
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions sqladvisor/main.cc
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit bf505ce

Please sign in to comment.