summaryrefslogtreecommitdiff
path: root/src/database/insert_query.cpp
blob: f72d67f1af0cc9f2cbb08b780902458c8a896f8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 {};
}