use of com.actiontech.dble.sqlengine.TransformSQLJob in project dble by actiontech.
the class SelectHandler method handle.
public static void handle(String stmt, ManagerConnection c, int offset) {
switch(ManagerParseSelect.parse(stmt, offset)) {
case VERSION_COMMENT:
SelectVersionComment.response(c);
break;
case SESSION_TX_READ_ONLY:
SelectSessionTxReadOnly.execute(c);
break;
case MAX_ALLOWED_PACKET:
SelectMaxAllowedPacket.execute(c);
break;
default:
if (isSupportSelect(stmt)) {
Iterator<PhysicalDBPool> iterator = DbleServer.getInstance().getConfig().getDataHosts().values().iterator();
if (iterator.hasNext()) {
PhysicalDBPool pool = iterator.next();
final PhysicalDatasource source = pool.getSource();
TransformSQLJob sqlJob = new TransformSQLJob(stmt, pool.getSchemas()[0], source, c);
sqlJob.run();
} else {
c.writeErrMessage(ErrorCode.ER_YES, "no valid data host");
}
} else {
c.writeErrMessage(ErrorCode.ER_YES, "Unsupported statement");
}
}
}
Aggregations