use of com.dangdang.ddframe.rdb.sharding.parser.result.router.SQLBuilder in project sharding-jdbc by dangdangdotcom.
the class SQLRouteEngine method amendSQLAccordingToRouteResult.
private void amendSQLAccordingToRouteResult(final SQLParsedResult parsedResult, final List<Object> parameters, final SQLRouteResult result) {
boolean isVarious = result.getExecutionUnits().size() > 1;
Limit limit = result.getMergeContext().getLimit();
SQLBuilder sqlBuilder = parsedResult.getRouteContext().getSqlBuilder();
if (null != limit) {
limit.replaceSQL(sqlBuilder, isVarious);
limit.replaceParameters(parameters, isVarious);
}
if (!isVarious) {
sqlBuilder.removeDerivedSQL();
}
}
use of com.dangdang.ddframe.rdb.sharding.parser.result.router.SQLBuilder in project sharding-jdbc by dangdangdotcom.
the class SQLRouteEngine method buildHintParsedResult.
private SQLParsedResult buildHintParsedResult(final String logicSql) {
SQLParsedResult result = new SQLParsedResult();
RouteContext routeContext = result.getRouteContext();
routeContext.setSqlStatementType(SQLUtil.getTypeByStart(logicSql));
log.trace("Get {} SQL Statement", routeContext.getSqlStatementType());
SQLBuilder sqlBuilder = new SQLBuilder();
try {
sqlBuilder.append(logicSql);
} catch (final IOException ignored) {
}
routeContext.setSqlBuilder(sqlBuilder);
result.getConditionContexts().add(new ConditionContext());
return result;
}
use of com.dangdang.ddframe.rdb.sharding.parser.result.router.SQLBuilder in project sharding-jdbc by dangdangdotcom.
the class SQLParsedResultTest method generateSqlBuilder.
private SQLBuilder generateSqlBuilder() throws IOException {
SQLBuilder result = new SQLBuilder();
result.append("SELECT * FROM ");
result.appendToken("order");
return result;
}
Aggregations