/** * Get the alias name of a column or SQL expression * if it is not an aliased expression. * * @return the alias name */ public String getAlias() { return StringUtils.unEnclose(getSQL()); }
@Override public String getPlanSQL() { StringBuilder buff = new StringBuilder(); buff.append("DELETE "); buff.append("FROM ").append(targetTableFilter.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(); }
/** * @param buff Statement builder. * @param exp Alias expression. */ private static void addAlias(StatementBuilder buff, GridSqlAst exp) { exp = GridSqlAlias.unwrap(exp); buff.append(StringUtils.unEnclose(exp.getSQL())); }
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));
/** {@inheritDoc} */ @Override public String getSQL() { StatementBuilder buff = new StatementBuilder(explain() ? "EXPLAIN " : ""); buff.append("DELETE") .append("\nFROM ") .append(from.getSQL()); if (where != null) buff.append("\nWHERE ").append(StringUtils.unEnclose(where.getSQL())); if (limit != null) buff.append("\nLIMIT (").append(StringUtils.unEnclose(limit.getSQL())).append(')'); return buff.toString(); } }
@Override public String getPlanSQL() { StatementBuilder buff = new StatementBuilder("UPDATE "); buff.append(targetTableFilter.getPlanSQL(false)).append("\nSET\n "); for (Column c : columns) { 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())); } return buff.toString(); }
/** {@inheritDoc} */ @Override public String getSQL() { StatementBuilder buff = new StatementBuilder(explain() ? "EXPLAIN " : ""); buff.append("UPDATE ") .append(target.getSQL()) .append("\nSET\n"); for (GridSqlColumn c : cols) { GridSqlElement e = set.get(c.columnName()); buff.appendExceptFirst(",\n "); buff.append(c.columnName()).append(" = ").append(e != null ? e.getSQL() : "DEFAULT"); } if (where != null) buff.append("\nWHERE ").append(StringUtils.unEnclose(where.getSQL())); if (limit != null) buff.append("\nLIMIT ").append(StringUtils.unEnclose(limit.getSQL())); return buff.toString(); } }
/** {@inheritDoc} */ @Override public String getSQL() { StatementBuilder buff = new StatementBuilder(); buff.append(leftTable().getSQL()); buff.append(leftOuter ? " \n LEFT OUTER JOIN " : " \n INNER JOIN "); buff.append(rightTable().getSQL()); buff.append(" \n ON ").append(StringUtils.unEnclose(on().getSQL())); 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(Expression[] 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(); }
StringUtils.unEnclose(condition.getSQL())); g = g.getNonAliasExpression(); buff.appendExceptFirst(", "); buff.append(StringUtils.unEnclose(g.getSQL())); for (Expression g : group) { buff.appendExceptFirst(", "); buff.append(StringUtils.unEnclose(g.getSQL())); StringUtils.unEnclose(h.getSQL())); } else if (havingIndex >= 0) { Expression h = exprList[havingIndex]; buff.append("\nHAVING ").append( StringUtils.unEnclose(h.getSQL())); for (SelectOrderBy o : orderList) { buff.appendExceptFirst(", "); buff.append(StringUtils.unEnclose(o.getSQL())); StringUtils.unEnclose(limitExpr.getSQL())); if (offsetExpr != null) { buff.append(" OFFSET ").append( StringUtils.unEnclose(offsetExpr.getSQL())); StringUtils.unEnclose(sampleSizeExpr.getSQL()));
buff.append("\nWHERE ").append(StringUtils.unEnclose(where.getSQL()));
/** {@inheritDoc} */ @Override public String getSql(GridSqlOperation operation) { StatementBuilder buff = new StatementBuilder("("); buff.append(operation.child(0).getSQL()).append(" IN("); assert operation.size() > 1; if (operation.size() == 2) { String child = operation.child(1).getSQL(); buff.append(' ').append(StringUtils.unEnclose(child)).append(' '); } else { for (int i = 1; i < operation.size(); i++) { buff.appendExceptFirst(", "); buff.append(operation.child(i).getSQL()); } } return buff.append("))").toString(); } }
/** * Get the alias name of a column or SQL expression * if it is not an aliased expression. * * @return the alias name */ public String getAlias() { return StringUtils.unEnclose(getSQL()); }
/** * Get the alias name of a column or SQL expression * if it is not an aliased expression. * * @return the alias name */ public String getAlias() { return StringUtils.unEnclose(getSQL()); }
/** * Get the alias name of a column or SQL expression * if it is not an aliased expression. * * @return the alias name */ public String getAlias() { return StringUtils.unEnclose(getSQL()); }
public String getPlanSQL() { StringBuffer buff = new StringBuffer(); buff.append("DELETE FROM "); buff.append(tableFilter.getPlanSQL(false)); if (condition != null) { buff.append("\nWHERE " + StringUtils.unEnclose(condition.getSQL())); } return buff.toString(); }
/** {@inheritDoc} */ @Override public String getSQL() { StatementBuilder buff = new StatementBuilder(explain() ? "EXPLAIN " : ""); buff.append("DELETE") .append("\nFROM ") .append(from.getSQL()); if (where != null) buff.append("\nWHERE ").append(StringUtils.unEnclose(where.getSQL())); if (limit != null) buff.append("\nLIMIT (").append(StringUtils.unEnclose(limit.getSQL())).append(')'); return buff.toString(); } }
/** {@inheritDoc} */ @Override public String getSQL() { StatementBuilder buff = new StatementBuilder(); buff.append(leftTable().getSQL()); buff.append(leftOuter ? " \n LEFT OUTER JOIN " : " \n INNER JOIN "); buff.append(rightTable().getSQL()); buff.append(" \n ON ").append(StringUtils.unEnclose(on().getSQL())); return buff.toString(); } }