diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-23 16:52:38 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2025-08-25 16:02:31 +0100 |
commit | 2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d (patch) | |
tree | 707c732b2229c0cfff8a96d134eb144a32703374 /src/ingestor.cpp | |
parent | d3117520013d7ee0268e73cf8aaf3fb02e631a42 (diff) | |
download | webstat-2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d.tar.bz2 webstat-2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d.tar.xz webstat-2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d.zip |
Add helpers and SQL for storing an entity
Diffstat (limited to 'src/ingestor.cpp')
-rw-r--r-- | src/ingestor.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 <connection.h> +#include <modifycommand.h> #include <scn/scan.h> #include <syslog.h> #include <utility> @@ -74,4 +77,27 @@ namespace WebStat { } } } + + template<typename T> + 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> entity) const + { + if (entity) { + storeEntity(*entity); + } + } } |