queryColumns = cols.toArray(new String[cols.size()]);
}
// fullConstruct may hold information about multiple tables in case of an
// in-process view
final SeSqlConstruct fullConstruct = filters.getQueryInfo(queryColumns)
.getConstruct();
String whereClause = fullConstruct.getWhere();
if (whereClause == null) {
/*
* we really need a where clause or will get a famous -51 DATABASE LEVEL
* ERROR with no other explanation on some oracle databases
*/
whereClause = "1 = 1";
}
final SeFilter[] spatialConstraints = filters.getSpatialFilters();
SeExtent extent;
final SeQuery extentQuery = new SeQuery(connection);
try {
versioningHandler.setUpStream(session, extentQuery);
if (spatialConstraints.length > 0) {
extentQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
spatialConstraints);
}
SeSqlConstruct sqlCons = new SeSqlConstruct();
sqlCons.setTables(fullConstruct.getTables());
sqlCons.setWhere(whereClause);
final SeQueryInfo seQueryInfo = new SeQueryInfo();
seQueryInfo.setColumns(queryColumns);
seQueryInfo.setConstruct(sqlCons);
extent = extentQuery.calculateLayerExtent(seQueryInfo);
} finally {
extentQuery.close();
}
return extent;
}
});
} catch (IOException ex) {
SeSqlConstruct sqlCons = this.filters.getSeSqlConstruct();
String sql = (sqlCons == null) ? null : sqlCons.getWhere();
String tables = (sqlCons == null) ? null : Arrays.asList(sqlCons.getTables())
.toString();
if (ex.getCause() instanceof SeException) {
SeException sdeEx = (SeException) ex.getCause();
if (sdeEx.getSeError().getSdeError() == -288) {
// gah, the dreaded 'LOGFILE SYSTEM TABLES DO NOT EXIST'