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__)
71 Field::__queryHandle = _queryHandle;
75 Field::__name = UTF8Decoder::decode(
76 sqlite3_column_name(
query()->stmt(), _index)
79 const char* column_decltype = sqlite3_column_decltype(
query()->stmt(), _index);
80 if (!column_decltype) {
81 column_decltype =
"ANY";
83 __declType = UTF8Decoder::decode(column_decltype).toUpperCase();
92 __index, __declType.data(), Field::__name.data());
94 if (__declType.contains(L
"RV")) {
97 else if (__declType.contains(L
"BIN")
98 || __declType.contains(L
"BLO")
99 || __declType.contains(L
"BY")) {
102 else if (__declType.contains(L
"XT")
103 || __declType.contains(L
"CH")
104 || __declType.contains(L
"CL")
105 || __declType.contains(L
"NG")){
108 else if (__declType.contains(L
"DE")
109 || __declType.contains(L
"NU")
110 || __declType.contains(L
"MO")) {
113 else if (__declType.contains(L
"BO")
114 || __declType.contains(L
"TIN")
115 || __declType.contains(L
"SM")) {
118 else if (__declType.contains(L
"BIG")) {
121 else if (__declType.contains(L
"INT")
122 || __declType.contains(L
"SE")) {
125 else if (__declType.contains(L
"RE")
126 || __declType.contains(L
"FL")
127 || __declType.contains(L
"DO")) {
130 else if (__declType.contains(L
"ET")
131 || __declType.contains(L
"ST")) {
134 else if (__declType.contains(L
"DA")) {
137 else if (__declType.contains(L
"ME")) {
144 switch (Field::__dataType) {
147 __maxsize =
sizeof(int64_t);
150 __maxsize =
sizeof(double);
178 return __declType.data();
187 int type = sqlite3_column_type(
query()->stmt(), __index);
190 *_size =
sizeof(int64_t);
193 *_size =
sizeof(double);
197 *_size = sqlite3_column_bytes(
query()->stmt(), __index);
236 return getBytes((
char*)_buf, _size);
249 switch (sqlite3_column_type(
query()->stmt(), __index)) {
250 case SQLITE_INTEGER: {
251 n = sqlite3_column_int64(
query()->stmt(), __index);
255 n = (int64_t)sqlite3_column_double(
query()->stmt(), __index);
259 const char* value = (
const char*) sqlite3_column_text(
query()->stmt(), __index);
262 n = strtoll(value, &endptr, 10);
263 if (errno == ERANGE) {
265 n == LLONG_MAX || n == LLONG_MIN
272 else if (errno == EINVAL) {
287 case sizeof(int8_t) : {
292 *(int8_t*)_buf = (int8_t)n;
295 case sizeof(int16_t) : {
300 *(int16_t*)_buf = (int16_t)n;
303 case sizeof(int32_t) : {
308 *(int32_t*)_buf = (int32_t)n;
311 case sizeof(int64_t) : {
312 *(int64_t*)_buf = (int64_t)n;
316 *_size =
sizeof(int64_t);
329 switch (sqlite3_column_type(
query()->stmt(), __index)) {
330 case SQLITE_INTEGER: {
331 u = (sqlite3_uint64) sqlite3_column_int64(
query()->stmt(), __index);
335 u = (sqlite3_uint64) sqlite3_column_double(
query()->stmt(), __index);
339 const char* value = (
const char*)sqlite3_column_text(
query()->stmt(), __index);
342 u = strtoull(value, &endptr, 10);
343 if (errno == ERANGE) {
351 else if (errno == EINVAL) {
366 case sizeof(uint8_t) : {
371 *(uint8_t*)_buf = (uint8_t)u;
374 case sizeof(uint16_t) : {
379 *(uint16_t*)_buf = (uint16_t)u;
382 case sizeof(uint32_t) : {
387 *(uint32_t*)_buf = (uint32_t)u;
390 case sizeof(uint64_t) : {
391 *(uint64_t*)_buf = (uint64_t)u;
395 *_size =
sizeof(uint64_t);
407 switch (sqlite3_column_type(
query()->stmt(), __index)) {
408 case SQLITE_INTEGER: {
409 d = (double) sqlite3_column_int64(
query()->stmt(), __index);
413 d = (double)sqlite3_column_double(
query()->stmt(), __index);
417 const char* value = (
const char*)sqlite3_column_text(
query()->stmt(), __index);
420 d = strtod(value, &endptr);
421 if (errno == ERANGE) {
423 +HUGE_VAL == d || -HUGE_VAL == d
430 else if (errno == EINVAL) {
445 case sizeof(float) : {
446 if (d < -FLT_MAX || FLT_MAX < d) {
450 *(
float*)_buf = (
float)d;
453 case sizeof(double) : {
454 *(
double*)_buf = (
double)d;
458 *_size =
sizeof(double);
475 switch (sqlite3_column_type(
query()->stmt(), __index)) {
476 case SQLITE_INTEGER: {
478 sqlite3_column_int64(
query()->stmt(), __index),
488 sqlite3_column_double(
query()->stmt(), __index),
498 (
const char*) sqlite3_column_text(
query()->stmt(), __index),
528 switch (sqlite3_column_type(
query()->stmt(), __index)) {
529 case SQLITE_INTEGER: {
531 sqlite3_column_int64(
query()->stmt(), __index),
541 sqlite3_column_double(
query()->stmt(), __index),
551 (
const char*)sqlite3_column_text(
query()->stmt(), __index),
583 switch (sqlite3_column_type(
query()->stmt(), __index)) {
584 case SQLITE_INTEGER: {
586 sqlite3_column_int64(
query()->stmt(), __index),
596 sqlite3_column_double(
query()->stmt(), __index),
606 (
const char*)sqlite3_column_text(
query()->stmt(), __index),
631 if (sqlite3_column_type(
query()->stmt(), __index) == SQLITE_TEXT) {
633 (
const char*)sqlite3_column_text(
query()->stmt(), __index),
652 switch (sqlite3_column_type(
query()->stmt(), __index)) {
653 case SQLITE_INTEGER: {
654 str = ByteString::valueOf(sqlite3_column_int64(
query()->stmt(), __index));
656 length = str.length();
660 str = ByteString::valueOf(sqlite3_column_double(
query()->stmt(), __index));
662 length = str.length();
666 value = (
const char*)sqlite3_column_text(
query()->stmt(), __index);
667 length = sqlite3_column_bytes(
query()->stmt(), __index);
677 if (length < *_size) {
678 *(_buf + length) =
'\0';
681 memcpy(_buf, value, *_size);
691 switch (sqlite3_column_type(
query()->stmt(), __index)) {
692 case SQLITE_INTEGER: {
693 str = ByteString::valueOf(sqlite3_column_int64(
query()->stmt(), __index));
695 length = str.length();
699 str = ByteString::valueOf(sqlite3_column_double(
query()->stmt(), __index));
701 length = str.length();
705 value = (
const char*)sqlite3_column_text(
query()->stmt(), __index);
706 length = sqlite3_column_bytes(
query()->stmt(), __index);
710 value = (
const char*)sqlite3_column_blob(
query()->stmt(), __index);
711 length = sqlite3_column_bytes(
query()->stmt(), __index);
720 if (length < *_size) {
721 *(_buf + length) =
'\0';
724 memcpy(_buf, value, *_size);
734 switch (sqlite3_column_type(
query()->stmt(), __index)) {
735 case SQLITE_INTEGER: {
736 str = ByteString::valueOf(sqlite3_column_int64(
query()->stmt(), __index));
738 length = str.length();
742 str = ByteString::valueOf(sqlite3_column_double(
query()->stmt(), __index));
744 length = str.length();
748 value = (
const char*)sqlite3_column_text(
query()->stmt(), __index);
749 length = sqlite3_column_bytes(
query()->stmt(), __index);
753 value = (
const char*)sqlite3_column_blob(
query()->stmt(), __index);
754 length = sqlite3_column_bytes(
query()->stmt(), __index);
763 if (length < *_size) {
767 _output->write(value, *_size);
#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
#define __SET_ERROR_MSG(_message)
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
bool __decode_timestamp_iso(const char *_s, const char **_endptr, SQL::TimeStamp &_r)
bool __decode_interval_iso(const char *_s, const char **_endptr, SQL::Interval &_r)
#define __SET_ERROR(_errorCode)
bool __decode_timestamp_julianday(double _julianday, SQL::TimeStamp &_r)
bool __decode_timestamp_unixepoch(int64_t _unixepoch, SQL::TimeStamp &_r)
String toStringAll() const
bool writeTo(OutputStream *_output, size_t *_size)
bool getInteger(void *_buf, size_t *_size)
bool getInterval(SQL::Interval *_buf, size_t *_size)
bool getNumeric(char *_buf, size_t *_size)
virtual bool __getData(void *_buf, size_t *_size, SQL::DataType _bufType)
bool getTime(SQL::Time *_buf, size_t *_size)
bool getTimeStamp(SQL::TimeStamp *_buf, size_t *_size)
virtual bool __getDataSize(size_t *_size, bool _maxsize)
bool getUInteger(void *_buf, size_t *_size)
bool getBytes(char *_buf, size_t *_size)
virtual const wchar_t * serverDataTypeName() const
bool init(SQL::Query *_query, int _index)
bool getDate(SQL::Date *_buf, size_t *_size)
bool getFloat(void *_buf, size_t *_size)