use of org.sqlite.SQLiteConfig in project quorrabot by GloriousEggroll.
the class SqliteStore method CreateConnection.
private static Connection CreateConnection(String dbname, int cache_size, boolean safe_write, boolean journal, boolean autocommit) {
Connection connection = null;
try {
SQLiteConfig config = new SQLiteConfig();
config.setCacheSize(cache_size);
config.setSynchronous(safe_write ? SQLiteConfig.SynchronousMode.FULL : SQLiteConfig.SynchronousMode.NORMAL);
config.setTempStore(SQLiteConfig.TempStore.MEMORY);
config.setJournalMode(journal ? SQLiteConfig.JournalMode.TRUNCATE : SQLiteConfig.JournalMode.OFF);
connection = DriverManager.getConnection("jdbc:sqlite:" + dbname.replaceAll("\\\\", "/"), config.toProperties());
connection.setAutoCommit(autocommit);
} catch (SQLException ex) {
com.gmt2001.Console.err.printStackTrace(ex);
}
return connection;
}
Aggregations