public String getTable(Dialect dialect) { if (tableAlias == null) { return table; } else { return table + " " + dialect.openQuote() + tableAlias + dialect.closeQuote(); } }
@Override public String getQuotedName() { return dialect.openQuote() + alias + dialect.closeQuote(); }
@Override public String getQuotedSuffixedName(String suffix) { return dialect.openQuote() + alias + suffix + dialect.closeQuote(); }
@Override public String getQuotedName() { return dialect.openQuote() + name + dialect.closeQuote(); }
@Override public String getQuotedSuffixedName(String suffix) { return dialect.openQuote() + name + suffix + dialect.closeQuote(); }
@Override public String getFullQuotedName() { return dialect.openQuote() + subQueryAlias + dialect.closeQuote() + '.' + getQuotedName(); } }
/** * Gets a CREATE INDEX statement for an index. * * @param indexName the index name (for fulltext) * @param indexType the index type * @param table the table * @param columns the columns to index * @param model the model */ public String getCreateIndexSql(String indexName, Table.IndexType indexType, Table table, List<Column> columns, Model model) { List<String> qcols = new ArrayList<>(columns.size()); List<String> pcols = new ArrayList<>(columns.size()); for (Column col : columns) { qcols.add(col.getQuotedName()); pcols.add(col.getPhysicalName()); } String quotedIndexName = openQuote() + getIndexName(table.getKey(), pcols) + closeQuote(); if (indexType == Table.IndexType.FULLTEXT) { return getCreateFulltextIndexSql(indexName, quotedIndexName, table, columns, model); } else { String unique = indexType == Table.IndexType.UNIQUE ? "UNIQUE " : ""; return String.format("CREATE %sINDEX %s ON %s (%s)", unique, quotedIndexName, table.getQuotedName(), String.join(", ", qcols)); } }
@Override protected void fixSelect(Select select) { if (type == COUNT_SOURCE) { // add a GROUP BY on first col String name; if (dialect.needsOriginalColumnInGroupBy()) { name = firstSelectedColumn.getFullQuotedName(); } else { name = dialect.openQuote() + COL_ALIAS_PREFIX + "1" + dialect.closeQuote(); } select.setGroupBy(name); } }
/** * Creates a new column with the given name and type. * * @param table the column's table * @param physicalName the column physical name * @param type the column's type * @param key the associated field name */ public Column(Table table, String physicalName, ColumnType type, String key) { this.table = table; dialect = table.getDialect(); this.physicalName = physicalName; this.type = type; JDBCInfo jdbcInfo = dialect.getJDBCTypeAndString(type); jdbcType = jdbcInfo.jdbcType; jdbcTypeString = jdbcInfo.string; jdbcBaseType = jdbcInfo.jdbcBaseType; jdbcBaseTypeString = jdbcInfo.jdbcBaseTypeString; this.key = key; quotedName = dialect.openQuote() + physicalName + dialect.closeQuote(); freeVariableSetter = dialect.getFreeVariableSetterForType(type); }
StringBuilder buf = new StringBuilder(); String constraintName = dialect.openQuote() + dialect.getPrimaryKeyConstraintName(key) + dialect.closeQuote(); buf.append("ALTER TABLE "); buf.append(getQuotedName()); String constraintName = dialect.openQuote() + dialect.getForeignKeyConstraintName(key, column.getPhysicalName(), ft.getPhysicalName()) + dialect.closeQuote(); StringBuilder buf = new StringBuilder(); buf.append("ALTER TABLE ");
orderBy.append(dialect.closeQuote()); if (ob.isDescending) { orderBy.append(" DESC");
orderby.append(dialect.openQuote()) .append(entry.getKey()) .append(dialect.closeQuote()) .append(' ') .append(entry.getValue());
orderBy.append(dialect.closeQuote()); if (ob.isDescending) { orderBy.append(" DESC");
alias = dialect.openQuote() + COL_ALIAS_PREFIX + (i + 1) + dialect.closeQuote(); whatName = getSelectColName(col, key); if (col.getTable().getRealTable() == hier && col.getKey().equals(Model.MAIN_KEY)) { String racl = dialect.openQuote() + READ_ACL_ALIAS + dialect.closeQuote(); String aclrum = dialect.openQuote() + READ_ACL_USER_MAP_ALIAS + dialect.closeQuote(); securityJoins.add(new Join(Join.INNER, Model.HIER_READ_ACL_TABLE_NAME, READ_ACL_ALIAS, null, id, racl + '.' + Model.HIER_READ_ACL_ID)); + dialect.closeQuote(); withTables.add(withTable); Select withSelect = new Select(null); selectFrom += " AS " + dialect.openQuote() + UNION_ALIAS + dialect.closeQuote();