#include <dcl/Config.h>
#include <pgtypes_date.h>
#include <pgtypes_timestamp.h>
#include <pgtypes_interval.h>
#include <stdio.h>
#include <string.h>
#include <dcl/Object.h>
#include <dcl/SQLCore.h>
#include "PgTypes_.h"
Go to the source code of this file.
◆ __ABS()
Definition at line 87 of file PgTypes.cpp.
88{
89 return n < 0 ? -
n :
n;
90}
void CharsetConvertException *size_t n
◆ __decode() [1/4]
void __decode |
( |
const char * | _s, |
|
|
SQL::Time * | _r ) |
Definition at line 49 of file PgTypes.cpp.
50{
51 int h, m, s, f;
52 (void) sscanf(_s, __TIME_FORMAT, &h, &m, &s, &f);
56 _r->nFrac = f * 10000;
57}
◆ __decode() [2/4]
__DCL_BEGIN_NAMESPACE void __decode |
( |
const date * | _s, |
|
|
SQL::Date * | _r ) |
Definition at line 27 of file PgTypes.cpp.
28{
29 int mdy[3];
30 PGTYPESdate_julmdy(*_s, mdy);
33 _r->nYear = mdy[2] - (*_s < 730119 ? 1 : 0);
34
35}
◆ __decode() [3/4]
Definition at line 110 of file PgTypes.cpp.
111{
112
113 _r->nYears = _s->month / 12;
114 _r->nMonths = _s->month % 12;
115
116 _r->nFracs = (_s->time % 1000000) * 1000;
117 int64_t t = _s->time / 1000000;
119 t /= 60;
121 t /= 60;
123 _r->nDays = (int) (t / 24);
124}
◆ __decode() [4/4]
Definition at line 65 of file PgTypes.cpp.
66{
67
68 char sz[40];
69 int r = PGTYPEStimestamp_fmt_asc((timestamp*) _s, sz,
sizeof(sz),
70 "%Y-%m-%d %H:%M:%S %z");
71
72 int Y, m, d,
H, M, S, zh, zm;
73 (void) sscanf(sz, "%d-%02u-%02u %02u:%02u:%02u %3d%02u",
74 &Y, &m, &d, &
H, &M, &S, &zh, &zm);
75 _r->nYear = Y - (*_s < -63082281600000000LL ? 1 : 0);
83
84
85}
◆ __encode() [1/4]
void __encode |
( |
const SQL::Date * | _s, |
|
|
date * | _r ) |
Definition at line 37 of file PgTypes.cpp.
38{
39 int mdy[3];
43 PGTYPESdate_mdyjul(mdy,
_r);
44}
◆ __encode() [2/4]
Definition at line 126 of file PgTypes.cpp.
127{
128
129
130
133 + (_s->
nSecs * 1000000LL)
134 + (_s->
nMins * 60 * 1000000LL)
135 + (_s->
nHours * 60 * 60 * 1000000LL)
136 + (_s->
nDays * 24 * 60 * 60 * 1000000LL)
137 ;
138}
◆ __encode() [3/4]
Definition at line 59 of file PgTypes.cpp.
60{
61 return ByteString::format(__TIME_FORMAT,
63}
◆ __encode() [4/4]
Definition at line 92 of file PgTypes.cpp.
93{
94
95
96
97
98
99 char sz[40];
101 sz, sizeof(sz), "%04d-%02u-%02u %02u:%02u:%02u",
104 );
105
106
107 PGTYPEStimestamp_defmt_asc(sz,
"%Y-%m-%d %H:%M:%S",
_r);
108}