summaryrefslogtreecommitdiff
path: root/src/ingestor.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-08-29 05:42:40 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-09-01 20:03:42 +0100
commit53a42351b97db6c84fb930b9eb9c89d694956bca (patch)
treee4a267fa106f4f6ca0eaadc364c8ba8c990afce4 /src/ingestor.cpp
parent8c863d51369f8b81caf2aee78462662d15bf30be (diff)
downloadwebstat-53a42351b97db6c84fb930b9eb9c89d694956bca.tar.bz2
webstat-53a42351b97db6c84fb930b9eb9c89d694956bca.tar.xz
webstat-53a42351b97db6c84fb930b9eb9c89d694956bca.zip
Reuse same insert entity command
Diffstat (limited to 'src/ingestor.cpp')
-rw-r--r--src/ingestor.cpp6
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();