@Override public String getSQL() { return Parser.quoteIdentifier(objectName); }
@Override public String getSQL() { return "@" + Parser.quoteIdentifier(name); }
/** {@inheritDoc} */ @Override public String getSQL() { String sql = Parser.quoteIdentifier(colName); if (tblAlias != null) sql = Parser.quoteIdentifier(tblAlias) + "." + sql; if (schema != null) sql = Parser.quoteIdentifier(schema) + "." + sql; return sql; }
/** * @return SQL for the table before alias. */ public String getBeforeAliasSql() { if (schema == null) return Parser.quoteIdentifier(tblName); return Parser.quoteIdentifier(schema) + '.' + Parser.quoteIdentifier(tblName); }
/** {@inheritDoc} */ @Override public String getSQL() { return "DROP INDEX " + (ifExists ? "IF EXISTS " : "") + Parser.quoteIdentifier(schemaName) + '.' + Parser.quoteIdentifier(idxName); } }
public String getSQL() { return Parser.quoteIdentifier(name); }
@Override public String getSQL() { String sql; boolean quote = database.getSettings().databaseToUpper; if (column != null) { sql = column.getSQL(); } else { sql = quote ? Parser.quoteIdentifier(columnName) : columnName; } if (tableAlias != null) { String a = quote ? Parser.quoteIdentifier(tableAlias) : tableAlias; sql = a + "." + sql; } if (schemaName != null) { String s = quote ? Parser.quoteIdentifier(schemaName) : schemaName; sql = s + "." + sql; } return sql; }
@Override public String getCreateSQL() { return "CREATE FORCE AGGREGATE " + getSQL() + " FOR " + Parser.quoteIdentifier(className); }
@Override public String getSQL() { return expr.getSQL() + " AS " + Parser.quoteIdentifier(alias); }
/** * Add double quotes around an identifier if required. * For the H2 database, all identifiers are quoted. * * @param identifier the identifier * @return the quoted identifier */ public String quoteIdentifier(String identifier) { if (identifier == null) { return null; } if (isH2 && !isH2ModeMySQL) { return Parser.quoteIdentifier(identifier); } return StringUtils.toUpperEnglish(identifier); }
@Override public String getCreateSQL() { StringBuilder buff = new StringBuilder("CREATE FORCE ALIAS "); buff.append(getSQL()); if (deterministic) { buff.append(" DETERMINISTIC"); } if (!bufferResultSetToLocalTemp) { buff.append(" NOBUFFER"); } if (source != null) { buff.append(" AS ").append(StringUtils.quoteStringSQL(source)); } else { buff.append(" FOR ").append(Parser.quoteIdentifier( className + "." + methodName)); } return buff.toString(); }
/** {@inheritDoc} */ @Override public String getSQL() { StringBuilder sb = new StringBuilder("CREATE ") .append(idx.getIndexType() == QueryIndexType.GEOSPATIAL ? "SPATIAL " : "") .append("INDEX ").append(ifNotExists ? "IF NOT EXISTS " : "") .append(Parser.quoteIdentifier(schemaName)).append('.') .append(Parser.quoteIdentifier(idx.getName())).append(" ON ") .append(Parser.quoteIdentifier(tblName)).append(" ("); boolean first = true; for (Map.Entry<String, Boolean> e : idx.getFields().entrySet()) { if (first) first = false; else sb.append(", "); sb.append(Parser.quoteIdentifier(e.getKey())).append(e.getValue() ? " ASC" : " DESC"); } sb.append(')'); return sb.toString(); } }
@Override public String getSQL() { // TODO can remove this method once FUNCTIONS_IN_SCHEMA is enabled if (database.getSettings().functionsInSchema || !getSchema().getName().equals(Constants.SCHEMA_MAIN)) { return super.getSQL(); } return Parser.quoteIdentifier(getName()); }
private void appendWhere(StatementBuilder buff) { buff.append(" WHERE "); buff.resetCount(); for (IndexColumn c : columns) { buff.appendExceptFirst(" AND "); buff.append(Parser.quoteIdentifier(c.column.getName())).append("=?"); } }
@Override public String getSQL() { StatementBuilder buff = new StatementBuilder(); // TODO always append the schema once FUNCTIONS_IN_SCHEMA is enabled if (functionAlias.getDatabase().getSettings().functionsInSchema || !functionAlias.getSchema().getName().equals(Constants.SCHEMA_MAIN)) { buff.append( Parser.quoteIdentifier(functionAlias.getSchema().getName())) .append('.'); } buff.append(Parser.quoteIdentifier(functionAlias.getName())).append('('); for (Expression e : args) { buff.appendExceptFirst(", "); buff.append(e.getSQL()); } return buff.append(')').toString(); }
/** * @return SQL for the table after alias. */ public String getAfterAliasSQL() { if (useIndexes == null) return ""; SB b = new SB(); b.a(" USE INDEX ("); boolean first = true; for (String idx : useIndexes) { if (first) first = false; else b.a(", "); b.a(Parser.quoteIdentifier(idx)); } b.a(')'); return b.toString(); }
private void appendUpdate(StatementBuilder buff) { buff.append("UPDATE ").append(table.getSQL()).append(" SET "); buff.resetCount(); for (IndexColumn c : columns) { buff.appendExceptFirst(" , "); buff.append(Parser.quoteIdentifier(c.column.getName())).append("=?"); } }
/** {@inheritDoc} */ @Override public String getSQL() { SB b = new SB(); GridSqlAst child = child(0); boolean tbl = child instanceof GridSqlTable; b.a(tbl ? ((GridSqlTable)child).getBeforeAliasSql() : child.getSQL()); b.a(useAs ? " AS " : " "); b.a(Parser.quoteIdentifier(alias)); if (tbl) b.a(((GridSqlTable)child).getAfterAliasSQL()); return b.toString(); }
@Override public String getSQL() { StatementBuilder buff = new StatementBuilder(); buff.append(Parser.quoteIdentifier(userAggregate.getName())).append('('); for (Expression e : args) { buff.appendExceptFirst(", "); buff.append(e.getSQL()); } buff.append(')'); if (filterCondition != null) { buff.append(" FILTER (WHERE ").append(filterCondition.getSQL()).append(')'); } return buff.toString(); }
private String getCreateSQLForCopy(Table forTable, String quotedName, boolean internalIndex) { StatementBuilder buff = new StatementBuilder("ALTER TABLE "); buff.append(forTable.getSQL()).append(" ADD CONSTRAINT "); if (forTable.isHidden()) { buff.append("IF NOT EXISTS "); } buff.append(quotedName); if (comment != null) { buff.append(" COMMENT ").append(StringUtils.quoteStringSQL(comment)); } buff.append(' ').append(getConstraintType().getSqlName()).append('('); for (IndexColumn c : columns) { buff.appendExceptFirst(", "); buff.append(Parser.quoteIdentifier(c.column.getName())); } buff.append(')'); if (internalIndex && indexOwner && forTable == this.table) { buff.append(" INDEX ").append(index.getSQL()); } return buff.toString(); }