Rev1905, Secure DB write db_mode option

This commit is contained in:
shortcutme 2017-02-15 12:43:05 +01:00
parent 3d55af2111
commit f5fb6b83ff
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 8 additions and 4 deletions

View file

@ -59,9 +59,12 @@ class Db(object):
self.conn.row_factory = sqlite3.Row
self.conn.isolation_level = None
self.cur = self.getCursor()
# We need more speed then security
self.cur.execute("PRAGMA journal_mode = MEMORY")
self.cur.execute("PRAGMA synchronous = OFF")
if config.db_mode == "security":
self.cur.execute("PRAGMA journal_mode = WAL")
self.cur.execute("PRAGMA synchronous = NORMAL")
else:
self.cur.execute("PRAGMA journal_mode = MEMORY")
self.cur.execute("PRAGMA synchronous = OFF")
if self.foreign_keys:
self.execute("PRAGMA foreign_keys = ON")
self.log.debug(