diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/connection.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/connection.cc b/sql/connection.cc index 07e6af2..378e014 100644 --- a/sql/connection.cc +++ b/sql/connection.cc @@ -108,6 +108,11 @@ bool Connection::OpenInMemory() { } void Connection::Close() { + // TODO(shess): Calling "PRAGMA journal_mode = DELETE" at this point + // will delete the -journal file. For ChromiumOS or other more + // embedded systems, this is probably not appropriate, whereas on + // desktop it might make some sense. + // sqlite3_close() needs all prepared statements to be finalized. // Release all cached statements, then assert that the client has // released all statements. @@ -408,6 +413,17 @@ bool Connection::OpenInternal(const std::string& file_name) { DLOG(FATAL) << "Could not set locking mode: " << GetErrorMessage(); } + // http://www.sqlite.org/pragma.html#pragma_journal_mode + // DELETE (default) - delete -journal file to commit. + // TRUNCATE - truncate -journal file to commit. + // PERSIST - zero out header of -journal file to commit. + // journal_size_limit provides size to trim to in PERSIST. + // TODO(shess): Figure out if PERSIST and journal_size_limit really + // matter. In theory, it keeps pages pre-allocated, so if + // transactions usually fit, it should be faster. + ignore_result(Execute("PRAGMA journal_mode = PERSIST")); + ignore_result(Execute("PRAGMA journal_size_limit = 16384")); + const base::TimeDelta kBusyTimeout = base::TimeDelta::FromSeconds(kBusyTimeoutSeconds); |