summaryrefslogtreecommitdiff
path: root/src/database/insert_query.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-04-13 23:35:06 +0200
committerlouiz’ <louiz@louiz.org>2018-04-13 23:35:06 +0200
commit4bd7b6981bb49dd4111c908aaa34c34f677171f4 (patch)
tree918347adb112c04455e23fcad06626e5635b6ad4 /src/database/insert_query.cpp
parentde8267fa3f4f4e1d61bcf35fb36c6664f520a385 (diff)
downloadbiboumi-4bd7b6981bb49dd4111c908aaa34c34f677171f4.tar.gz
biboumi-4bd7b6981bb49dd4111c908aaa34c34f677171f4.tar.bz2
biboumi-4bd7b6981bb49dd4111c908aaa34c34f677171f4.tar.xz
biboumi-4bd7b6981bb49dd4111c908aaa34c34f677171f4.zip
Refactor that fixes a compilation issue in Release mode
Some template specialization were not found, because they were not declared at the point they were used. We moved things around, things are less inter-dependant, and also now it works.
Diffstat (limited to 'src/database/insert_query.cpp')
-rw-r--r--src/database/insert_query.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/database/insert_query.cpp b/src/database/insert_query.cpp
new file mode 100644
index 0000000..f72d67f
--- /dev/null
+++ b/src/database/insert_query.cpp
@@ -0,0 +1,21 @@
+#include <database/insert_query.hpp>
+
+template <>
+std::string before_value<Database::Date>()
+{
+ if (Database::engine_type() == DatabaseEngine::EngineType::Sqlite3)
+ return "julianday(";
+ if (Database::engine_type() == DatabaseEngine::EngineType::Postgresql)
+ return "to_timestamp(";
+ return {};
+}
+
+template <>
+std::string after_value<Database::Date>()
+{
+ if (Database::engine_type() == DatabaseEngine::EngineType::Sqlite3)
+ return ", \"unixepoch\")";
+ if (Database::engine_type() == DatabaseEngine::EngineType::Postgresql)
+ return ")";
+ return {};
+}