insert_query.cpp 568 Bytes
Newer Older
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 {};
}