// Get the properties definition.
ResultSetMetaData meta = rs.getMetaData();
int propsSize = meta.getColumnCount();
SQLDataSet.this.setPropertySize(propsSize);
for (int i = 0; i < propsSize; i++) {
SQLDataProperty dp = createSQLProperty();
String propId = StringUtils.isNotBlank(meta.getColumnLabel(i + 1)) ? meta.getColumnLabel(i + 1) : meta.getColumnName(i + 1);
dp.setPropertyId(propId.toLowerCase());
// dp.setPropertyId(meta.getColumnName(i + 1).toLowerCase());
dp.setType(meta.getColumnType(i + 1));
dp.setTableName(meta.getTableName(i + 1));
dp.setColumnName(meta.getColumnName(i + 1));
addProperty(dp, i);
}
// Get rows and populate the data set values.
int index = 0;
while (rs.next()) {
Object[] row = new Object[propsSize];
for (int i = 0; i < propsSize; i++) row[i] = rs.getObject(i + 1);
SQLDataSet.this.addRowValues(row);
// Check load constraints (every 10,000 rows)
if (++index == 10000) {
trace.checkRuntimeConstraints();
index = 0;
}
}
// Once we got the dataset initialized then calculate the domain for each property.
for (int i = 0; i < properties.length; i++) {
SQLDataProperty property = (SQLDataProperty) properties[i];
property.calculateDomain();
}
}
catch (Exception e) {
if (lastExecutedStmt != null) {
log.error("Error in load() SQLDataset. SQL = " + lastExecutedStmt.getSQLSentence(), e);