private String buildBboxWhereClause(List<Selector.Polygon> bboxSelectors) {
   StringBuilder obj = new StringBuilder();
   boolean first = true;
   for (Selector selector : bboxSelectors) {
     if (!first) {
       obj.append(" OR ");
     }
     obj.append(selector.getWhereString());
     first = false;
   }
   if (first) {
     // empty selector, put in a null statement which postgres should
     // just optimise away
     obj.append("(1=1)");
   }
   return obj.toString();
 }
Ejemplo n.º 2
0
  @Override
  public String getWhereString() {
    StringBuilder b = new StringBuilder();
    Iterator<Selector> iterator = selectors.iterator();

    while (iterator.hasNext()) {
      Selector selector = iterator.next();
      b.append("(");
      b.append(selector.getWhereString());
      b.append(")");

      if (iterator.hasNext()) {
        b.append(" OR ");
      }
    }

    return b.toString();
  }
  private String buildTagSelectorWhereClause(List<? extends Selector> tagSelectors) {
    StringBuilder obj = new StringBuilder();
    boolean first = true;
    for (Selector selector : tagSelectors) {
      if (selector instanceof Selector.Polygon) {

      } else {
        if (!first) {
          obj.append(" AND ");
        }

        obj.append(selector.getWhereString());
        first = false;
      }
    }
    if (first) {
      // empty selector, put in a null statement which postgres should
      // just optimise away
      obj.append("(1=1)");
    }
    return obj.toString();
  }