コード例 #1
0
  /*
   * Gets the alias name for the table for this FilterQuery within the SELECT stmt.
   * Handles case where same table may be used more than once in a SELECT statment.
   * Forward to parentProcessor if any since only top level processor is emitting
   * SELECT statement that contains all aliases (no nested SELECTs).
   *
   */
  protected String getAliasForTable(String tableName) {
    String alias = null;

    if (parentQueryProcessor != null) {
      alias = parentQueryProcessor.getAliasForTable(tableName);
    } else {
      alias = tableName.toLowerCase();
      String originalAlias = alias;

      int i = 0;
      while (aliases.contains(alias)) {
        alias = originalAlias + i;
        i++;
      }

      addTableNameAndAlias(tableName, alias);
    }

    return alias;
  }