From 06d1018911eb66f68543d230d8f5ed48301f5885 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 17 Mar 2007 09:02:45 +0000 Subject: [PATCH] add fastButDangerous to SqliteTable darcs-hash:20070317090245-5007d-82f91cc9d11d57861265bb003698da62e0a60bc8.gz --- src/org/ibex/mail/SqliteTable.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/org/ibex/mail/SqliteTable.java b/src/org/ibex/mail/SqliteTable.java index 085a9b6..91dcb53 100644 --- a/src/org/ibex/mail/SqliteTable.java +++ b/src/org/ibex/mail/SqliteTable.java @@ -19,12 +19,21 @@ public class SqliteTable { private String reapColumn; public SqliteTable(String filename, String[] tables, String reapTable, String reapColumn) { + this(filename, tables, false, reapTable, reapColumn); + } + public SqliteTable(String filename, String[] tables, boolean fastButDangerous, + String reapTable, String reapColumn) { this.filename = filename; try { Class.forName("org.sqlite.JDBC"); conn = DriverManager.getConnection("jdbc:sqlite:"+filename); for(String s : tables) conn.prepareStatement(s).executeUpdate(); + conn.prepareStatement("PRAGMA temp_store = MEMORY").executeUpdate(); + conn.prepareStatement("PRAGMA page_size=4096").executeUpdate(); + conn.prepareStatement("PRAGMA cache_size=2000").executeUpdate(); + if (fastButDangerous) + conn.prepareStatement("PRAGMA synchronous = OFF").executeUpdate(); } catch (SQLException e) { throw new RuntimeException(e); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } @@ -62,4 +71,4 @@ public class SqliteTable { } } -} \ No newline at end of file +} -- 1.7.10.4