My statement is
new_call.cdctype=goal.cdctype
When I call the method CCJSqlParser.SQLCondition() on this, I get an exception saying
Encountered " "=" "= "" at line 1, column 17.
Was expecting one of:
"NOT" ...
"LIKE" ...
"ILIKE" ...
"NOT" ...
"NOT" ...
Any insight on why this happens? I am checking join conditions and I think that this is an appropriate expression for join condition.
Code:
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;
If you dig a bit deeper into JSqlParsers grammer you will find, that a SQLCondition is only one of:
You specified a so called RegularCondition .
Here are two methods to parse your condition:
//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();
}
By the way I am using JSqlParser V1.2. Your version seems a bit older, because the constructor parameter of the parser is now a Provider .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.