about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-12-08T18·19+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-12-08T18·19+0000
commite4720b1a79f549b3bcb0e33fe999d02d12e3ed23 (patch)
treec3dabdd57e56ea9d9a9019572103523a7c40d3d5 /src/libstore
parent7d0444e2446c71e79e49f46f371c62f6d20488d7 (diff)
* Ignore the result of sqlite3_reset().
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/local-store.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 3782d1b16911..b80f66412576 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -66,8 +66,9 @@ void SQLiteStmt::create(sqlite3 * db, const string & s)
 void SQLiteStmt::reset()
 {
     assert(stmt);
-    if (sqlite3_reset(stmt) != SQLITE_OK)
-        throwSQLiteError(db, "resetting statement");
+    /* Note: sqlite3_reset() returns the error code for the most
+       recent call to sqlite3_step().  So ignore it. */
+    sqlite3_reset(stmt);
     curArg = 1;
 }
 
@@ -333,7 +334,7 @@ void LocalStore::openDB(bool create)
     /* Increase the auto-checkpoint interval to 8192 pages.  This
        seems enough to ensure that instantiating the NixOS system
        derivation is done in a single fsync(). */
-    if (sqlite3_exec(db, "pragma wal_autocheckpoint = 8192;", 0, 0, 0) != SQLITE_OK)
+    if (mode == "wal" && sqlite3_exec(db, "pragma wal_autocheckpoint = 8192;", 0, 0, 0) != SQLITE_OK)
         throwSQLiteError(db, "setting autocheckpoint interval");
     
     /* Initialise the database schema, if necessary. */