@Test public void test() { Connection conn = dbResource.getConnection(); DBDatabaseDriver driver = dbResource.newDriver(); CompanyDB db = new CompanyDB(); db.open(driver, dbResource.getConnection()); DBSQLScript script = new DBSQLScript(); db.getCreateDDLScript(db.getDriver(), script); script.executeAll(db.getDriver(), dbResource.getConnection(), false); DBRecord dep = new DBRecord(); dep.create(db.DEPARTMENT); dep.setValue(db.DEPARTMENT.NAME, "junit"); dep.setValue(db.DEPARTMENT.BUSINESS_UNIT, "test"); dep.update(conn); Date date = dep.getDateTime(db.DEPARTMENT.UPDATE_TIMESTAMP); assertNotNull("Date is null", date); assertTrue("No departments", dep.getInt(db.DEPARTMENT.ID) > 0); DBRecord emp = new DBRecord(); emp.create(db.EMPLOYEE); emp.setValue(db.EMPLOYEE.FIRSTNAME, "junit"); emp.setValue(db.EMPLOYEE.LASTNAME, "test"); emp.setValue(db.EMPLOYEE.GENDER, "m"); emp.setValue(db.EMPLOYEE.DEPARTMENT_ID, dep.getInt(db.DEPARTMENT.ID)); emp.update(conn); date = emp.getDateTime(db.EMPLOYEE.UPDATE_TIMESTAMP); assertNotNull("Date is null", date); assertTrue("Employee id O or less", emp.getInt(db.EMPLOYEE.ID) > 0); int id = emp.getInt(db.EMPLOYEE.ID); emp = new DBRecord(); emp.read(db.EMPLOYEE, id, conn); emp.setValue(db.EMPLOYEE.PHONE_NUMBER, "123456"); emp.update(conn); emp = new DBRecord(); emp.read(db.EMPLOYEE, id, conn); assertEquals("123456", emp.getString(db.EMPLOYEE.PHONE_NUMBER)); script = new DBSQLScript(); db.getDriver().getDDLScript(DBCmdType.DROP, db.EMPLOYEE, script); db.getDriver().getDDLScript(DBCmdType.DROP, db.DEPARTMENT, script); script.executeAll(db.getDriver(), conn, true); }
@Override public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script) { if (ddlGenerator==null) ddlGenerator = new HSqlDDLGenerator(this); ddlGenerator.getDDLScript(type, dbo, script); }
DBDatabaseDriverHSql extends DBDatabaseDriver { @Override public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script) { if (ddlGenerator==null) ddlGenerator = new HSqlDDLGenerator(this); ddlGenerator.getDDLScript(type, dbo, script); } }
DBDatabaseDriverHSql extends DBDatabaseDriver { @Override public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script) { if (ddlGenerator==null) ddlGenerator = new HSqlDDLGenerator(this); ddlGenerator.getDDLScript(type, dbo, script); } DBDatabaseDriverHSql(); }
DBDatabaseDriverHSql extends DBDatabaseDriver { @Override public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script) { if (ddlGenerator==null) ddlGenerator = new HSqlDDLGenerator(this); ddlGenerator.getDDLScript(type, dbo, script); } DBDatabaseDriverHSql(); @Override DBCommand createCommand(DBDatabase db); @Override boolean isSupported(DBDriverFeature type); @Override String getSQLPhrase(int phrase); @Override String getConvertPhrase(DataType destType, DataType srcType, Object format); @Override Object getNextSequenceValue(DBDatabase db, String seqName, int minValue, Connection conn); @Override DBColumnExpr getNextSequenceValueExpr(DBTableColumn column); @Override java.sql.Timestamp getUpdateTimestamp(Connection conn); @Override void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script); }
DBDatabaseDriverHSql extends DBDatabaseDriver { @Override public void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script) { if (ddlGenerator==null) ddlGenerator = new HSqlDDLGenerator(this); ddlGenerator.getDDLScript(type, dbo, script); } DBDatabaseDriverHSql(); @Override DBCommand createCommand(DBDatabase db); @Override boolean isSupported(DBDriverFeature type); @Override String getSQLPhrase(int phrase); @Override String getConvertPhrase(DataType destType, DataType srcType, Object format); @Override Object getNextSequenceValue(DBDatabase db, String seqName, int minValue, Connection conn); @Override DBColumnExpr getNextSequenceValueExpr(DBTableColumn column); @Override java.sql.Timestamp getUpdateTimestamp(Connection conn); @Override void getDDLScript(DBCmdType type, DBObject dbo, DBSQLScript script);  }