use of org.polymap.recordstore.ResultSet in project polymap4-core by Polymap4.
the class RDataStore method deleteSchema.
public void deleteSchema(FeatureType schema, IProgressMonitor monitor) {
// remove features
try {
RFeatureStore fs = (RFeatureStore) getFeatureSource(schema.getName());
fs.removeFeatures(Filter.INCLUDE);
} catch (Exception e) {
log.debug("", e);
throw new RuntimeException(e);
}
// remove schema
Updater tx = store.prepareUpdate();
try {
ResultSet rs = store.find(new SimpleQuery().setMaxResults(1).eq("type", "FeatureType").eq("name", schema.getName().getLocalPart()).eq("namespace", schema.getName().getNamespaceURI()));
assert rs.count() == 1 : "Illegal number of schemas found: " + rs.count();
tx.remove(rs.get(0));
tx.apply();
} catch (Throwable e) {
log.debug("", e);
tx.discard();
throw new RuntimeException(e);
}
}
use of org.polymap.recordstore.ResultSet in project polymap4-core by Polymap4.
the class AbstractRecordStoreTest method queryRecords.
protected void queryRecords(int loops) throws Exception {
final Timer timer = new Timer();
int found = 0;
for (int i = 0; i < loops; i++) {
// RecordQuery query = new SimpleQuery()
// .eq( TestRecord.TYPE.count.name(), String.valueOf( i ) )
// .eq( TestRecord.TYPE.type.name(), "2" )
// .setMaxResults( 1 );
SimpleQuery query = new SimpleQuery().setMaxResults(1);
TestRecord template = new TestRecord(query);
template.count.put(i);
template.type.put("2");
ResultSet result = store.find(query);
// assertTrue( result.count() == 0);
if (result.count() > 0) {
found++;
}
// TestRecord record = new TestRecord( result.get( 0 ) );
// dummy = record.type.get();
}
log.info("Records queried: " + found + " in " + timer.elapsedTime() + "ms -> " + (double) timer.elapsedTime() / loops + "ms/loop");
store.close();
}
Aggregations