10000 Merge pull request #1 from tsthght/master · github-lab/SQLAdvisor@bf505ce · GitHub
[go: up one dir, main page]

Skip to content

Commit bf505ce

Browse files
authored
Merge pull request Meituan-Dianping#1 from tsthght/master
修正参数错误日志无法输出的问题
2 parents d2442e6 + 26a91bc commit bf505ce

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

sqladvisor/main.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,14 @@ int main(int argc, char **argv) {
13391339
char *query = NULL;
13401340
char *sqlparse_path = strdup("/usr/local/sqlparser");
13411341
int i = 0;
1342+
1343+
if (mysqld_init(sqlparse_path)) {
1344+
sql_print_error("加载sqlparser模块有错 \n");
1345+
if(sqlparse_path) free(sqlparse_path);
1346+
return -1;
1347+
}
1348+
if(sqlparse_path) free(sqlparse_path);
1349+
13421350
ConnectionOptionsInit(&options);
13431351
context = g_option_context_new("sqladvisor");
13441352
g_option_context_add_main_entries(context, entries, NULL);
@@ -1363,13 +1371,6 @@ int main(int argc, char **argv) {
13631371
}
13641372
}
13651373

1366-
if (mysqld_init(sqlparse_path)) {
1367-
sql_print_error("加载sqlparser模块有错 \n");
1368-
if(sqlparse_path) free(sqlparse_path);
1369-
return -1;
1370-
}
1371-
if(sqlparse_path) free(sqlparse_path);
1372-
13731374
if (options.username == NULL || options.password == NULL
13741375
|| options.host == NULL || options.dbname == NULL
13751376
|| options.query[0] == NULL) {

0 commit comments

Comments
 (0)
0