protected Table postprocessTableFromDatabase(Table table) { if (table != null) { for (int columnIdx = 0; columnIdx < table.getColumnCount(); columnIdx++) { Column column = table.getColumn(columnIdx); if (TypeMap.isTextType(column.getMappedTypeCode()) || TypeMap.isDateTimeType(column.getMappedTypeCode())) { String defaultValue = column.getDefaultValue(); if ((defaultValue != null) && (defaultValue.length() >= 2) && defaultValue.startsWith("'") && defaultValue.endsWith("'")) { defaultValue = defaultValue.substring(1, defaultValue.length() - 1); column.setDefaultValue(defaultValue); } } } } return table; }
ArrayList<Column> changedColumnsList = new ArrayList<Column>(); for (int i = 0; i < targetTable.getColumnCount(); i++) { Column column = targetTable.getColumn(i); if (column != null) { if (doesColumnNeedUpdated(i, column, data, rowData, oldData, applyChangesOnly)) {
@Override protected Table readTable(Connection connection, DatabaseMetaDataWrapper metaData, Map<String, Object> values) throws SQLException { Table table = super.readTable(connection, metaData, values); if (table != null) { // PostgreSQL also returns unique indices for non-pk auto-increment // columns which are of the form "[table]_[column]_key" HashMap<String,IIndex> uniquesByName = new HashMap<String,IIndex>(); for (int indexIdx = 0; indexIdx < table.getIndexCount(); indexIdx++) { IIndex index = table.getIndex(indexIdx); if (index.isUnique() && (index.getName() != null)) { uniquesByName.put(index.getName(), index); } } for (int columnIdx = 0; columnIdx < table.getColumnCount(); columnIdx++) { Column column = table.getColumn(columnIdx); if (column.isAutoIncrement() && !column.isPrimaryKey()) { String indexName = table.getName() + "_" + column.getName() + "_key"; if (uniquesByName.containsKey(indexName)) { table.removeIndex((IIndex) uniquesByName.get(indexName)); uniquesByName.remove(indexName); } } } } setPrimaryKeyConstraintName(connection, table); return table; }