diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-23 17:52:28 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-25 16:02:43 +0100 |
commit | a84be46d879ad3bde0e4a0890ef1108bf5e10b0b (patch) | |
tree | 1f3a8fbb67031bbb339872c8e467d6d258762e5b /src/ingestor.cpp | |
parent | 7ec58bf3f72fd7e0396a37f43ff023731697ff8a (diff) | |
download | webstat-a84be46d879ad3bde0e4a0890ef1108bf5e10b0b.tar.bz2 webstat-a84be46d879ad3bde0e4a0890ef1108bf5e10b0b.tar.xz webstat-a84be46d879ad3bde0e4a0890ef1108bf5e10b0b.zip |
Return count of entities passed to the database
Diffstat (limited to 'src/ingestor.cpp')
-rw-r--r-- | src/ingestor.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
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<typename... T> - void + size_t Ingestor::storeEntities(const std::tuple<T...> & values) const { - std::apply( + return std::apply( [this](auto &&... value) { - (this->storeEntity(value), ...); + return (this->storeEntity(value) + ...); }, values); } template<typename T> - 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> entity) const { if (entity) { - storeEntity(*entity); + return storeEntity(*entity); } + return 0; } template<typename... T> |