/** * Creates a table as an alias for another one. */ public TableAlias(Table table, String alias) { this.table = table; this.alias = alias; dialect = table.getDialect(); }
public Insert(Table table) { this.table = table; dialect = table.getDialect(); columns = new LinkedList<>(); }
public String getStatement() { StringBuilder buf = new StringBuilder(128); buf.append("UPDATE "); buf.append(table.getQuotedName()); buf.append(" SET "); buf.append(newValues); if (from != null) { buf.append(" FROM "); if (table.getDialect().doesUpdateFromRepeatSelf()) { buf.append(table.getQuotedName()); buf.append(", "); } buf.append(StringUtils.join(from, ", ")); } if (where != null) { buf.append(" WHERE "); buf.append(where); } else { throw new IllegalArgumentException("unexpected empty WHERE"); } return buf.toString(); } }
public static Column addColumn(Table table, String fieldName, ColumnType type, boolean nativeCase) { String physicalName = table.getDialect().getColumnName(fieldName); if (!nativeCase && fieldName.length() == physicalName.length()) { // we can keep the name specified in the config physicalName = fieldName; } Column column = new Column(table, physicalName, type, fieldName); return ((TableImpl) table).addColumn(fieldName, column); }
public ArraySubQueryPostgreSQL(Column arrayColumn, String alias) { super(arrayColumn, alias); dialect = arrayColumn.getTable().getDialect(); fakeSubqueryTableAlias = new TableAlias(arrayColumn.getTable(), alias); }
/** * 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); }