DCL 3.7.4
Loading...
Searching...
No Matches
SqField Class Reference

#include <SqField.h>

Inheritance diagram for SqField:
SQL::Field Object

Public Member Functions

 SqField ()
virtual ~SqField ()
bool init (SQL::Query *_query, int _index)
virtual const wchar_t * serverDataTypeName () const
virtual bool __getDataSize (size_t *_size, bool _maxsize)
virtual bool __getData (void *_buf, size_t *_size, SQL::DataType _bufType)
Public Member Functions inherited from Object
virtual String toString () const
virtual void destroy ()
String className () const
bool isInstanceOf (const std::type_info &typeinfo) const
virtual const std::type_info & typeInfo () const

Protected Member Functions

SqQueryquery () const
SqConnectionconn () const
bool getInteger (void *_buf, size_t *_size)
bool getUInteger (void *_buf, size_t *_size)
bool getFloat (void *_buf, size_t *_size)
bool getDate (SQL::Date *_buf, size_t *_size)
bool getTime (SQL::Time *_buf, size_t *_size)
bool getTimeStamp (SQL::TimeStamp *_buf, size_t *_size)
bool getInterval (SQL::Interval *_buf, size_t *_size)
bool getNumeric (char *_buf, size_t *_size)
bool getBytes (char *_buf, size_t *_size)
bool writeTo (OutputStream *_output, size_t *_size)
Protected Member Functions inherited from SQL::Field
 Field (Query *_queryHandle)
virtual ~Field ()
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Additional Inherited Members

Protected Attributes inherited from SQL::Field
Query__queryHandle
String __name
DataType __dataType
short __precision
short __scale

Detailed Description

Definition at line 8 of file SqField.h.

Constructor & Destructor Documentation

◆ SqField()

SqField::SqField ( )

◆ ~SqField()

SqField::~SqField ( )
virtual

Definition at line 61 of file SqField.cpp.

62{
63// __DCL_TRACE1("~SqField: %ls", Field::__name.data());
64}

Member Function Documentation

◆ __getData()

bool SqField::__getData ( void * _buf,
size_t * _size,
SQL::DataType _bufType )
virtual

Implements SQL::Field.

Definition at line 210 of file SqField.cpp.

215{
216 switch(_bufType) {
217 case SQL::typeInteger:
218 return getInteger(_buf, _size);
220 return getUInteger(_buf, _size);
221 case SQL::typeFloat:
222 return getFloat(_buf, _size);
223 case SQL::typeDate:
224 return getDate((SQL::Date*)_buf, _size);
225 case SQL::typeTime:
226 return getTime((SQL::Time*)_buf, _size);
228 return getTimeStamp((SQL::TimeStamp*)_buf, _size);
230 return getInterval((SQL::Interval*)_buf, _size);
231 case SQL::typeText:
232 if (Field::__dataType == SQL::typeNumeric) {
233 return getNumeric((char*)_buf, _size);
234 }
235 case SQL::typeBinary:
236 return getBytes((char*)_buf, _size);
238 return writeTo((OutputStream*)_buf, _size);
239 default:
240 __DCL_ASSERT(false); // SQL::Field::getData bug
241 }
242 return true;
243}
#define __DCL_ASSERT(expr)
Definition Object.h:394
@ typeBinary
Definition SQLCore.h:74
@ typeNumeric
Definition SQLCore.h:64
@ typeTime
Definition SQLCore.h:66
@ typeUInteger
Definition SQLCore.h:62
@ typeTimeStamp
Definition SQLCore.h:68
@ typeInterval
Definition SQLCore.h:70
@ typeDate
Definition SQLCore.h:65
@ typeOutputStream
Definition SQLCore.h:82
@ typeText
Definition SQLCore.h:73
@ typeFloat
Definition SQLCore.h:63
@ typeInteger
Definition SQLCore.h:61
bool writeTo(OutputStream *_output, size_t *_size)
Definition SqField.cpp:729
bool getInteger(void *_buf, size_t *_size)
Definition SqField.cpp:245
bool getInterval(SQL::Interval *_buf, size_t *_size)
Definition SqField.cpp:624
bool getNumeric(char *_buf, size_t *_size)
Definition SqField.cpp:647
bool getTime(SQL::Time *_buf, size_t *_size)
Definition SqField.cpp:520
bool getTimeStamp(SQL::TimeStamp *_buf, size_t *_size)
Definition SqField.cpp:575
bool getUInteger(void *_buf, size_t *_size)
Definition SqField.cpp:325
bool getBytes(char *_buf, size_t *_size)
Definition SqField.cpp:686
bool getDate(SQL::Date *_buf, size_t *_size)
Definition SqField.cpp:467
bool getFloat(void *_buf, size_t *_size)
Definition SqField.cpp:404

