From a84be46d879ad3bde0e4a0890ef1108bf5e10b0b Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 23 Aug 2025 17:52:28 +0100 Subject: Return count of entities passed to the database --- src/ingestor.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/ingestor.cpp') diff --git a/src/ingestor.cpp b/src/ingestor.cpp index c1206a2..e316e84 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -101,37 +101,40 @@ namespace WebStat { } template - void + size_t Ingestor::storeEntities(const std::tuple & values) const { - std::apply( + return std::apply( [this](auto &&... value) { - (this->storeEntity(value), ...); + return (this->storeEntity(value) + ...); }, values); } template - void + size_t Ingestor::storeEntity(const T &) const { + return 0; } - void + size_t Ingestor::storeEntity(const Entity entity) const { auto insert = dbconn->modify(SQL::ENTITY_INSERT, SQL::ENTITY_INSERT_OPTS); insert->bindParamI(0, entity.first); insert->bindParamS(1, entity.second); insert->execute(); + return 1; } - void + size_t Ingestor::storeEntity(const std::optional entity) const { if (entity) { - storeEntity(*entity); + return storeEntity(*entity); } + return 0; } template -- cgit v1.2.3