diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-29 05:42:40 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-09-01 20:03:42 +0100 |
commit | 53a42351b97db6c84fb930b9eb9c89d694956bca (patch) | |
tree | e4a267fa106f4f6ca0eaadc364c8ba8c990afce4 | |
parent | 8c863d51369f8b81caf2aee78462662d15bf30be (diff) | |
download | webstat-53a42351b97db6c84fb930b9eb9c89d694956bca.tar.bz2 webstat-53a42351b97db6c84fb930b9eb9c89d694956bca.tar.xz webstat-53a42351b97db6c84fb930b9eb9c89d694956bca.zip |
Reuse same insert entity command
-rw-r--r-- | src/ingestor.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ingestor.cpp b/src/ingestor.cpp index 5c47ab7..00bad64 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -138,9 +138,9 @@ namespace WebStat { void Ingestor::storeEntities(DB::Connection * dbconn, const std::span<const std::optional<Entity>> values) const { - std::ranges::for_each( - values | std::views::take_while(&std::optional<Entity>::has_value), [this, dbconn](auto && entity) { - auto insert = dbconn->modify(SQL::ENTITY_INSERT, SQL::ENTITY_INSERT_OPTS); + auto insert = dbconn->modify(SQL::ENTITY_INSERT, SQL::ENTITY_INSERT_OPTS); + std::ranges::for_each(values | std::views::take_while(&std::optional<Entity>::has_value), + [this, insert = insert.get()](auto && entity) { insert->bindParamI(0, entity->first); insert->bindParamS(1, entity->second); insert->execute(); |