final List<ObjectTreeNode> list = new ArrayList<ObjectTreeNode>();
if (session.getProperties().getLoadSchemasCatalogs())
{
final ISQLConnection conn = session.getSQLConnection();
final SQLDatabaseMetaData md = conn.getSQLMetaData();
// Add table types to list.
if (_tableTypes.length > 0)
{
for (int i = 0; i < _tableTypes.length; ++i)
{
IDatabaseObjectInfo dbo = new DatabaseObjectInfo(catalogName,
schemaName, _tableTypes[i],
DatabaseObjectType.TABLE_TYPE_DBO, md);
ObjectTreeNode child = new ObjectTreeNode(session, dbo);
list.add(child);
}
}
else
{
s_log.debug("List of table types is empty so trying null table type to load all tables");
IDatabaseObjectInfo dbo = new DatabaseObjectInfo(catalogName,
schemaName, null,
DatabaseObjectType.TABLE_TYPE_DBO, md);
ObjectTreeNode child = new ObjectTreeNode(session, dbo);
child.setUserObject("TABLE");
list.add(child);
}
// Add stored proc parent node.
boolean supportsStoredProcs = false;
try
{
supportsStoredProcs = md.supportsStoredProcedures();
}
catch (SQLException ex)
{
s_log.debug("DBMS doesn't support 'supportsStoredProcedures()'", ex);
}