diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-04-17 23:04:21 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-04-17 23:04:21 +0200 |
commit | aaa109565e4fb662e423f23bc48c9ad9831dd281 (patch) | |
tree | 78e26f0ac9109880732f5f20e94140e036d223a8 /src/libstore | |
parent | bdb32266079f13f687790426dcbe1941c6a959f0 (diff) |
Use a more space/time-efficient representation for the eval cache
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/local-store.cc | 2 | ||||
-rw-r--r-- | src/libstore/sqlite.cc | 5 | ||||
-rw-r--r-- | src/libstore/sqlite.hh | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index ae7513ad8..b6db627b5 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -588,7 +588,7 @@ uint64_t LocalStore::addValidPath(State & state, (concatStringsSep(" ", info.sigs), !info.sigs.empty()) (info.ca, !info.ca.empty()) .exec(); - uint64_t id = sqlite3_last_insert_rowid(state.db); + uint64_t id = state.db.getLastInsertedRowId(); /* If this is a derivation, then store the derivation outputs in the database. This is useful for the garbage collector: it can diff --git a/src/libstore/sqlite.cc b/src/libstore/sqlite.cc index 63527a811..a1c262f5f 100644 --- a/src/libstore/sqlite.cc +++ b/src/libstore/sqlite.cc @@ -61,6 +61,11 @@ void SQLite::exec(const std::string & stmt) }); } +uint64_t SQLite::getLastInsertedRowId() +{ + return sqlite3_last_insert_rowid(db); +} + void SQLiteStmt::create(sqlite3 * db, const string & sql) { checkInterrupt(); diff --git a/src/libstore/sqlite.hh b/src/libstore/sqlite.hh index 661a384ef..50909a35a 100644 --- a/src/libstore/sqlite.hh +++ b/src/libstore/sqlite.hh @@ -26,6 +26,8 @@ struct SQLite void isCache(); void exec(const std::string & stmt); + + uint64_t getLastInsertedRowId(); }; /* RAII wrapper to create and destroy SQLite prepared statements. */ |