Skip to content

Commit

Permalink
0000869: dbexport to csv needs to either prevent or support multiple …
Browse files Browse the repository at this point in the history
…table export
  • Loading branch information
chenson42 committed Oct 26, 2012
1 parent 4ece2f4 commit b876248
Showing 1 changed file with 0 additions and 36 deletions.
Expand Up @@ -52,7 +52,6 @@
import org.jumpmind.db.sql.JdbcSqlTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.support.JdbcUtils;

/*
* An utility class to create a Database model from a live database.
Expand Down Expand Up @@ -557,41 +556,6 @@ public Table execute(Connection connection) throws SQLException {

}

public Table readTable(final String catalog, final String schema, final String tableName,
final String sql) {
JdbcSqlTemplate sqlTemplate = (JdbcSqlTemplate) platform.getSqlTemplate();
return postprocessTableFromDatabase(sqlTemplate.execute(new IConnectionCallback<Table>() {
public Table execute(Connection connection) throws SQLException {
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery(sql);
try {
st = connection.createStatement();
rs = st.executeQuery(sql);
ResultSetMetaData rsm = rs.getMetaData();
Table table = new Table();
table.setCatalog(catalog);
table.setSchema(schema);
table.setName(tableName);
for (int i = 1; i <= rsm.getColumnCount(); i++) {
Column column = new Column(rsm.getColumnName(i));
column.setMappedTypeCode(rsm.getColumnType(i));
column.setJdbcTypeCode(rsm.getColumnType(i));
column.setJdbcTypeName(column.getMappedType());
column.setRequired(rsm.isNullable(i) == 0);
column.setScale(rsm.getScale(i));
column.setPrecisionRadix(rsm.getPrecision(i));
column.setAutoIncrement(rsm.isAutoIncrement(i));
table.addColumn(column);
}
return table;
} finally {
JdbcUtils.closeResultSet(rs);
JdbcUtils.closeStatement(st);
}
}
}));
}

protected Table postprocessTableFromDatabase(Table table) {
if (table != null) {
for (int columnIdx = 0; columnIdx < table.getColumnCount(); columnIdx++) {
Expand Down

0 comments on commit b876248

Please sign in to comment.