* @return a Data object
* @throws java.sql.SQLException
*/
private Data getDataFromResultSet(ResultSet rs) throws SQLException {
ResultSetMetaData meta = rs.getMetaData();
Data data = new Data();
int numColumns = meta.getColumnCount();
String[] dbCols = new String[numColumns];
for (int i = 0; i < numColumns; i++) {
dbCols[i] = meta.getColumnName(i + 1);
data.addHeader(dbCols[i]);
}
while (rs.next()) {
data.next();
for (int i = 0; i < numColumns; i++) {
Object o = rs.getObject(i + 1);
if (o instanceof byte[]) {
o = new String((byte[]) o);
}
data.addColumnValue(dbCols[i], o);
}
}
return data;
}