summaryrefslogtreecommitdiff
path: root/src/sql.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2025-08-23 16:52:38 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2025-08-25 16:02:31 +0100
commit2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d (patch)
tree707c732b2229c0cfff8a96d134eb144a32703374 /src/sql.cpp
parentd3117520013d7ee0268e73cf8aaf3fb02e631a42 (diff)
downloadwebstat-2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d.tar.bz2
webstat-2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d.tar.xz
webstat-2db6c4f42a20c0c2a9b32545f4d6fab90be2c26d.zip
Add helpers and SQL for storing an entity
Diffstat (limited to 'src/sql.cpp')
-rw-r--r--src/sql.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/sql.cpp b/src/sql.cpp
new file mode 100644
index 0000000..8512657
--- /dev/null
+++ b/src/sql.cpp
@@ -0,0 +1,16 @@
+#include "sql.hpp"
+#include <command.h>
+
+namespace WebStat::SQL {
+ // ccache doesn't play nicely with #embed
+ // https://github.com/ccache/ccache/issues/1540
+ // ccache:disable
+
+ const std::string ENTITY_INSERT {
+#embed "sql/entityInsert.sql"
+ };
+#define HASH_OPTS(VAR) \
+ const DB::CommandOptionsPtr VAR##_OPTS = std::make_shared<DB::CommandOptions>(std::hash<std::string> {}(VAR))
+ HASH_OPTS(ENTITY_INSERT);
+#undef HASH_OPTS
+}