*/
public synchronized ITableInfo[] getTables(String catalog, String schemaPattern, String tableNamePattern,
String[] types, ProgressCallBack progressCallBack) throws SQLException
{
final DatabaseMetaData md = privateGetJDBCMetaData();
final String dbDriverName = getDriverName();
Set<ITableInfo> list = new TreeSet<ITableInfo>();
/* work-around for this driver, which must have "dbo" for schema. The
* JConnect family of drivers appears to not be affected and can accept a
* null schema, which is necessary to find tables in other schemas, within
* the same catalog. Similarly, jTDS 1.2.2 doesn't require this, yet it
* doesn't return non-dbo schema tables, unfortunately.
*/
if (dbDriverName.equals(IDriverNames.FREE_TDS) && schemaPattern == null)
{
schemaPattern = "dbo";
}
if (dbDriverName.equals(IDriverNames.AS400) && schemaPattern == null)
{
schemaPattern = "*ALLUSR";
}
// Add begin
if (catalog == null && DriverMatch.isComHttxDriver(_conn))
{
String[] catalogs = getCatalogs();
if (catalogs != null)
{
for (int i = 0; i < catalogs.length; i++)
{
ITableInfo[] tables =
getTables(catalogs[i], schemaPattern, tableNamePattern, types, progressCallBack);
for (int j = 0; j < tables.length; j++)
{
list.add(tables[j]);
}
}
return list.toArray(new ITableInfo[list.size()]);
}
}
// Add end
Map<String, ITableInfo> nameMap = null;
ResultSet superTabResult = null;
ResultSet tabResult = null;
try
{
if (supportsSuperTables)
{
try
{
superTabResult = md.getSuperTables(catalog, schemaPattern, tableNamePattern);
// create a mapping of names if we have supertable info, since
// we need to find the ITableInfo again for re-ordering.
if (superTabResult != null && superTabResult.next())
{
nameMap = new HashMap<String, ITableInfo>();
}
}
catch (Throwable th)
{
s_log.debug("DBMS/Driver doesn't support getSupertables(): " + th.getMessage());
supportsSuperTables = false;
}
}
// store all plain table info we have.
tabResult = md.getTables(catalog, schemaPattern, tableNamePattern, types);
int count = 0;
while (tabResult != null && tabResult.next())
{
ITableInfo tabInfo =
new TableInfo(tabResult.getString(1), tabResult.getString(2), tabResult.getString(3),