aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-02-22 14:18:55 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-02-22 14:18:55 +0000
commit9cda61694957f2f0428779319f85f626578d0cf0 (patch)
treed03651a9108d84e90ba9ff43183de3671a6b1ff1 /src/libstore/local-store.cc
parentc4d388add4942f6f99a8df12f4e49149005047e2 (diff)
* The database needs a trigger to get rid of self-references to
prevent a foreign key constraint violation on the Refs table when deleting a path.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 0823e785b..7df67555e 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -109,7 +109,11 @@ struct SQLiteStmtUse
}
~SQLiteStmtUse()
{
- stmt.reset();
+ try {
+ stmt.reset();
+ } catch (...) {
+ ignoreException();
+ }
}
};
@@ -798,6 +802,8 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
void LocalStore::invalidatePath(const Path & path)
{
debug(format("invalidating path `%1%'") % path);
+
+ SQLiteTxn txn(db);
SQLiteStmtUse use(stmtInvalidatePath);
@@ -807,7 +813,9 @@ void LocalStore::invalidatePath(const Path & path)
throw SQLiteError(db, format("invalidating path `%1%' in database") % path);
/* Note that the foreign key constraints on the Refs table take
- care of deleting the references entries for `path'. */
+ care of deleting the references entries for `path'. */
+
+ txn.commit();
}