use of com.actiontech.dble.route.RouteResultset in project dble by actiontech.
the class ShowVariables method response.
public static void response(ServerConnection c, String stmt) {
String db = c.getSchema() != null ? c.getSchema() : SchemaUtil.getRandomDb();
SchemaConfig schema = DbleServer.getInstance().getConfig().getSchemas().get(db);
if (schema == null) {
c.writeErrMessage("42000", "Unknown database '" + db + "'", ErrorCode.ER_BAD_DB_ERROR);
return;
}
RouteResultset rrs = new RouteResultset(stmt, ServerParse.SHOW);
try {
RouterUtil.routeToSingleNode(rrs, schema.getRandomDataNode());
ShowVariablesHandler handler = new ShowVariablesHandler(rrs, c.getSession2());
handler.execute();
} catch (Exception e) {
// Could this only be ER_PARSE_ERROR?
c.writeErrMessage(ErrorCode.ER_PARSE_ERROR, e.toString());
}
}
use of com.actiontech.dble.route.RouteResultset in project dble by actiontech.
the class MergeBuilder method constructByStatement.
public RouteResultset constructByStatement(String sql, SQLSelectStatement select) throws SQLException {
ServerSchemaStatVisitor visitor = new ServerSchemaStatVisitor();
DruidParser druidParser = new DruidSingleUnitSelectParser();
RouteResultset rrs = new RouteResultset(sql, ServerParse.SELECT);
LayerCachePool pool = DbleServer.getInstance().getRouterService().getTableId2DataNodeCache();
SchemaConfig schemaConfig = schemaConfigMap.get(node.getReferedTableNodes().get(0).getSchema());
return RouterUtil.routeFromParser(druidParser, schemaConfig, rrs, select, sql, pool, visitor, session.getSource());
}
Aggregations