use of org.dbunit.dataset.ITableMetaData in project nextprot-api by calipho-sib.
the class FlatXmlDataSetExtractor method toString.
public String toString() {
StringBuilder sb = new StringBuilder();
try {
for (String tableName : ds.getTableNames()) {
sb.append("Table:").append(tableName).append("\n");
ITable table = ds.getTable(tableName);
for (int i = 0; i < table.getRowCount(); i++) {
ITableMetaData md = table.getTableMetaData();
sb.append(" ");
for (Column col : md.getColumns()) {
sb.append(col.getColumnName()).append(": ").append(table.getValue(i, col.getColumnName()));
sb.append(", ");
}
sb.delete(sb.length() - 2, sb.length());
sb.append("\n");
}
}
} catch (DataSetException e) {
sb.append("Error: ").append(e.getMessage());
}
return sb.toString();
}
use of org.dbunit.dataset.ITableMetaData in project sharding-jdbc by shardingjdbc.
the class SQLAssertHelper method createTable.
private CachedResultSetTable createTable(final String tableName, final PreparedStatement preparedStatement, final IDatabaseConnection connection) throws SQLException, DataSetException {
preparedStatement.execute();
ResultSet rs = preparedStatement.getResultSet();
ITableMetaData metaData = new ResultSetTableMetaData(tableName, rs, connection, false);
ForwardOnlyResultSetTable table = new ForwardOnlyResultSetTable(metaData, rs);
return new CachedResultSetTable(table);
}
Aggregations