projects
/
org.ibex.mail.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2e7880f
)
SqliteMailbox: index columns
author
adam
<adam@megacz.com>
Sat, 1 Mar 2008 06:02:15 +0000
(06:02 +0000)
committer
adam
<adam@megacz.com>
Sat, 1 Mar 2008 06:02:15 +0000
(06:02 +0000)
darcs-hash:
20080301060215
-5007d-
9ca704f66e1582a11798e0050b653b2f21900e7a
.gz
src/org/ibex/mail/SqliteMailbox.java
patch
|
blob
|
history
diff --git
a/src/org/ibex/mail/SqliteMailbox.java
b/src/org/ibex/mail/SqliteMailbox.java
index
c423fef
..
0d80532
100644
(file)
--- a/
src/org/ibex/mail/SqliteMailbox.java
+++ b/
src/org/ibex/mail/SqliteMailbox.java
@@
-22,7
+22,18
@@
public class SqliteMailbox extends Mailbox.Default implements MailTree {
private Connection conn;
private static final String columns =
" messageid_, from_,to_,date_,subject_,headers_,body_,flags_";
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
/**
* from http://www.sqlite.org/autoinc.html
* "If a column has the type INTEGER PRIMARY KEY AUTOINCREMENT
@@
-35,6
+46,7
@@
public class SqliteMailbox extends Mailbox.Default implements MailTree {
* allowed and any attempt to insert a new row will fail with an
* SQLITE_FULL error.
*/
* 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_";
private static final String columns_ =
"uid_ INTEGER PRIMARY KEY AUTOINCREMENT, messageid_ unique,from_,to_,date_,subject_,headers_,body_,flags_";
@@
-57,13
+69,9
@@
public class SqliteMailbox extends Mailbox.Default implements MailTree {
} else {
this.uidValidity = rs.getInt(1);
}
} 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); }
}
catch (SQLException e) { throw new RuntimeException(e); }
catch (ClassNotFoundException e) { throw new RuntimeException(e); }