use of com.dangdang.ddframe.rdb.sharding.parser.visitor.or.OrParser in project sharding-jdbc by dangdangdotcom.
the class SQLParseEngine method parse.
/**
* 解析SQL.
*
* @return SQL解析结果
*/
public SQLParsedResult parse() {
Preconditions.checkArgument(visitor instanceof SQLVisitor);
SQLVisitor sqlVisitor = (SQLVisitor) visitor;
visitor.setParameters(parameters);
sqlVisitor.getParseContext().setShardingRule(shardingRule);
sqlStatement.accept(visitor);
SQLParsedResult result = sqlVisitor.getParseContext().getParsedResult();
if (sqlVisitor.getParseContext().isHasOrCondition()) {
new OrParser(sqlStatement, visitor).fillConditionContext(result);
}
sqlVisitor.getParseContext().mergeCurrentConditionContext();
log.debug("Parsed SQL result: {}", result);
log.debug("Parsed SQL: {}", sqlVisitor.getSQLBuilder());
result.getRouteContext().setSqlBuilder(sqlVisitor.getSQLBuilder());
result.getRouteContext().setSqlStatementType(getType());
return result;
}
Aggregations