SQLAdvisor icon indicating copy to clipboard operation
SQLAdvisor copied to clipboard

命令行使用-q参数后面跟多个SQL无法解析出来

Open dolphinsboy opened this issue 8 years ago • 0 comments

./sqladvisor -u xxx -p xxx -h xxxx -P xxx -d xxxx -q "SELECT p.*,s.cn_name FROM cc_paysystem_withdrawal as p LEFT JOIN cc_shop as s ON p.type_id = s.id WHERE ( p.type = 'SHOP' ) ORDER BY p.id LIMIT 0,50;select * from cc_paysystem_withdrawal where type='SHOP' order by id limit 0,50" -v 1

修改sqladvisor/main.cc:main函数:

     while ((query = options.query[i]) != NULL) {
         sql_print_information("Query %d:%s\n", i, query);
         sql_lex = sql_parser(query, options.dbname); 

Query输出结果如下:

2017-03-13 16:09:34 31549 [Note] Query 0:SELECT p.*,s.cn_name FROM cc_paysystem_withdrawal as p LEFT JOIN cc_shop as s ON p.type_id = s.id WHERE ( p.type = 'SHOP' ) ORDER BY p.id LIMIT 0,50;select * from cc_paysystem_withdrawal where type='SHOP' order by id limit 0,50

可以看到并没有按照SEP设置进行SQL切分

dolphinsboy avatar Mar 13 '17 08:03 dolphinsboy