public StringBuilder toStringNoAlias() { return toStringNoAlias(false); }
public StringBuilder toStringNoAlias() { return toStringNoAlias(false); }
@Override public String toSql(boolean includeSchemaInColumnPath) { final StringBuilder sb = toStringNoAlias(includeSchemaInColumnPath); if (_alias != null) { sb.append(" AS "); sb.append(_alias); } return sb.toString(); }
@Override public String toSql(boolean includeSchemaInColumnPath) { final StringBuilder sb = toStringNoAlias(includeSchemaInColumnPath); if (_alias != null) { sb.append(" AS "); sb.append(_alias); } return sb.toString(); }
/** * @return an alias that can be used in WHERE, GROUP BY and ORDER BY clauses in the same query */ public String getSameQueryAlias(boolean includeSchemaInColumnPath) { if (_column != null) { final StringBuilder sb = new StringBuilder(); final String columnPrefix = getToStringColumnPrefix(includeSchemaInColumnPath); sb.append(columnPrefix); sb.append(_column.getQuotedName()); appendFunctionSql(sb); return sb.toString(); } final String alias = getAlias(); if (alias == null) { final String result = toStringNoAlias(includeSchemaInColumnPath).toString(); logger.debug("Could not resolve a reasonable same-query alias for SelectItem: {}", result); return result; } return alias; }
/** * @return an alias that can be used in WHERE, GROUP BY and ORDER BY clauses in the same query */ public String getSameQueryAlias(boolean includeSchemaInColumnPath) { if (_column != null) { final StringBuilder sb = new StringBuilder(); final String columnPrefix = getToStringColumnPrefix(includeSchemaInColumnPath); sb.append(columnPrefix); sb.append(_column.getQuotedName()); appendFunctionSql(sb); return sb.toString(); } final String alias = getAlias(); if (alias == null) { final String result = toStringNoAlias(includeSchemaInColumnPath).toString(); logger.debug("Could not resolve a reasonable same-query alias for SelectItem: {}", result); return result; } return alias; }
/** * @return the name that this SelectItem can be referenced with, if referenced from a super-query. This will usually * be the alias, but if there is no alias, then the column name will be used. * * @param includeQuotes indicates whether or not the output should include quotes, if the select item's column has * quotes associated (typically true, but false if used for presentation) */ public String getSuperQueryAlias(boolean includeQuotes) { if (_alias != null) { return _alias; } else if (_column != null) { final StringBuilder sb = new StringBuilder(); if (includeQuotes) { sb.append(_column.getQuotedName()); } else { sb.append(_column.getName()); } appendFunctionSql(sb); return sb.toString(); } else { logger.debug("Could not resolve a reasonable super-query alias for SelectItem: {}", toSql()); return toStringNoAlias().toString(); } }
/** * @return the name that this SelectItem can be referenced with, if referenced from a super-query. This will usually * be the alias, but if there is no alias, then the column name will be used. * * @param includeQuotes indicates whether or not the output should include quotes, if the select item's column has * quotes associated (typically true, but false if used for presentation) */ public String getSuperQueryAlias(boolean includeQuotes) { if (_alias != null) { return _alias; } else if (_column != null) { final StringBuilder sb = new StringBuilder(); if (includeQuotes) { sb.append(_column.getQuotedName()); } else { sb.append(_column.getName()); } appendFunctionSql(sb); return sb.toString(); } else { logger.debug("Could not resolve a reasonable super-query alias for SelectItem: {}", toSql()); return toStringNoAlias().toString(); } }