factor reap() out of SqliteTable constructor
[org.ibex.mail.git] / src / org / ibex / mail / SqliteTable.java
index 98950f6..4d32c90 100644 (file)
@@ -27,11 +27,10 @@ public class SqliteTable {
         conn.prepareStatement("PRAGMA cache_size="+Math.ceil(kilobytes/1.5)+";").executeUpdate();
     }
 
-    public SqliteTable(String filename, String[] tables, String reapTable, String reapColumn) {
-        this(filename, tables, false, reapTable, reapColumn);
+    public SqliteTable(String filename, String[] tables) {
+        this(filename, tables, false);
     }
-    public SqliteTable(String filename, String[] tables, boolean fastButDangerous,
-                       String reapTable, String reapColumn) {
+    public SqliteTable(String filename, String[] tables, boolean fastButDangerous) {
         this.filename = filename;
         try {
             Class.forName("org.sqlite.JDBC");
@@ -46,6 +45,11 @@ public class SqliteTable {
         }
         catch (SQLException e) { throw new RuntimeException(e); }
         catch (ClassNotFoundException e) { throw new RuntimeException(e); }
+    }
+
+    protected void reap(String reapTable, String reapColumn) {
+        if (this.reapTable != null || this.reapColumn != null)
+            throw new RuntimeException("reapTable/reapColumn already set");
         this.reapTable = reapTable;
         this.reapColumn = reapColumn;
         if (reapTable != null && reapColumn != null)