예제 #1
0
  public static String constructQualifiedColumnString(
      Set<String> vars, TupleSetMetadata meta, String extraQualifier) {
    String ret = "";
    int count = 0;
    for (String s : vars) {
      ++count;
      ret +=
          (extraQualifier.isEmpty() ? "" : (extraQualifier + "::"))
              + meta.getQualifiedVariable(s)
              + ",";
    }
    ret = Util.clearTrailingCommas(ret) + "";
    if (count > 1) {
      ret = "(" + ret + ")";
    }

    return ret;
  }
예제 #2
0
  public static String makeQualifiedVariableString(
      Set<String> vars, Collection<TupleSetMetadata> meta, boolean increaseQualification)
      throws QueryEvaluationException {
    String ret = "";

    for (String v : vars) {
      boolean foundone = false;
      for (TupleSetMetadata m : meta) {
        String cc = m.getQualifiedVariable(v);
        if (cc != null) {
          ret += (increaseQualification ? (m.name + "::") : "") + cc + " AS " + v + ", ";
          foundone = true;
          break;
        }
      }
      if (!foundone) throw new QueryEvaluationException("No qualifier for variable " + v);
    }
    return Util.clearTrailingCommas(ret);
  }