◆ __getDataSize()

bool SqField::__getDataSize ( size_t * _size,
bool _maxsize )
virtual

Implements SQL::Field.

Definition at line 181 of file SqField.cpp.

182{
183 if (_maxsize) {
184 *_size = __maxsize;
185 }
186 else {
187 int type = sqlite3_column_type(query()->stmt(), __index);
188 switch (type) {
189 case SQLITE_INTEGER:
190 *_size = sizeof(int64_t);
191 break;
192 case SQLITE_FLOAT:
193 *_size = sizeof(double);
194 break;
195 case SQLITE_TEXT:
196 case SQLITE_BLOB: {
197 *_size = sqlite3_column_bytes(query()->stmt(), __index);
198 break;
199 }
200 case SQLITE_NULL:
201 default: {
202 *_size = (size_t)-1;
203 }
204 }
205 }
206
207 return true;
208}
SqQuery * query() const
Definition SqField.h:50

◆ conn()

SqConnection * SqField::conn ( ) const
inlineprotected

Definition at line 55 of file SqField.h.

56{
57 return query()->conn();
58}

◆ getBytes()

bool SqField::getBytes ( char * _buf,
size_t * _size )
protected

Definition at line 686 of file SqField.cpp.

687{
688 ByteString str;
689 const char* value;
690 size_t length;
691 switch (sqlite3_column_type(query()->stmt(), __index)) {
692 case SQLITE_INTEGER: {
693 str = ByteString::valueOf(sqlite3_column_int64(query()->stmt(), __index));
694 value = str;
695 length = str.length();
696 break;
697 }
698 case SQLITE_FLOAT: {
699 str = ByteString::valueOf(sqlite3_column_double(query()->stmt(), __index));
700 value = str;
701 length = str.length();
702 break;
703 }
704 case SQLITE_TEXT: {
705 value = (const char*)sqlite3_column_text(query()->stmt(), __index);
706 length = sqlite3_column_bytes(query()->stmt(), __index);
707 break;
708 }
709 case SQLITE_BLOB: {
710 value = (const char*)sqlite3_column_blob(query()->stmt(), __index);
711 length = sqlite3_column_bytes(query()->stmt(), __index);
712 break;
713 }
714 default: {
716 return false;
717 }
718 }
719
720 if (length < *_size) {
721 *(_buf + length) = '\0';
722 *_size = length;
723 }
724 memcpy(_buf, value, *_size);
725
726 return true;
727}
#define __SET_ERROR(_errorCode)
Definition SQLCore.cpp:149
@ eInvalidDataType
Definition SQLCore.h:49

◆ getDate()

bool SqField::getDate ( SQL::Date * _buf,
size_t * _size )
protected

Definition at line 467 of file SqField.cpp.

468{
469 if (*_size != sizeof(SQL::Date)) {
471 return false;
472 }
473
474 SQL::TimeStamp ts;
475 switch (sqlite3_column_type(query()->stmt(), __index)) {
476 case SQLITE_INTEGER: {
478 sqlite3_column_int64(query()->stmt(), __index),
479 ts
480 )) {
482 return false;
483 }
484 break;
485 }
486 case SQLITE_FLOAT: {
488 sqlite3_column_double(query()->stmt(), __index),
489 ts
490 )) {
492 return false;
493 }
494 break;
495 }
496 case SQLITE_TEXT: {
498 (const char*) sqlite3_column_text(query()->stmt(), __index),
499 NULL, ts)) {
500 // API 버그 또는 서버로부터 수신된 값에 오류가 있다.
502 return false;
503 }
504 break;
505 }
506 case SQLITE_BLOB:
507 default: {
509 return false;
510 }
511 }
512
513 _buf->year = ts.year;
514 _buf->month = ts.month;
515 _buf->day = ts.day;
516
517 return true;
518}
#define NULL
Definition Config.h:312
bool __decode_timestamp_iso(const char *_s, const char **_endptr, SQL::TimeStamp &_r)
Definition PqTypes.cpp:176
bool __decode_timestamp_julianday(double _julianday, SQL::TimeStamp &_r)
Definition SqTypes.cpp:354
bool __decode_timestamp_unixepoch(int64_t _unixepoch, SQL::TimeStamp &_r)
Definition SqTypes.cpp:380
@ eInvalidBufferSize
Definition SQLCore.h:50
@ eInvalidData
Definition SQLCore.h:54
int16_t year
Definition SQLCore.h:96
uint8_t month
Definition SQLCore.h:97
uint8_t day
Definition SQLCore.h:98
uint8_t day
Definition SQLCore.h:114
int16_t year
Definition SQLCore.h:112
uint8_t month
Definition SQLCore.h:113

