blob: 521bc9c9870aecd55f5df4cb43f9bedb8cf4c2e0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// file : oracle/types/traits.hxx
// author : Constantin Michael <constantin@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef TRAITS_HXX
#define TRAITS_HXX
#include <odb/oracle/traits.hxx>
#include "test.hxx" // date_time
namespace odb
{
namespace oracle
{
template <>
class value_traits<date_time, id_date>
{
public:
typedef long long value_type;
typedef long long query_type;
typedef char* image_type;
static void
set_value (date_time& v, const char* i, bool is_null)
{
if (!is_null)
{
v.year = (i[0] - 100) * 100;
v.year += (i[1] - 100);
v.month = i[2];
v.day = i[3];
v.hour = i[4] - 1;
v.minute = i[5] - 1;
v.second = i[6] - 1;
}
}
static void
set_image (char* i, bool& is_null, const date_time& v)
{
is_null = false;
i[0] = static_cast<char> (v.year / 100 + 100);
i[1] = static_cast<char> (v.year % 100 + 100);
i[2] = static_cast<char> (v.month);
i[3] = static_cast<char> (v.day);
i[4] = static_cast<char> (v.hour + 1);
i[5] = static_cast<char> (v.minute + 1);
i[6] = static_cast<char> (v.second + 1);
}
};
}
}
#endif // TRAITS_HXX
|