}
if (!postCreationInit(con)) {
-
+ return false;
}
return true;
}
+ public void purge(Connection con) throws SQLException {
+ dropAllTables(con);
+ dropAllSequences(con);
+ }
+
boolean postCreationInit(Connection con) throws SQLException {
// no-op
// Override this in a derived class if you need to initialize something
return true;
}
+ void dropAllTables(Connection con) {
+ for (Table table : m_tables) {
+ try {
+ m_driver.dropTable(con, table);
+ }
+ catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
boolean createAllSequences(Connection con) throws SQLException {
for (Sequence seq : m_sequences) {
if (!m_driver.createSequence(con, seq)) {
return true;
}
+ void dropAllSequences(Connection con) {
+ for (Sequence seq : m_sequences) {
+ try {
+ m_driver.dropSequence(con, seq);
+ }
+ catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
void addTable(Table table) {
m_tables.add(table);
}