◆ getFloat()

bool SqField::getFloat ( void * _buf,
size_t * _size )
protected

Definition at line 404 of file SqField.cpp.

405{
406 double d;
407 switch (sqlite3_column_type(query()->stmt(), __index)) {
408 case SQLITE_INTEGER: {
409 d = (double) sqlite3_column_int64(query()->stmt(), __index);
410 break;
411 }
412 case SQLITE_FLOAT: {
413 d = (double)sqlite3_column_double(query()->stmt(), __index);
414 break;
415 }
416 case SQLITE_TEXT: {
417 const char* value = (const char*)sqlite3_column_text(query()->stmt(), __index);
418 errno = 0;
419 char* endptr;
420 d = strtod(value, &endptr);
421 if (errno == ERANGE) {
423 +HUGE_VAL == d || -HUGE_VAL == d // overflow
424 || !(DBL_MIN < d) // underflow
425 );
427 return false;
428 }
429 #if __UNNEED__
430 else if (errno == EINVAL) {
432 return false;
433 }
434 #endif
435 break;
436 }
437 case SQLITE_BLOB:
438 default: {
440 return false;
441 }
442 }
443
444 switch (*_size) {
445 case sizeof(float) : {
446 if (d < -FLT_MAX || FLT_MAX < d) {
448 return false;
449 }
450 *(float*)_buf = (float)d;
451 break;
452 }
453 case sizeof(double) : {
454 *(double*)_buf = (double)d;
455 break;
456 }
457 default: {
458 *_size = sizeof(double);
460 return false;
461 }
462 }
463
464 return true;
465}
@ eOutOfRange
Definition SQLCore.h:52

◆ getInteger()

bool SqField::getInteger ( void * _buf,
size_t * _size )
protected

Definition at line 245 of file SqField.cpp.

246{
247 int64_t n;
248
249 switch (sqlite3_column_type(query()->stmt(), __index)) {
250 case SQLITE_INTEGER: {
251 n = sqlite3_column_int64(query()->stmt(), __index);
252 break;
253 }
254 case SQLITE_FLOAT: {
255 n = (int64_t)sqlite3_column_double(query()->stmt(), __index);
256 break;
257 }
258 case SQLITE_TEXT: {
259 const char* value = (const char*) sqlite3_column_text(query()->stmt(), __index);
260 errno = 0;
261 char* endptr;
262 n = strtoll(value, &endptr, 10);
263 if (errno == ERANGE) {
265 n == LLONG_MAX || n == LLONG_MIN // overflow
266 );
268 return false;
269 }
270 #define __UNNEED__ 0
271 #if __UNNEED__
272 else if (errno == EINVAL) {
274 return false;
275 }
276 #endif
277 break;
278 }
279 case SQLITE_BLOB:
280 default: {
282 return false;
283 }
284 }
285
286 switch (*_size) {
287 case sizeof(int8_t) : {
288 if (n < INT8_MIN || INT8_MAX < n) {
290 return false;
291 }
292 *(int8_t*)_buf = (int8_t)n;
293 break;
294 }
295 case sizeof(int16_t) : {
296 if (n < INT16_MIN || INT16_MAX < n) {
298 return false;
299 }
300 *(int16_t*)_buf = (int16_t)n;
301 break;
302 }
303 case sizeof(int32_t) : {
304 if (n < INT32_MIN || INT32_MAX < n) {
306 return false;
307 }
308 *(int32_t*)_buf = (int32_t)n;
309 break;
310 }
311 case sizeof(int64_t) : {
312 *(int64_t*)_buf = (int64_t)n;
313 break;
314 }
315 default: {
316 *_size = sizeof(int64_t);
318 return false;
319 }
320 }
321
322 return true;
323}
#define INT32_MAX
Definition Config.h:290
#define INT32_MIN
Definition Config.h:285
#define INT8_MIN
Definition Config.h:283
#define INT8_MAX
Definition Config.h:288
#define INT16_MAX
Definition Config.h:289
#define INT16_MIN
Definition Config.h:284

