From 2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 23 Aug 2025 16:52:38 +0100 Subject: Add helpers and SQL for storing an entity --- src/ingestor.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/ingestor.cpp') diff --git a/src/ingestor.cpp b/src/ingestor.cpp index d5dd4e2..a5a2e57 100644 --- a/src/ingestor.cpp +++ b/src/ingestor.cpp @@ -1,4 +1,7 @@ #include "ingestor.hpp" +#include "sql.hpp" +#include +#include #include #include #include @@ -74,4 +77,27 @@ namespace WebStat { } } } + + template + void + Ingestor::storeEntity(const T &) const + { + } + + void + 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(); + } + + void + Ingestor::storeEntity(const std::optional entity) const + { + if (entity) { + storeEntity(*entity); + } + } } -- cgit v1.2.3