Beispiel #1
0
 public SubqueryCursor(TableFilter filter, SearchRow first, SearchRow last) {
   StringBuilder buff = new StringBuilder("SELECT * FROM ");
   buff.append(filter.getTable().getSQL());
   Expression filterCondition = filter.getFilterCondition();
   if (filterCondition != null) {
     buff.append(" WHERE ").append(StringUtils.unEnclose(filterCondition.getSQL()));
   }
   Prepared prepared = filter.getSession().prepare(buff.toString(), true);
   subqueryResult = prepared.query(-1);
 }
  public static CommandRemote getCommandRemote(
      HBaseSession originalSession,
      Prepared prepared, //
      String url,
      String sql)
      throws Exception {
    SessionRemote sessionRemote = originalSession.getSessionRemote(url);
    if (sessionRemote != null && sessionRemote.isClosed()) sessionRemote = null;
    boolean isNew = false;
    if (sessionRemote == null) {
      isNew = true;
      sessionRemote = getSessionRemote(originalSession.getOriginalProperties(), url);
    }

    if (sessionRemote.getTransaction() == null)
      sessionRemote.setTransaction(originalSession.getTransaction());

    if (isNew) originalSession.addSessionRemote(url, sessionRemote);

    return getCommandRemote(sessionRemote, sql, prepared.getParameters(), prepared.getFetchSize());
  }