// query table containing XML metadata
SeSqlConstruct sqlConstruct = new SeSqlConstruct();
String[] tables = {METADATA_TABLE };
sqlConstruct.setTables(tables);
String[] propertyNames = { METADATA_COLUMN };
SeQuery query = new SeQuery(seConnection);
query.prepareQuery(propertyNames, sqlConstruct);
query.execute();
// it is not documented in the ArcSDE API how you know there are no more rows to fetch!
// I'm assuming: query.fetch returns null (empiric tests indicate this assumption is correct).
boolean allRowsFetched = false;
while(! allRowsFetched) {
SeRow row = query.fetch();
if(row != null) {
ByteArrayInputStream bytes = row.getBlob(0);
byte [] buff = new byte[bytes.available()];
bytes.read(buff);
String document = new String(buff, Constants.ENCODING);
if(document.contains(ISO_METADATA_IDENTIFIER)) {
System.out.println("ISO metadata found");
results.add(document);
}
}
else {
allRowsFetched = true;
}
}
query.close();
System.out.println("cool");
return results;
}
catch(SeException x) {
SeError error = x.getSeError();