From 3738bcb05e7ed32a39fbd78cef45d1996e8fb484 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 18 Apr 2020 15:12:31 +0200 Subject: [PATCH] Eval cache: Don't replace real attributes with placeholders --- src/nix/flake.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/nix/flake.cc b/src/nix/flake.cc index d311d331c..15a903daf 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -693,6 +693,7 @@ struct AttrDb { SQLite db; SQLiteStmt insertAttribute; + SQLiteStmt insertPlaceholder; SQLiteStmt queryAttribute; SQLiteStmt queryAttributes; std::unique_ptr txn; @@ -722,6 +723,9 @@ struct AttrDb state->insertAttribute.create(state->db, "insert or replace into Attributes(parent, name, type, value) values (?, ?, ?, ?)"); + state->insertPlaceholder.create(state->db, + fmt("insert or ignore into Attributes(parent, name, type) values (?, ?, %d)", Placeholder)); + state->queryAttribute.create(state->db, "select rowid, type, value from Attributes where parent = ? and name = ?"); @@ -758,11 +762,9 @@ struct AttrDb assert(rowId); for (auto & attr : attrs) - state->insertAttribute.use() + state->insertPlaceholder.use() (rowId) - (attr) - (AttrType::Placeholder) - (0, false).exec(); + (attr).exec(); return rowId; }