aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nix/flake.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 5370841ec..d311d331c 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -695,6 +695,7 @@ struct AttrDb
SQLiteStmt insertAttribute;
SQLiteStmt queryAttribute;
SQLiteStmt queryAttributes;
+ std::unique_ptr<SQLiteTxn> txn;
};
struct placeholder_t {};
@@ -726,6 +727,19 @@ struct AttrDb
state->queryAttributes.create(state->db,
"select name from Attributes where parent = ?");
+
+ state->txn = std::make_unique<SQLiteTxn>(state->db);
+ }
+
+ ~AttrDb()
+ {
+ try {
+ auto state(_state->lock());
+ state->txn->commit();
+ state->txn.reset();
+ } catch (...) {
+ ignoreException();
+ }
}
AttrId setAttr(