4#include <libkern/OSByteOrder.h>
9#include <catalog/pg_type_d.h>
12#if __DCL_HAVE_ALLOC_DEBUG
13#undef __DCL_ALLOC_LEVEL
14#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
29#define __DCL_TRACE0_N __DCL_TRACE0
30#define __DCL_TRACE1_N __DCL_TRACE1
31#define __DCL_TRACE2_N __DCL_TRACE2
32#define __DCL_TRACE3_N __DCL_TRACE3
33#define __DCL_TRACE4_N __DCL_TRACE4
35#define __DCL_TRACE0_N(fmt)
36#define __DCL_TRACE1_N(fmt, arg)
37#define __DCL_TRACE2_N(fmt, arg1, arg2)
38#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
39#define __DCL_TRACE4_N(fmt, arg1, arg2, arg3, arg4)
47#define __SET_ERROR(_error) \
48 connection()->setErrorStatus(_error, __THIS_FILE__, __LINE__)
49#define __SET_ERROR_MSG(_message) \
50 conn()->setErrorMessage(_message, __THIS_FILE__, __LINE__)
69 Param::__queryHandle = _queryHandle;
72 __type = PQparamtype(_res, _index);
95static inline int __ABS(
int _n)
97 return _n < 0 ? -_n : _n;
133 r =
setBytes(_val, _size, _valType, _sqlType);
142 Param::__dataType = _sqlType;
151 case sizeof(int8_t) : {
155 case sizeof(int16_t) : {
159 case sizeof(int32_t) : {
163 case sizeof(int64_t) : {
175 __data.u8 = n ? 1 : 0;
176 query()->setValue(__index, __type,
185 __data.u16 =
__htons((uint16_t)(int16_t)n);
186 query()->setValue(__index, __type,
195 __data.u32 =
__htonl((uint32_t)(int32_t)n);
196 query()->setValue(__index, __type,
201 __data.u64 =
__htonll((uint64_t)(int64_t)n);
202 query()->setValue(__index, __type,
207 __data.u32 =
__htonf((
float)n);
208 query()->setValue(__index, __type,
213 __data.u64 =
__htond((
double)n);
214 query()->setValue(__index, __type,
224 __bytes = ByteString::valueOf(n);
225 query()->setValue(__index, __type,
243 case sizeof(uint8_t) : {
247 case sizeof(uint16_t) : {
248 u = *(uint16_t*)_val;
251 case sizeof(uint32_t) : {
252 u = *(uint32_t*)_val;
255 case sizeof(uint64_t) : {
256 u = *(uint64_t*)_val;
267 __data.u8 = u ? 1 : 0;
268 query()->setValue(__index, __type,
277 __data.u16 =
__htons((uint16_t)u);
278 query()->setValue(__index, __type,
287 __data.u32 =
__htonl((uint32_t)u);
288 query()->setValue(__index, __type,
294 query()->setValue(__index, __type,
299 __data.u32 =
__htonf((
float)u);
300 query()->setValue(__index, __type,
305 __data.u64 =
__htond((
double)u);
306 query()->setValue(__index, __type,
316 __bytes = ByteString::valueOf(u);
317 query()->setValue(__index, __type,
335 case sizeof(float) : {
339 case sizeof(double) : {
351 __data.u8 = d != 0 ? 1 : 0;
352 query()->setValue(__index, __type,
361 __data.u16 =
__htons((uint16_t)(int16_t)d);
362 query()->setValue(__index, __type,
371 __data.u32 =
__htonl((uint32_t)(int32_t)d);
372 query()->setValue(__index, __type,
377 __data.u64 =
__htonll((uint64_t)(int64_t)d);
378 query()->setValue(__index, __type,
383 __data.u32 =
__htonf((
float)d);
384 query()->setValue(__index, __type,
389 __data.u64 =
__htond((
double)d);
390 query()->setValue(__index, __type,
400 __bytes = ByteString::format((_size == 4 ?
"%.8g" :
"%.16g"), d);
401 query()->setValue(__index, __type,
423 ByteStringBuilder sb;
433 __bytes = sb.toByteString();
443 query()->setValue(__index, __type,
466 __bytes = ByteString::format(
467 "%02d:%02d:%02d.%06d",
475 __bytes = ByteString::format(
476 "%02d:%02d:%02d.%06d %+03d:%02d",
492 query()->setValue(__index, __type,
514 ByteStringBuilder sb;
517 "%04d-%02d-%02d %02d:%02d:%02d.%06d",
529 "%04d-%02d-%02d %02d:%02d:%02d.%06d %+03d:%02d",
544 __bytes = sb.toByteString();
554 query()->setValue(__index, __type,
577 __bytes = ByteString::format(
578 "P%dY%dM%dDT%dH%dM%d.%dS",
589 __bytes = ByteString::format(
590 "P%dY%dM%dDT%dH%dM%-0.%dS",
606 query()->setValue(__index, __type,
627 const char* val = (
const char*)_val;
634 size = __bytes.length();
648 if (10 * 1024 * 1024 < size) {
670 query()->setValue(__index, __type,
700 query()->setValue(__index, __type,
715 query()->setValue(__index, __type,
#define __SET_ERROR_MSG(_message)
const wchar_t * __dataTypeName(const ifx_sqlvar_t *_sqlvar)
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
uint64_t __htond(double _x)
uint32_t __htonf(float _x)
__DCL_BEGIN_NAMESPACE uint16_t __htons(uint16_t _x)
uint64_t __htonll(uint64_t _x)
uint32_t __htonl(uint32_t _x)
#define __SET_ERROR(_errorCode)
String toStringAll() const
static ByteString readBytes(InputStream &_input, size_t _n=(size_t) -1) __DCL_THROWS1(IOException *)
bool setBytes(_CONST void *_val, size_t _size, SQL::DataType _valType, SQL::DataType _sqlType)
virtual bool __setData(_CONST void *_val, size_t _size, SQL::DataType _valType, SQL::DataType _sqlType)
bool setFloat(const void *_val, size_t _size)
virtual const wchar_t * serverDataTypeName() const
bool setTimeStamp(const SQL::TimeStamp *_val, size_t _size)
bool init(SQL::Query *_query, int _index, const PGresult *_res)
bool setUInteger(const void *_val, size_t _size)
bool setTime(const SQL::Time *_val, size_t _size)
bool setInteger(const void *_val, size_t _size)
bool setInterval(const SQL::Interval *_val, size_t _size)
bool setDate(const SQL::Date *_val, size_t _size)