mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge pull request #1577 from qxo/switchSQLStatementParserTryBestOff
修正parseStatement实现,默认不忽略语法错误
This commit is contained in:
@@ -2025,12 +2025,23 @@ public class SQLStatementParser extends SQLParser {
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
public SQLStatement parseStatement() {
|
||||
return parseStatement(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tryBest - 为true去解析并忽略之后的错误
|
||||
* 强制建议除非明确知道可以忽略才传tryBest=true,
|
||||
* 不然会忽略语法错误,且截断sql,导致update和delete无where条件下执行!!!
|
||||
*/
|
||||
public SQLStatement parseStatement( final boolean tryBest) {
|
||||
List<SQLStatement> list = new ArrayList<SQLStatement>();
|
||||
|
||||
this.parseStatementList(list, 1);
|
||||
|
||||
if(tryBest){
|
||||
this.parseStatementList(list, 1);
|
||||
}else{
|
||||
parseStatementList(list);
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user