use of com.actiontech.dble.route.Procedure in project dble by actiontech.
the class AbstractRouteStrategy method parseProcedure.
private Procedure parseProcedure(String sql) {
Procedure procedure = new Procedure();
procedure.setOriginSql(sql);
procedure.setResultList(false);
SQLStatementParser parser = new MySqlStatementParser(sql);
SQLStatement statement = parser.parseStatement();
if (statement instanceof SQLCallStatement) {
parseProcedureForCall(procedure, sql, (SQLCallStatement) statement);
}
return procedure;
}
use of com.actiontech.dble.route.Procedure in project dble by actiontech.
the class AbstractRouteStrategy method route.
@Override
public RouteResultset route(SchemaConfig schema, int sqlType, String origSQL, ServerConnection sc, LayerCachePool cachePool) throws SQLException {
RouteResultset rrs = new RouteResultset(origSQL, sqlType);
/*
* debug mode and load data ,no cache
*/
if (LOGGER.isDebugEnabled() && origSQL.startsWith(LoadData.LOAD_DATA_HINT)) {
rrs.setCacheAble(false);
}
if (sqlType == ServerParse.CALL) {
rrs.setCallStatement(true);
Procedure procedure = parseProcedure(origSQL);
rrs.setProcedure(procedure);
}
if (schema == null) {
rrs = routeNormalSqlWithAST(null, origSQL, rrs, cachePool, sc);
} else {
if (sqlType == ServerParse.SHOW) {
rrs.setStatement(origSQL);
rrs = RouterUtil.routeToSingleNode(rrs, schema.getRandomDataNode());
} else {
rrs = routeNormalSqlWithAST(schema, origSQL, rrs, cachePool, sc);
}
}
return rrs;
}
Aggregations