// ---- First, get the expected results by executing in-memory or from a results file.
ResultSet rs = null ;
if ( item.getResults() != null )
rs = item.getResults().getResultSet() ;
ResultSetRewindable rs1 = null ;
String expectedLabel = "" ;
if ( rs != null )
{
rs1 = ResultSetFactory.makeRewindable(rs) ;
expectedLabel = "Results file" ;
}
else
{
QueryEngineFactory f = QueryEngineRef.getFactory() ;
QueryExecution qExec1 = new QueryExecutionBase(query, ds, null, f) ;
rs1 = ResultSetFactory.makeRewindable(qExec1.execSelect()) ;
qExec1.close() ;
expectedLabel = "Standard engine" ;
}
// ---- Second, execute in DB
QueryEngineFactory f2 = QueryEngineSDB.getFactory() ;
ds = DatasetStore.create(store) ;
QueryExecution qExec2 = new QueryExecutionBase(query, ds, null, f2) ;
try {
SDBConnection.logSQLExceptions = true ;
rs = qExec2.execSelect() ;
ResultSetRewindable rs2 = ResultSetFactory.makeRewindable(rs) ;
boolean b = ResultSetCompare.equalsByTerm(rs1, rs2) ;
if ( !b )
{
rs1.reset() ;
rs2.reset() ;
System.out.println("------------------- "+this.getName());
System.out.printf("**** Expected (%s)", expectedLabel) ;
ResultSetFormatter.out(System.out, rs1) ;
System.out.println("**** Got (SDB engine)") ;
ResultSetFormatter.out(System.out, rs2) ;