+ /*
+ public void dump(OutputStream os) {
+ }
+ */
+
+ public class SqliteTable {
+ public final String name;
+ private String reapColumn = null;
+ private SqliteTable(String name, String schema) throws SQLException {
+ this.name = name;
+ PreparedStatement ps = conn.prepareStatement("create table if not exists " + name + " " + schema);
+ ps.executeUpdate();
+ tables.put(name, this);
+ }
+ public void createIndex(String column) throws SQLException { createIndex(column, column+"_index"); }
+ public void createIndex(String indexName, String column) throws SQLException {
+ PreparedStatement ps = conn.prepareStatement("create index if not exists "+column+" on "+name+" ("+indexName+")");
+ ps.executeUpdate();
+ }
+ protected void reap(String reapColumn) {
+ if (this.reapColumn != null) throw new RuntimeException("reapColumn already set");
+ this.reapColumn = reapColumn;
+ Main.cron.executeLater(1000 * REAPER_INTERVAL_SECONDS, new Reaper(name, reapColumn));
+ }
+ }