Package jimm.datavision.source.sql

Examples of jimm.datavision.source.sql.Database


* is reset.
*
* @param conn a database connection
*/
public void setDatabaseConnection(Connection conn) throws SQLException {
    dataSource = new Database(conn, this);
    databasePassword = ""// So user won't be asked for password
}
View Full Code Here


    this.designer = designer;
    this.report = report;

    subreport = new Subreport(report, null);
    Database db = (Database)report.getDataSource();
    subreport.setDataSource(new SubreportDatabase(db.getConnection(),
              subreport));
    subreport.read(f);
    subreport.addAllJoins(newJoins);
}
View Full Code Here

    this.username = (username == null) ? "" : username;
    this.password = password;
}

public void perform() {
    Database db = origDatabase;
    try {
  if (db == null) {
      db = new Database(driverClassName, connInfo, report, dbName,
            username, password);
      report.setDataSource(db);
  }
  else {
      db.reset(driverClassName, connInfo, dbName, username, password);
  }
    }
    catch (Exception e) {
  ErrorHandler.error(e, I18N.get("DbConnWin.connect_error"));
    }
View Full Code Here

    new FocusSetter(driverClassNameField);
}

protected JPanel buildEditor() {
    Database db = (Database)report.getDataSource();
    EditFieldLayout efl = new EditFieldLayout();
    efl.setBorder(20);

    driverClassNameField =
  efl.addTextField(I18N.get("DbConnWin.driver_class_name"), db == null
       ? "" : db.getDriverClassName(), TEXT_FIELD_COLS);
    connInfoField = efl.addTextField(I18N.get("DbConnWin.connection_info"),
             db == null ? "" : db.getConnectionInfo(),
             TEXT_FIELD_COLS);
    dbNameField = efl.addTextField(I18N.get("DbConnWin.database_name"),
           db == null ? "" : db.getName(),
           TEXT_FIELD_COLS);
    userNameField = efl.addTextField(I18N.get("DbConnWin.user_name"),
             db == null ? "" : db.getUserName(),
             TEXT_FIELD_COLS);
    String password = (db == null ? "" : db.getPassword());
    if (password == null) password = "";
    passwordField = efl.addPasswordField(I18N.get("DbConnWin.password"),
           password, TEXT_FIELD_COLS);

    // Click to copy info from another report
View Full Code Here

    return efl.getPanel();
}

protected void fillEditFields() {
    Database db = (Database)report.getDataSource();
    if (db == null) {
  driverClassNameField.setText("");
  connInfoField.setText("");
  dbNameField.setText("");
  userNameField.setText("");
    }
    else {
  driverClassNameField.setText(db.getDriverClassName());
  connInfoField.setText(db.getConnectionInfo());
  dbNameField.setText(db.getName());
  userNameField.setText(db.getUserName());
    }
    passwordField.setText("");
}
View Full Code Here

    Report report = new Report();
    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());
    }
View Full Code Here

public void testDatabaseReset() throws Exception {
    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.
View Full Code Here

TOP

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

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.