ResultSet rs = databaseMetaData.getColumns(localCatalog, localSchema,
localTableName, null);
while (rs.next()) {
IntrospectedColumn introspectedColumn = ObjectFactory
.createIntrospectedColumn(context);
introspectedColumn.setTableAlias(tc.getAlias());
introspectedColumn.setJdbcType(rs.getInt("DATA_TYPE")); //$NON-NLS-1$
introspectedColumn.setLength(rs.getInt("COLUMN_SIZE")); //$NON-NLS-1$
introspectedColumn.setActualColumnName(rs.getString("COLUMN_NAME")); //$NON-NLS-1$
introspectedColumn
.setNullable(rs.getInt("NULLABLE") == DatabaseMetaData.columnNullable); //$NON-NLS-1$
introspectedColumn.setScale(rs.getInt("DECIMAL_DIGITS")); //$NON-NLS-1$
introspectedColumn.setRemarks(rs.getString("REMARKS")); //$NON-NLS-1$
introspectedColumn.setDefaultValue(rs.getString("COLUMN_DEF")); //$NON-NLS-1$
ActualTableName atn = new ActualTableName(
rs.getString("TABLE_CAT"), //$NON-NLS-1$
rs.getString("TABLE_SCHEM"), //$NON-NLS-1$
rs.getString("TABLE_NAME")); //$NON-NLS-1$
List<IntrospectedColumn> columns = answer.get(atn);
if (columns == null) {
columns = new ArrayList<IntrospectedColumn>();
answer.put(atn, columns);
}
columns.add(introspectedColumn);
if (logger.isDebugEnabled()) {
logger.debug(getString(
"Tracing.2", //$NON-NLS-1$
introspectedColumn.getActualColumnName(), Integer
.toString(introspectedColumn.getJdbcType()),
atn.toString()));
}
}
closeResultSet(rs);