summaryrefslogtreecommitdiff
path: root/src/sql.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-05-18 20:43:51 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2026-05-18 20:43:51 +0100
commite1a6654bd5e284842ffbc3b93bd390f3bad7a187 (patch)
treea06a68ec6741e3311b74ee347ed8eb2002dba9fa /src/sql.cpp
parente8a0fb7b9c61d5603a86b52e0f2144a91fd1d84e (diff)
downloadwebstat-e1a6654bd5e284842ffbc3b93bd390f3bad7a187.tar.bz2
webstat-e1a6654bd5e284842ffbc3b93bd390f3bad7a187.tar.xz
webstat-e1a6654bd5e284842ffbc3b93bd390f3bad7a187.zip
Add job to retry insertion of log lines which had previously failed
Entities are reparsed and reinserted, removed on success. Failure to parse updates the entity type to UnparsableLine. Failure to insert again updates the detail with the reason.
Diffstat (limited to 'src/sql.cpp')
-rw-r--r--src/sql.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sql.cpp b/src/sql.cpp
index 801a905..a2dac02 100644
--- a/src/sql.cpp
+++ b/src/sql.cpp
@@ -22,6 +22,18 @@ namespace WebStat::SQL {
const std::string HOST_UPSERT {
#embed "sql/hostUpsert.sql"
};
+ const std::string SELECT_UNINSERTABLE {
+#embed "sql/selectUninsertableLines.sql"
+ };
+ const std::string DELETE_ENTITY {
+#embed "sql/deleteEntity.sql"
+ };
+ const std::string MARK_ENTITY_RETRIED {
+#embed "sql/markEntityRetried.sql"
+ };
+ const std::string SET_ENTITY_TYPE {
+#embed "sql/setEntityType.sql"
+ };
#define HASH_OPTS(VAR) \
const DB::CommandOptionsPtr VAR##_OPTS \
= std::make_shared<PQ::CommandOptions>(std::hash<std::string> {}(VAR), 35, false)
@@ -30,5 +42,10 @@ namespace WebStat::SQL {
HASH_OPTS(ENTITY_INSERT);
HASH_OPTS(ENTITY_UPDATE_DETAIL);
HASH_OPTS(HOST_UPSERT);
+ const DB::CommandOptionsPtr SELECT_UNINSERTABLE_OPTS
+ = std::make_shared<PQ::CommandOptions>(std::hash<std::string> {}(SELECT_UNINSERTABLE), 35, true);
+ HASH_OPTS(DELETE_ENTITY);
+ HASH_OPTS(MARK_ENTITY_RETRIED);
+ HASH_OPTS(SET_ENTITY_TYPE);
#undef HASH_OPTS
}