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