ResultSet rs = dmd.getTables(null, null, null, tableTypes);
HashSet<String> tables = new HashSet<String>();
while (rs.next()) tables.add(rs.getString("TABLE_NAME"));
rs.close();
ISetWriter setRes = vf.setWriter(Table);
for (String tableName : tables) {
rs = dmd.getColumns(null, null, tableName, null);
IListWriter listRes = vf.listWriter(Column);
while (rs.next()) {
String cn = rs.getString("COLUMN_NAME");
int dt = rs.getInt("DATA_TYPE");
String nullable = rs.getString("IS_NULLABLE");
listRes.append(vf.constructor(column, vf.string(cn), vf.constructor(JDBC.jdbc2rascalType(dt)), nullable.equalsIgnoreCase("YES") ? vf.bool(true) : vf.bool(false)));
}
setRes.insert(vf.constructor(table, vf.string(tableName), listRes.done()));
rs.close();
}
return setRes.done();
} else {
throw RuntimeExceptionFactory.illegalArgument(connection, null, null, "Connection does not exist.");
}
} catch (SQLException sqle) {
throw RuntimeExceptionFactory.illegalArgument(connection, null, null, addMessage("Could not close the given connection", sqle));