◆ getInterval()

bool SqField::getInterval ( SQL::Interval * _buf,
size_t * _size )
protected

Definition at line 624 of file SqField.cpp.

625{
626 if (*_size != sizeof(SQL::Interval)) {
628 return false;
629 }
630
631 if (sqlite3_column_type(query()->stmt(), __index) == SQLITE_TEXT) {
633 (const char*)sqlite3_column_text(query()->stmt(), __index),
634 NULL, *_buf)) {
636 return false;
637 }
638 }
639 else {
641 return false;
642 }
643
644 return true;
645}
bool __decode_interval_iso(const char *_s, const char **_endptr, SQL::Interval &_r)
Definition PqTypes.cpp:308

◆ getNumeric()

bool SqField::getNumeric ( char * _buf,
size_t * _size )
protected

Definition at line 647 of file SqField.cpp.

648{
649 ByteString str;
650 const char* value;
651 size_t length;
652 switch (sqlite3_column_type(query()->stmt(), __index)) {
653 case SQLITE_INTEGER: {
654 str = ByteString::valueOf(sqlite3_column_int64(query()->stmt(), __index));
655 value = str;
656 length = str.length();
657 break;
658 }
659 case SQLITE_FLOAT: {
660 str = ByteString::valueOf(sqlite3_column_double(query()->stmt(), __index));
661 value = str;
662 length = str.length();
663 break;
664 }
665 case SQLITE_TEXT: {
666 value = (const char*)sqlite3_column_text(query()->stmt(), __index);
667 length = sqlite3_column_bytes(query()->stmt(), __index);
668 break;
669 }
670 case SQLITE_BLOB:
671 default: {
673 return false;
674 }
675 }
676
677 if (length < *_size) {
678 *(_buf + length) = '\0';
679 *_size = length;
680 }
681 memcpy(_buf, value, *_size);
682
683 return true;
684}

◆ getTime()

bool SqField::getTime ( SQL::Time * _buf,
size_t * _size )
protected

Definition at line 520 of file SqField.cpp.

521{
522 if (*_size != sizeof(SQL::Time)) {
524 return false;
525 }
526
527 SQL::TimeStamp ts;
528 switch (sqlite3_column_type(query()->stmt(), __index)) {
529 case SQLITE_INTEGER: {
531 sqlite3_column_int64(query()->stmt(), __index),
532 ts
533 )) {
535 return false;
536 }
537 break;
538 }
539 case SQLITE_FLOAT: {
541 sqlite3_column_double(query()->stmt(), __index),
542 ts
543 )) {
545 return false;
546 }
547 break;
548 }
549 case SQLITE_TEXT: {
551 (const char*)sqlite3_column_text(query()->stmt(), __index),
552 NULL, ts)) {
553 // API 버그 또는 서버로부터 수신된 값에 오류가 있다.
555 return false;
556 }
557 break;
558 }
559 case SQLITE_BLOB:
560 default: {
562 return false;
563 }
564 }
565
566 _buf->hour = ts.hour;
567 _buf->min = ts.min;
568 _buf->sec = ts.sec;
569 _buf->frac = ts.frac;
570 _buf->tzoff = ts.tzoff;
571
572 return true;
573}
uint8_t hour
Definition SQLCore.h:103
uint8_t sec
Definition SQLCore.h:105
uint32_t frac
Definition SQLCore.h:106
uint8_t min
Definition SQLCore.h:104
int16_t tzoff
Definition SQLCore.h:107
uint32_t frac
Definition SQLCore.h:118
int16_t tzoff
Definition SQLCore.h:119
uint8_t min
Definition SQLCore.h:116
uint8_t sec
Definition SQLCore.h:117
uint8_t hour
Definition SQLCore.h:115

◆ getTimeStamp()

bool SqField::getTimeStamp ( SQL::TimeStamp * _buf,
size_t * _size )
protected

Definition at line 575 of file SqField.cpp.

576{
577 if (*_size != sizeof(SQL::TimeStamp)) {
579 return false;
580 }
581
582 SQL::TimeStamp& ts = *_buf;
583 switch (sqlite3_column_type(query()->stmt(), __index)) {
584 case SQLITE_INTEGER: {
586 sqlite3_column_int64(query()->stmt(), __index),
587 ts
588 )) {
590 return false;
591 }
592 break;
593 }
594 case SQLITE_FLOAT: {
596 sqlite3_column_double(query()->stmt(), __index),
597 ts
598 )) {
600 return false;
601 }
602 break;
603 }
604 case SQLITE_TEXT: {
606 (const char*)sqlite3_column_text(query()->stmt(), __index),
607 NULL, ts)) {
608 // API 버그 또는 서버로부터 수신된 값에 오류가 있다.
610 return false;
611 }
612 break;
613 }
614 case SQLITE_BLOB:
615 default: {
617 return false;
618 }
619 }
620
621 return true;
622}

