private Connection conn;
private static final String columns =
" messageid_, from_,to_,date_,subject_,headers_,body_,flags_";
-
+ private static final String[] indexedColumns = new String[] {
+ "uid_",
+ "messageid_",
+ "flags_",
+ /*
+ "from_",
+ "to_",
+ "subject_",
+ "date_"
+ */
+ };
+
/**
* from http://www.sqlite.org/autoinc.html
* "If a column has the type INTEGER PRIMARY KEY AUTOINCREMENT
* allowed and any attempt to insert a new row will fail with an
* SQLITE_FULL error.
*/
+ // FIXME: should messageid_ be decared unique?
private static final String columns_ =
"uid_ INTEGER PRIMARY KEY AUTOINCREMENT, messageid_ unique,from_,to_,date_,subject_,headers_,body_,flags_";
} else {
this.uidValidity = rs.getInt(1);
}
- try {
- //conn.prepareStatement("create virtual table 'mail' using FTS2("+columns_+")").executeUpdate();
- conn.prepareStatement("create table 'mail' ("+columns_+")").executeUpdate();
- } catch (SQLException e) {
- /* FIXME */
- }
- conn.prepareStatement("create index if not exists uid_index on mail(uid_);").executeUpdate();
+ conn.prepareStatement("create table if not exists 'mail' ("+columns_+")").executeUpdate();
+ for(String name : indexedColumns)
+ conn.prepareStatement("create index if not exists "+name+"index on mail("+name+");").executeUpdate();
}
catch (SQLException e) { throw new RuntimeException(e); }
catch (ClassNotFoundException e) { throw new RuntimeException(e); }