new String[] {
"create table if not exists 'whitelist' (ip unique)",
"create table if not exists 'graylist' (ip,fromaddr,toaddr,date, primary key(ip,fromaddr,toaddr))"
- },
- "graylist",
- "date");
+ });
+ reap("graylist", "date");
}
public synchronized void addWhitelist(InetAddress ip) {
Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:"+filename);
conn.prepareStatement("create virtual table if not exists "+
- "'mail' using FTS1("+columns+",PRIMARY KEY(messageid_))").executeUpdate();
+ "'mail' using FTS2("+columns+",PRIMARY KEY(messageid_))").executeUpdate();
}
catch (SQLException e) { throw new RuntimeException(e); }
catch (ClassNotFoundException e) { throw new RuntimeException(e); }
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");
}
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)
"create table if not exists 'whitelist' (email)",
"create table if not exists 'pending' (spamid,email,message,date)"
},
- true,
- "pending",
- "date");
+ true);
+ reap("pending", "date");
}
public boolean handleRequest(org.ibex.net.Connection c) {