Restructure database code.
[cfb.git] / prod / net / jaekl / cfb / db / Schema.java
index f802b58ca3cf71f89f7b5ef6c8b0f57c95382c66..4937fae153eae94dacf8c051c8c49d07b7775892 100644 (file)
@@ -40,6 +40,17 @@ public class Schema {
                        return false;
                }
                
+               if (!postCreationInit(con)) {
+                       
+               }
+               
+               return true;
+       }
+       
+       boolean postCreationInit(Connection con) throws SQLException {
+               // no-op
+               // Override this in a derived class if you need to initialize something 
+               // after the tables and sequences are created.
                return true;
        }
        
@@ -98,14 +109,20 @@ public class Schema {
        //   { table_name },
        //   { column_name, type, width (-1 for default), null/not_null }
        // }
-       void addTables(Object[][][] tables) 
+       void addTables(Table[] tables) 
        {
-               for (Object[][] table : tables) {
-                       addTable(Table.construct(table));
+               for (Table table : tables) {
+                       addTable(table);
                }
        }
        
        void addSequence(Sequence seq) {
                m_sequences.add(seq);
        }
+       
+       void addSequences(Sequence[] sequences) {
+               for (Sequence sequence : sequences) {
+                       addSequence(sequence);
+               }
+       }
 }