/** * Convert this expression to a String. * * @return the string representation */ @Override public String toString() { return getSQL(); }
/** * Exporting parameters If this expression contains parameters * * @param container parameters container * @return the SQL replaced parameter with '?' */ public String getPreparedSQL(Session session, List<Value> parameters) { return getSQL(); } }
@Override public String getSQL() { return "(NOT " + condition.getSQL() + ")"; }
String getDefaultSQL() { return defaultExpression == null ? null : defaultExpression.getSQL(); }
@Override public String getSQL() { String sql; if (opType == NEGATE) { // don't remove the space, otherwise it might end up some thing like // --1 which is a line remark sql = "- " + left.getSQL(); } else { // don't remove the space, otherwise it might end up some thing like // --1 which is a line remark sql = left.getSQL() + " " + getOperationToken() + " " + right.getSQL(); } return "(" + sql + ")"; }
@Override public String getSQL() { String sql; switch (andOrType) { case AND: sql = left.getSQL() + "\n AND " + right.getSQL(); break; case OR: sql = left.getSQL() + "\n OR " + right.getSQL(); break; default: throw DbException.throwInternalError("andOrType=" + andOrType); } return "(" + sql + ")"; }
@Override public String getSQL() { String sql; switch (compareType) { case IS_NULL: sql = left.getSQL() + " IS NULL"; break; case IS_NOT_NULL: sql = left.getSQL() + " IS NOT NULL"; break; default: sql = left.getSQL() + " " + getCompareOperator(compareType) + " " + right.getSQL(); } return "(" + sql + ")"; }
/** * Get the other expression if this is an equals comparison and the other * expression matches. * * @param match the expression that should match * @return null if no match, the other expression if there is a match */ Expression getIfEquals(Expression match) { if (compareType == EQUAL) { String sql = match.getSQL(); if (left.getSQL().equals(sql)) { return right; } else if (right.getSQL().equals(sql)) { return left; } } return null; }
public String getSQL() { StringBuilder buff = new StringBuilder(); if (expression != null) { buff.append('=').append(expression.getSQL()); } else { buff.append(columnIndexExpr.getSQL()); } if (descending) { buff.append(" DESC"); } if (nullsFirst) { buff.append(" NULLS FIRST"); } else if (nullsLast) { buff.append(" NULLS LAST"); } return buff.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()); }
@Override public String getSQL() { return expr.getSQL() + " AS " + Parser.quoteIdentifier(alias); }
/** * Get the check constraint SQL snippet. * * @param session the session * @param asColumnName the column name to use * @return the SQL snippet */ String getCheckConstraintSQL(Session session, String asColumnName) { Expression constraint = getCheckConstraint(session, asColumnName); return constraint == null ? "" : constraint.getSQL(); }
/** * Get the check constraint expression for this column if set. * * @param session the session * @param asColumnName the column name to use * @return the constraint expression */ public Expression getCheckConstraint(Session session, String asColumnName) { if (checkConstraint == null) { return null; } Parser parser = new Parser(session); String sql; synchronized (this) { String oldName = name; name = asColumnName; sql = checkConstraint.getSQL(); name = oldName; } Expression expr = parser.parseExpression(sql); return expr; }
/** * Get the SQL snippet of the expression list. * * @param list the expression list * @return the SQL snippet */ public static String getSQL(Expression[] list) { StatementBuilder buff = new StatementBuilder(); for (Expression e : list) { buff.appendExceptFirst(", "); if (e != null) { buff.append(e.getSQL()); } } return buff.toString(); }
@Override public String getSQL() { StatementBuilder buff = new StatementBuilder("("); for (Expression e : list) { buff.appendExceptFirst(", "); buff.append(e.getSQL()); } if (list.length == 1) { buff.append(','); } return buff.append(')').toString(); }
@Override public String getSQL() { StatementBuilder buff = new StatementBuilder(getName()); buff.append('('); int i = 0; for (Expression e : args) { buff.appendExceptFirst(", "); buff.append(columnList[i++].getCreateSQL()).append('=').append(e.getSQL()); } return buff.append(')').toString(); }