ResultSet resultSet;
QueryExecution sdbQueryExecution, d2rqQueryExecution;
List<? extends Object> sdbDataResult; // Statement or Binding
List<? extends Object> hsqlDataResult; // Statement or Binding
List<SortCondition> sortingConditions;
SortCondition sortCondition;
Var var;
List<Query> queries;
int hsqlResultSize, sdbResultSize;
Object sdbResultEntry, hsqlResultEntry;
boolean entriesEqual;
Model sdbModel, d2rqModel;
try
{
System.out.println("Searching for Query-Files!");
queries = loadAllQueries();
System.out.println("Loaded " + queries.size() + " Queries from Queries-Directory: " + CURR_DIR + "/" + QUERY_DIR);
for (Query query: queries) {
System.out.println("--------------------------------------------------------------------------------------");
System.out.println("Executing Query: ");
System.out.println(query);
// now execute the query against the sdb-datamodel
System.out.println("Querying SDB-Data-Model!");
sdbQueryExecution = QueryExecutionFactory.create(query, this.sdbDataModel);
// now execute the query against the hsql-datamodel
System.out.println("Querying HSQL-Data-Model!");
d2rqQueryExecution = QueryExecutionFactory.create(query, this.hsqlDataModel);
// Check for SELECT-Queries
if (query.isSelectType())
{
resultSet = sdbQueryExecution.execSelect();
// sorting
// both results (sdbDataResult, mysqlDataResult) must have the same order
// for equality-checking
// create an sort-order that will be used for both results
sortingConditions = new ArrayList<SortCondition>();
for (String varName: resultSet.getResultVars()) {
var = Var.alloc(varName);
sortCondition = new SortCondition(var, Query.ORDER_DEFAULT);
sortingConditions.add(sortCondition);
}
List<Binding> sdbSelectResult = new ArrayList<Binding>();
List<Binding> hsqlSelectResult = new ArrayList<Binding>();