Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Nov 1, 2011
1 parent 39d8109 commit 6e56ea8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
Expand Up @@ -4,8 +4,6 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;

import org.jumpmind.symmetric.ddl.Platform;
Expand All @@ -20,19 +18,11 @@ public GreenplumModelReader(Platform platform) {
super(platform);
}

@Override
protected Collection<Table> readTables(Connection connection, String catalog,
String schemaPattern, String[] tableTypes) throws SQLException {
Collection<Table> tables = super.readTables(connection, catalog, schemaPattern, tableTypes);
//setDistributionKeys(connection, tables, schemaPattern);
return tables;
}

protected void setDistributionKeys(Connection connection, Table table,
String schema) throws SQLException {
protected void setDistributionKeys(Connection connection, Table table, String schema)
throws SQLException {

// get the distribution keys for segments
StringBuffer query = new StringBuffer();
StringBuilder query = new StringBuilder();

query.append("select ");
query.append(" t.relname, ");
Expand All @@ -58,7 +48,8 @@ protected void setDistributionKeys(Connection connection, Table table,
prepStmt.setString(2, table.getName());
ResultSet rs = prepStmt.executeQuery();

// for every row, set the distributionKey for the corresponding columns
// for every row, set the distributionKey for the corresponding
// columns
while (rs.next()) {
Column column = table.findColumn(rs.getString(2).trim(), getPlatform()
.isDelimitedIdentifierModeOn());
Expand All @@ -73,10 +64,10 @@ protected void setDistributionKeys(Connection connection, Table table,
}
}
}

@Override
protected Table readTable(Connection connection, DatabaseMetaDataWrapper metaData, Map values) throws SQLException
{
protected Table readTable(Connection connection, DatabaseMetaDataWrapper metaData,
Map<String, Object> values) throws SQLException {
Table table = super.readTable(connection, metaData, values);
setDistributionKeys(connection, table, metaData.getSchemaPattern());
return table;
Expand Down
Expand Up @@ -55,7 +55,7 @@ public PostgreSqlModelReader(Platform platform)
}

@Override
protected Table readTable(Connection connection, DatabaseMetaDataWrapper metaData, Map values) throws SQLException
protected Table readTable(Connection connection, DatabaseMetaDataWrapper metaData, Map<String,Object> values) throws SQLException
{
Table table = super.readTable(connection, metaData, values);

Expand Down

0 comments on commit 6e56ea8

Please sign in to comment.