◆ getUInteger()

bool SqField::getUInteger ( void * _buf,
size_t * _size )
protected

Definition at line 325 of file SqField.cpp.

326{
327 sqlite3_uint64 u;
328
329 switch (sqlite3_column_type(query()->stmt(), __index)) {
330 case SQLITE_INTEGER: {
331 u = (sqlite3_uint64) sqlite3_column_int64(query()->stmt(), __index);
332 break;
333 }
334 case SQLITE_FLOAT: {
335 u = (sqlite3_uint64) sqlite3_column_double(query()->stmt(), __index);
336 break;
337 }
338 case SQLITE_TEXT: {
339 const char* value = (const char*)sqlite3_column_text(query()->stmt(), __index);
340 errno = 0;
341 char* endptr;
342 u = strtoull(value, &endptr, 10);
343 if (errno == ERANGE) {
345 u == ULLONG_MAX // overflow
346 );
348 return false;
349 }
350 #if __UNNEED__
351 else if (errno == EINVAL) {
353 return false;
354 }
355 #endif
356 break;
357 }
358 case SQLITE_BLOB:
359 default: {
361 return false;
362 }
363 }
364
365 switch (*_size) {
366 case sizeof(uint8_t) : {
367 if (UINT8_MAX < u) {
369 return false;
370 }
371 *(uint8_t*)_buf = (uint8_t)u;
372 break;
373 }
374 case sizeof(uint16_t) : {
375 if (UINT16_MAX < u) {
377 return false;
378 }
379 *(uint16_t*)_buf = (uint16_t)u;
380 break;
381 }
382 case sizeof(uint32_t) : {
383 if (UINT32_MAX < u) {
385 return false;
386 }
387 *(uint32_t*)_buf = (uint32_t)u;
388 break;
389 }
390 case sizeof(uint64_t) : {
391 *(uint64_t*)_buf = (uint64_t)u;
392 break;
393 }
394 default: {
395 *_size = sizeof(uint64_t);
397 return false;
398 }
399 }
400
401 return true;
402}
#define UINT16_MAX
Definition Config.h:294
#define UINT32_MAX
Definition Config.h:295
#define UINT8_MAX
Definition Config.h:293

◆ init()

bool SqField::init ( SQL::Query * _query,
int _index )

Definition at line 66 of file SqField.cpp.

