Package jimm.datavision.source.sql

Examples of jimm.datavision.source.sql.SQLQuery


    try {
  report.setDatabasePassword(DB_PASSWORD);
  report.read(EXAMPLE_REPORT);

  Database db = (Database)report.getDataSource();
  SQLQuery query = (SQLQuery)db.getQuery();

  assertEquals("{jobs.ID} < 100", query.getWhereClause());
  assertNotNull(db.findColumn("ALL_CAPS.COL1"));
  assertNotNull(db.findColumn("jobs.fk_office_id"));
  assertNotNull(db.findColumn("office.email"));
  assertNotNull(db.findColumn("aggregate_test.value"));

  // We should only have two tables in the query.
  query.findSelectablesUsed();
  assertEquals(2, query.getNumTables());

  db.reset(DRIVER_CLASS_NAME, CONNECTION_INFO, DB_NAME, DB_USER,
     DB_PASSWORD);
  // The query doesn't have to be the same object, but it's where
  // clause (and all other information) should darned well be the same.
  assertEquals("{jobs.ID} < 100", query.getWhereClause());
  assertNotNull(db.findColumn("public.ALL_CAPS.COL1"));
  assertNotNull(db.findColumn("public.jobs.fk_office_id"));
  assertNotNull(db.findColumn("public.office.email"));
  assertNotNull(db.findColumn("public.aggregate_test.value"));

  // Make sure we still have two tables in the query.
  query.findSelectablesUsed();
  assertEquals(2, query.getNumTables());
    }
    catch (Exception e) {
  fail(e.toString());
    }
}
View Full Code Here


    Report report = new Report();
    report.setDatabasePassword(DB_PASSWORD);
    report.read(EXAMPLE_REPORT);

    Database db = (Database)report.getDataSource();
    SQLQuery origQuery = (SQLQuery)db.getQuery();

    db.reset(db.getDriverClassName(), db.getConnectionInfo(), db.getName(),
       db.getUserName(), "");
    SQLQuery q = (SQLQuery)db.getQuery();

    // Unfortunately, we can't just compare query strings. That's because
    // the table and column lists aren't guaranteed to be sorted.
    //
    // At least these tests detect the bug we're fixing.
    assertEquals(origQuery.getNumTables(), q.getNumTables());
    assertEquals(origQuery.getNumSelectables(), q.getNumSelectables());
}
View Full Code Here

TOP

Related Classes of jimm.datavision.source.sql.SQLQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.