[英]ListIterator throws "Exception in thread "main" java.util.ConcurrentModificationException" Java
[英]Java Util SQL Parser throws an exception for a correct statement
我的聲明是
new_call.cdctype=goal.cdctype
當我對此調用方法CCJSqlParser.SQLCondition()時,出現異常提示
Encountered " "=" "= "" at line 1, column 17.
Was expecting one of:
"NOT" ...
"LIKE" ...
"ILIKE" ...
"NOT" ...
"NOT" ...
為什么會發生這種情況的任何見解? 我正在檢查聯接條件,我認為這是聯接條件的合適表達。
碼:
String sql = "new_call.cdctype=goal.cdctype";
CCJSqlParser parser = new CCJSqlParser(new StringReader(sql));
String errorMsg=null;
try {
parser.SQLCondition();
} catch (ParseException e) {
errorMsg=e.getMessage();
}
return errorMsg;
如果深入研究JSqlParsers語法,您會發現SQLCondition只是以下之一:
您指定了一個所謂的RegularCondition 。
這是兩種解析條件的方法:
//Shortcut
Expression parseCondExpression = CCJSqlParserUtil.parseCondExpression("new_call.cdctype=goal.cdctype");
System.out.println(parseCondExpression);
//from issue
String sql = "new_call.cdctype=goal.cdctype";
CCJSqlParser parser = new CCJSqlParser(new StringProvider(sql));
try {
parser.RegularCondition();
} catch (ParseException e) {
e.printStackTrace();
}
順便說一下,我正在使用JSqlParser V1.2。 您的版本似乎有點老,因為解析器的構造函數參數現在是Provider 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.