67{
68 __DCL_ASSERT(Field::__queryHandle == NULL);
69 __DCL_ASSERT(_queryHandle != NULL);
70
71 Field::__queryHandle = _queryHandle;
72 __index = _index;
73
74 try {
75 Field::__name = UTF8Decoder::decode(
76 sqlite3_column_name(query()->stmt(), _index)
77 ).toUpperCase();
78
79 const char* column_decltype = sqlite3_column_decltype(query()->stmt(), _index);
80 if (!column_decltype) {
81 column_decltype = "ANY";
82 }
83 __declType = UTF8Decoder::decode(column_decltype).toUpperCase();
84 }
85 catch (CharsetConvertException* _e) {
86 __SET_ERROR_MSG(UTF8Encoder::encode(_e->toStringAll()));
87 _e->destroy();
88 return false;
89 }
90
91 __DCL_TRACE3_N(L"Field [%2d] decltype%10ls] [%ls]\n",
92 __index, __declType.data(), Field::__name.data());
93
94 if (__declType.contains(L"RV")) { // INTERVAL
95 Field::__dataType = SQL::typeInterval;
96 }
97 else if (__declType.contains(L"BIN") // BINARY
98 || __declType.contains(L"BLO") // BLOB
99 || __declType.contains(L"BY")) { // BYTE
100 Field::__dataType = SQL::typeBinary;
101 }
102 else if (__declType.contains(L"XT") // TEXT
103 || __declType.contains(L"CH") // CHAR
104 || __declType.contains(L"CL") // CLOB
105 || __declType.contains(L"NG")){ // LONG
106 Field::__dataType = SQL::typeText;
107 }
108 else if (__declType.contains(L"DE") // DECIMAL
109 || __declType.contains(L"NU") // NUMBER, NUMERIC
110 || __declType.contains(L"MO")) { // MONEY
111 Field::__dataType = SQL::typeNumeric;
112 }
113 else if (__declType.contains(L"BO") // BOOL
114 || __declType.contains(L"TIN") // TINYINT
115 || __declType.contains(L"SM")) { // SMALLINT
116 Field::__dataType = SQL::typeInteger;
117 }
118 else if (__declType.contains(L"BIG")) { // BIGINT
119 Field::__dataType = SQL::typeInteger;
120 }
121 else if (__declType.contains(L"INT") // INTEGER
122 || __declType.contains(L"SE")) { // SERIAL
123 Field::__dataType = SQL::typeInteger;
124 }
125 else if (__declType.contains(L"RE") // REAL
126 || __declType.contains(L"FL") // FLOAT
127 || __declType.contains(L"DO")) { // DOUBLE
128 Field::__dataType = SQL::typeFloat;
129 }
130 else if (__declType.contains(L"ET") // DATETIME
131 || __declType.contains(L"ST")) { // TIMESTAMP
132 Field::__dataType = SQL::typeTimeStamp;
133 }
134 else if (__declType.contains(L"DA")) { // DATE
135 Field::__dataType = SQL::typeDate;
136 }
137 else if (__declType.contains(L"ME")) { // TIME
138 Field::__dataType = SQL::typeTime;
139 }
140 else {
141 Field::__dataType = SQL::typeText; // ANY
142 }
143
144 switch (Field::__dataType) {
145 case SQL::typeInteger:
147 __maxsize = sizeof(int64_t);
148 break;
149 case SQL::typeFloat:
150 __maxsize = sizeof(double);
151 break;
152 case SQL::typeNumeric:
153 __maxsize = 133;
154 break;
155 case SQL::typeDate:
156 __maxsize = sizeof(SQL::Date);
157 break;
158 case SQL::typeTime:
159 case SQL::typeTimeTz:
160 __maxsize = sizeof(SQL::Time);
161 break;
164 __maxsize = sizeof(SQL::TimeStamp);
165 break;
167 __maxsize = sizeof(SQL::Interval);
168 break;
169 default:
170 __maxsize = INT32_MAX;
171 }
172
173 return true;
174}
#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
#define __SET_ERROR_MSG(_message)
virtual void destroy()
Definition Exception.cpp:74
String toStringAll() const
Definition Exception.cpp:45
@ typeTimeStampTz
Definition SQLCore.h:69
@ typeTimeTz
Definition SQLCore.h:67

◆ query()

SqQuery * SqField::query ( ) const
inlineprotected

Definition at line 50 of file SqField.h.

51{
52 return (SqQuery*)Field::__queryHandle;
53}

◆ serverDataTypeName()

const wchar_t * SqField::serverDataTypeName ( ) const
virtual

Implements SQL::Field.

Definition at line 176 of file SqField.cpp.

177{
178 return __declType.data();
179}

◆ writeTo()

bool SqField::writeTo ( OutputStream * _output,
size_t * _size )
protected

Definition at line 729 of file SqField.cpp.

730{
731 ByteString str;
732 const char* value;
733 size_t length;
734 switch (sqlite3_column_type(query()->stmt(), __index)) {
735 case SQLITE_INTEGER: {
736 str = ByteString::valueOf(sqlite3_column_int64(query()->stmt(), __index));
737 value = str;
738 length = str.length();
739 break;
740 }
741 case SQLITE_FLOAT: {
742 str = ByteString::valueOf(sqlite3_column_double(query()->stmt(), __index));
743 value = str;
744 length = str.length();
745 break;
746 }
747 case SQLITE_TEXT: {
748 value = (const char*)sqlite3_column_text(query()->stmt(), __index);
749 length = sqlite3_column_bytes(query()->stmt(), __index);
750 break;
751 }
752 case SQLITE_BLOB: {
753 value = (const char*)sqlite3_column_blob(query()->stmt(), __index);
754 length = sqlite3_column_bytes(query()->stmt(), __index);
755 break;
756 }
757 default: {
759 return false;
760 }
761 }
762
763 if (length < *_size) {
764 *_size = length;
765 }
766 try {
767 _output->write(value, *_size);
768 }
769 catch (IOException* e) {
770 __SET_ERROR_MSG(UTF8Encoder::encode(e->toStringAll()));
771 e->destroy();
772 return false;
773 }
774
775 return true;
776}

The documentation for this class was generated from the following files: