summaryrefslogtreecommitdiff
path: root/src/database/select_query.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/select_query.cpp')
-rw-r--r--src/database/select_query.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/database/select_query.cpp b/src/database/select_query.cpp
new file mode 100644
index 0000000..970b06c
--- /dev/null
+++ b/src/database/select_query.cpp
@@ -0,0 +1,21 @@
+#include <database/select_query.hpp>
+
+template <>
+std::string before_column<Database::Date>()
+{
+ if (Database::engine_type() == DatabaseEngine::EngineType::Sqlite3)
+ return "strftime(\"%Y-%m-%dT%H:%M:%SZ\", ";
+ else if (Database::engine_type() == DatabaseEngine::EngineType::Postgresql)
+ return "to_char(";
+ return {};
+}
+
+template <>
+std::string after_column<Database::Date>()
+{
+ if (Database::engine_type() == DatabaseEngine::EngineType::Sqlite3)
+ return ")";
+ else if (Database::engine_type() == DatabaseEngine::EngineType::Postgresql)
+ return R"(, 'YYYY-MM-DD"T"HH24:MM:SS"Z"'))";
+ return {};
+}