/** * Get the alias name of a column or SQL expression * if it is not an aliased expression. * * @return the alias name */ @Override public String getAlias() { return StringUtils.unEnclose(getSQL()); }
@Override public String getPlanSQL() { StringBuilder buff = new StringBuilder(); buff.append("DELETE "); buff.append("FROM ").append(tableFilter.getPlanSQL(false)); if (condition != null) { buff.append("\nWHERE ").append(StringUtils.unEnclose(condition.getSQL())); } if (limitExpr != null) { buff.append("\nLIMIT (").append(StringUtils.unEnclose(limitExpr.getSQL())).append(')'); } return buff.toString(); }
buff.append(StringUtils.unEnclose(joinCondition.getSQL())); buff.append(StringUtils.unEnclose(joinCondition.getSQL())); String condition = StringUtils.unEnclose(filterCondition.getSQL()); condition = "/* WHERE " + StringUtils.quoteRemarkSQL(condition) + "\n*/"; buff.append(StringUtils.indent(condition, 4, false));
@Override public String getPlanSQL() { StatementBuilder buff = new StatementBuilder("UPDATE "); buff.append(tableFilter.getPlanSQL(false)).append("\nSET\n "); for (int i = 0, size = columns.size(); i < size; i++) { Column c = columns.get(i); Expression e = expressionMap.get(c); buff.appendExceptFirst(",\n "); buff.append(c.getName()).append(" = ").append(e.getSQL()); } if (condition != null) { buff.append("\nWHERE ").append(StringUtils.unEnclose(condition.getSQL())); } if (limitExpr != null) { buff.append("\nLIMIT (").append(StringUtils.unEnclose(limitExpr.getSQL())).append(')'); } return buff.toString(); }
/** * Create the SQL snippet that describes this sort order. * This is the SQL snippet that usually appears after the ORDER BY clause. * * @param list the expression list * @param visible the number of columns in the select list * @return the SQL snippet */ public String getSQL(IExpression[] list, int visible) { StatementBuilder buff = new StatementBuilder(); int i = 0; for (int idx : queryColumnIndexes) { buff.appendExceptFirst(", "); if (idx < visible) { buff.append(idx + 1); } else { buff.append('=').append(StringUtils.unEnclose(list[idx].getSQL())); } int type = sortTypes[i++]; if ((type & DESCENDING) != 0) { buff.append(" DESC"); } if ((type & NULLS_FIRST) != 0) { buff.append(" NULLS FIRST"); } else if ((type & NULLS_LAST) != 0) { buff.append(" NULLS LAST"); } } return buff.toString(); }
buff.append("\nWHERE ").append(StringUtils.unEnclose(condition.getSQL())); g = g.getNonAliasExpression(); buff.appendExceptFirst(", "); buff.append(StringUtils.unEnclose(g.getSQL(isDistributed))); for (Expression g : group) { buff.appendExceptFirst(", "); buff.append(StringUtils.unEnclose(g.getSQL(isDistributed))); buff.append("\nHAVING ").append(StringUtils.unEnclose(h.getSQL(isDistributed))); } else if (havingIndex >= 0) { Expression h = exprList[havingIndex]; buff.append("\nHAVING ").append(StringUtils.unEnclose(h.getSQL(isDistributed))); for (SelectOrderBy o : orderList) { buff.appendExceptFirst(", "); buff.append(StringUtils.unEnclose(o.getSQL())); buff.append("\nLIMIT ").append(StringUtils.unEnclose(limitExpr.getSQL(isDistributed))); if (offsetExpr != null) { buff.append(" OFFSET ").append(StringUtils.unEnclose(offsetExpr.getSQL(isDistributed))); buff.append("\nSAMPLE_SIZE ").append(StringUtils.unEnclose(sampleSizeExpr.getSQL()));