@Override public String toString() { return toSql(); } }
@Override public String toString() { return toSql(); } }
@Override public String toSql() { return toSql(false); }
@Override public String toSql() { return toSql(false); }
/** * @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(); } }
protected String rewriteSelectItem(Query query, SelectItem item) { if (item.isFunctionApproximationAllowed()) { // function approximation is not included in any standard SQL // constructions - will have to be overridden by subclasses if there // are specialized dialects for it. item = item.replaceFunctionApproximationAllowed(false); } return item.toSql(isSchemaIncludedInColumnPaths()); }
protected String rewriteSelectItem(Query query, SelectItem item) { if (item.isFunctionApproximationAllowed()) { // function approximation is not included in any standard SQL // constructions - will have to be overridden by subclasses if there // are specialized dialects for it. item = item.replaceFunctionApproximationAllowed(false); } return item.toSql(isSchemaIncludedInColumnPaths()); }
private void appendJoinOnItem(StringBuilder sb, String sideAlias, SelectItem onItem) { final FromItem fromItem = onItem.getFromItem(); if (fromItem != null && fromItem.getSubQuery() != null && fromItem.getAlias() != null) { // there's a corner case scenario where an ON item references a // subquery being joined. In that case the getSuperQueryAlias() // method will include the subquery alias. final String superQueryAlias = onItem.getSuperQueryAlias(); sb.append(superQueryAlias); return; } if(_join != null && _leftSide.getJoin() != null) { sb.append(onItem.toSql()); return; } if (sideAlias != null) { sb.append(sideAlias); sb.append('.'); } final String superQueryAlias = onItem.getSuperQueryAlias(); sb.append(superQueryAlias); }
private void appendJoinOnItem(StringBuilder sb, String sideAlias, SelectItem onItem) { final FromItem fromItem = onItem.getFromItem(); if (fromItem != null && fromItem.getSubQuery() != null && fromItem.getAlias() != null) { // there's a corner case scenario where an ON item references a // subquery being joined. In that case the getSuperQueryAlias() // method will include the subquery alias. final String superQueryAlias = onItem.getSuperQueryAlias(); sb.append(superQueryAlias); return; } if(_join != null && _leftSide.getJoin() != null) { sb.append(onItem.toSql()); return; } if (sideAlias != null) { sb.append(sideAlias); sb.append('.'); } final String superQueryAlias = onItem.getSuperQueryAlias(); sb.append(superQueryAlias); }