DCL 4.1
Loading...
Searching...
No Matches
SQLCore.cpp
Go to the documentation of this file.
1#include <dcl/Config.h>
2
3#if __DCL_WINDOWS
4#include <windows.h> // for dcl/Thread.h
5#endif
6
7#include <string.h>
8#include <wchar.h> // wcslen, wcsncpy
9#include <dcl/Object.h>
10#include <dcl/Thread.h> // Thread::incrementAndGet, decrementAndGet
11
12#if __DCL_HAVE_ALLOC_DEBUG
13#undef __DCL_ALLOC_LEVEL
14#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
15#endif
16
17#include <dcl/Array.h> // ByteStringArray
18#include <dcl/ListedHashMap.h> // ListedByteStringToByteStringMap
19#include <dcl/SQLCore.h>
20
21#if __DCL_DEBUG
22#undef __THIS_FILE__
23static const char_t __THIS_FILE__[] = __T("dcl/SQLCore.cpp");
24#endif
25
26__DCL_BEGIN_NAMESPACE
27
28typedef struct __SQL_ERROR
29{
31 const wchar_t* message;
33
34#if __DCL_DEBUG
35#define __SQLERROR_MSG(code, msg) {code, L"(" __T(#code) L")" __T(msg) }
36#else
37#define __SQLERROR_MSG(code, msg) {code, __T(msg) }
38#endif
39
41 wchar_t* _buf, // OUT
42 size_t* _buflen, // IN, OUT
43 Error _errorCode // IN
44 )
45{
46 static const SQL_ERROR errors[] = {
47 // Core Error
48 __SQLERROR_MSG(eNoError, "No Error"),
49 __SQLERROR_MSG(eServerError, "서버 혹은 서버 API 호출중에 에러가 발생했습니다."),
50 __SQLERROR_MSG(eBadAddress, "버퍼 혹은 파라메터의 주소가 잘못되었습니다."),
51 __SQLERROR_MSG(eOutOfMemory, "메모리 할당이 불가능합니다."),
52 __SQLERROR_MSG(eNotSupportMethod, "서버 혹은 드라이버에서 지원하지 않는 메소드 입니다."),
53
54 // SQL::Connection::execute, SQL::Query::prepare, execute
55 __SQLERROR_MSG(eNotSupportStatement, "이 인터페이스를 통해 실행할 수 없는 SQL 입니다"),
56
57 // SQL::Connection Errors
58 __SQLERROR_MSG(eInvalidConnectionString, "서버 연결을위한 연결문자열의 값이 잘못되었습니다."),
59 __SQLERROR_MSG(eConnected, "서버와 연결되어 있는 상태입니다. 다시 연결할 수 없습니다."),
60 __SQLERROR_MSG(eNotConnected, "서버에 연결되어 있지 않습니다. 연결을 끊을 수 없습니다."),
61 __SQLERROR_MSG(eInTransaction, "트랜잭션 중 입니다. 트랜잭션을 시작할 수 없습니다."),
62 __SQLERROR_MSG(eNotInTransaction, "트랜잭션 상태가 아닙니다. 트랜잭션을 종료할 수 없습니다."),
63 __SQLERROR_MSG(eHaveChildQuery, "이 연결을 사용하는 쿼리 인터페이스가 있습니다."),
64 __SQLERROR_MSG(eNoChildQuery, "이 연결을 사용하는 쿼리 인터페이스가 아닙니다."),
65 __SQLERROR_MSG(eNotAvailable, "서버의 정보를 얻을 수 없습니다."),
66
67 // SQL::Query Errors
68 __SQLERROR_MSG(eNotPrepared, "쿼리가 준비되지 있지 않습니다."),
69 __SQLERROR_MSG(eNotExecuted, "쿼리가 실행되어 있지 않습니다."),
70 __SQLERROR_MSG(eNotFetched, "쿼리가 fetch되어 있지 않습니다."),
71 __SQLERROR_MSG(eInvalidIndex, "필드나 파라메터를 참조하는 인덱스가 잘못되었습니다."),
72
73 // SQL::Field Errors
74 __SQLERROR_MSG(eValueIsNull, "필드의 값이 null 입니다."),
75 __SQLERROR_MSG(eNotSupportDataType, "서버 혹은 드라이버에서 지원하지 않는 데이터타입입니다."),
76 __SQLERROR_MSG(eInvalidDataType, "필드값을 얻거나 파라메터 값을 설정하기 위한 데이터타입이 잘못되었습니다."),
77 __SQLERROR_MSG(eInvalidBufferSize, "필드 혹은 아웃바인드의 값을 읽고자 하는 버퍼의 크기가 잘못되었습니다."),
78 __SQLERROR_MSG(eOutOfRange, "데이터타입과 사이즈로 Numeric 데이터를 얻는데 범위를 초과했습니다."),
79
80 // SQL::Param Errors
81 __SQLERROR_MSG(eInvalidData, "데이터가 잘못되었거나 서버에 적용할수 없는 형식입니다."),
82 __SQLERROR_MSG(eInvalidDataSize, "데이터타입에 적절한 데이터 크기가 아닙니다.")
83 };
84
85 __DCL_ASSERT(_buf != NULL && _buflen != NULL);
86
87 const wchar_t* psz = L"Unknown error code";
88 for(size_t i = 0; i < __countof(errors, SQL_ERROR); i++) {
89 if (_errorCode == errors[i].error) {
90 psz = errors[i].message;
91 break;
92 }
93 }
94
95 size_t len = wcslen(psz);
96 if (*_buflen >= len) {
97 wcsncpy(_buf, psz, len);
98 *_buflen = len;
99 return true;
100 }
101
102 *_buflen = len;
103 return false;
104}
105
106#define DATA_TYPE_NAME(type) case type : return __T(#type)
107
141
142#define __CHECK_ADDRESS(p) \
143{ \
144 if (p == NULL) { \
145 __SET_ERROR(eBadAddress); \
146 return false; \
147 } \
148}
149
150
152#undef __SET_ERROR
153#define __SET_ERROR(_errorCode) \
154 __queryHandle->connection()->setErrorStatus(_errorCode, __THIS_FILE__, __LINE__)
155
157
159 Query* _queryHandle
160 )
161{
162 __queryHandle = _queryHandle;
164 __precision = -1;
165 __scale = 0;
166}
167
171
172bool SQL::Field::getDataSize(
173 size_t* _pn,
174 bool _maxSize
175 )
176{
177 __DCL_ASSERT(__dataType != typeUnknown);
178
179 __CHECK_ADDRESS(_pn)
180
181 if (_maxSize) {
182 if (!__queryHandle->inState(SQL::Query::stPrepared)) {
184 return false;
185 }
186 }
187 else {
188 if (!__queryHandle->inState(SQL::Query::stFetched)) {
190 return false;
191 }
192 if (isNull()) {
194 return false;
195 }
196 }
197
198 return __getDataSize(_pn, _maxSize);
199}
200
201static bool __checkDataType__(
202 SQL::DataType _bufferType, // typeof *_pv
203 SQL::DataType _dataType // field or param assign type
204 )
205{
206 switch (_bufferType) {
207 case SQL::typeInteger: // int32_t*, int64_t*
208 case SQL::typeUInteger: // uint32_t*, uint64_t*
209 case SQL::typeFloat: // float*, double*
210 case SQL::typeDate: // SQL::Date*
211 if (_bufferType == _dataType)
212 return true;
213 break;
214 case SQL::typeTime: // SQL::Time*
215 if (_dataType == SQL::typeTime
216 || _dataType == SQL::typeTimeTz)
217 return true;
218 break;
219 case SQL::typeTimeStamp: // SQL::TimeStamp*
220 if (_dataType == SQL::typeTimeStamp
221 || _dataType == SQL::typeTimeStampTz)
222 return true;
223 break;
224 case SQL::typeInterval: // SQL::Interval*
225 if (_dataType == SQL::typeInterval
226 || _dataType == SQL::typeIntervalYm
227 || _dataType == SQL::typeIntervalDs)
228 return true;
229 break;
230 case SQL::typeText:
231 if (_dataType == SQL::typeNumeric
232 || _dataType == SQL::typeText
233 || _dataType == SQL::typeLongText
234 || _dataType == SQL::typeClob)
235 return true;
236 break;
237 case SQL::typeBinary:
238 if (_dataType == SQL::typeBinary
239 || _dataType == SQL::typeLongBinary
240 || _dataType == SQL::typeBlob)
241 return true;
242 break;
244 if (_dataType == SQL::typeText
245 || _dataType == SQL::typeBinary
246 || _dataType == SQL::typeLongText
247 || _dataType == SQL::typeLongBinary
248 || _dataType == SQL::typeClob
249 || _dataType == SQL::typeBlob)
250 return true;
251 break;
253 if (_dataType == SQL::typeText
254 || _dataType == SQL::typeBinary
255 || _dataType == SQL::typeLongText
256 || _dataType == SQL::typeLongBinary
257 || _dataType == SQL::typeClob
258 || _dataType == SQL::typeBlob)
259 return true;
260 break;
261 default:
262 // case SQL::typeUnknown:
263 // case SQL::typeNumeric:
264 // case SQL::typeLongText:
265 // case SQL::typeLongBinary:
266 // case SQL::typeClob:
267 // case SQL::typeBlob:
268 __DCL_ASSERT(false);
269 }
270 return false;
271}
272
273bool SQL::Field::getData(
274 void* _pv, // buffer, OUT
275 size_t* _pn, // sizeof *_pv, IN, OUT
276 DataType _dataType // typeof *_pv
277 )
278{
279 __DCL_ASSERT(__dataType != typeUnknown);
280
281 __DCL_ASSERT(_dataType != typeUnknown);
282 __DCL_ASSERT(_dataType != typeNumeric);
283 __DCL_ASSERT(_dataType != typeTimeTz);
284 __DCL_ASSERT(_dataType != typeTimeStampTz);
285 __DCL_ASSERT(_dataType != typeIntervalYm);
286 __DCL_ASSERT(_dataType != typeIntervalDs);
287 __DCL_ASSERT(_dataType != typeLongText);
288 __DCL_ASSERT(_dataType != typeLongBinary);
289 __DCL_ASSERT(_dataType != typeClob);
290 __DCL_ASSERT(_dataType != typeBlob);
291 __DCL_ASSERT(_dataType != typeInputStream);
292
293 if ((_dataType == typeInputStream) ||
294 !__checkDataType__(_dataType, __dataType)) {
296 return false;
297 }
298
299 __CHECK_ADDRESS(_pv)
300 __CHECK_ADDRESS(_pn)
301
302 if (!__queryHandle->inState(SQL::Query::stFetched)) {
304 return false;
305 }
306
307 if (isNull()) {
309 return false;
310 }
311
312 return __getData(_pv, _pn, _dataType);
313}
314
316
318 SQL::Query* _queryHandle
319 ) : Field(_queryHandle)
320{
321}
322
326
327void SQL::Param::setName(
328 String _name
329 )
330{
331 __name = _name;
332}
333
334bool SQL::Param::setData(
335 _CONST void* _pv, // data, IN
336 size_t _n, // sizeof *_pv
337 DataType _dataType, // typeof *_pv
338 DataType _assignType // assign to server type
339 )
340{
341 __DCL_ASSERT(_dataType != typeUnknown);
342 __DCL_ASSERT(_dataType != typeNumeric);
343 __DCL_ASSERT(_dataType != typeTimeTz);
344 __DCL_ASSERT(_dataType != typeTimeStampTz);
345 __DCL_ASSERT(_dataType != typeIntervalYm);
346 __DCL_ASSERT(_dataType != typeIntervalDs);
347 __DCL_ASSERT(_dataType != typeLongText);
348 __DCL_ASSERT(_dataType != typeLongBinary);
349 __DCL_ASSERT(_dataType != typeClob);
350 __DCL_ASSERT(_dataType != typeBlob);
351
352 if (!__checkDataType__(_dataType, _assignType)) {
354 return false;
355 }
356
357 __CHECK_ADDRESS(_pv)
358
359#if __DCL_DEBUG
360 switch (_dataType) {
361 case typeDate: {
362 const Date* p = (const Date*)_pv;
364 (-9999 <= p->year && p->year <= 9999)
365 && (1 <= p->month && p->month <= 12)
366 && (1 <= p->day && p->day <= 31)
367 );
368 break;
369 }
370 case typeTime:
371 case typeTimeTz: {
372 const Time* p = (const Time*)_pv;
374 (p->hour <= 23)
375 && (p->min <= 59)
376 && (p->sec <= 59)
377 && (p->frac <= 999999999)
378 );
380 (p->tzoff == INT16_MIN)
381 || (-720 <= p->tzoff && p->tzoff < 840)
382 );
383 break;
384 }
385 case typeTimeStamp:
386 case typeTimeStampTz: {
387 const TimeStamp* p = (const TimeStamp*)_pv;
389 (-9999 <= p->year && p->year <= 9999)
390 && (1 <= p->month && p->month <= 12)
391 && (1 <= p->day && p->day <= 31)
392 && (p->hour <= 23)
393 && (p->min <= 59)
394 && (p->sec <= 59)
395 && (p->frac <= 999999999)
396 );
398 (p->tzoff == INT16_MIN)
399 || (-720 <= p->tzoff && p->tzoff < 840)
400 );
401 break;
402 }
403 case typeInterval:
404 case typeIntervalYm:
405 case typeIntervalDs: {
406 const Interval* p = (const Interval*)_pv;
408 (-999999999 <= p->years && p->years <= 999999999)
409 && (-11 <= p->months && p->months <= 11)
410 && (-999999999 <= p->days && p->days <= 999999999)
411 && (p->hours <= 23)
412 && (p->mins <= 59)
413 && (p->secs <= 59)
414 && (p->fracs <= 999999999)
415 );
416 break;
417 }
418 }
419#endif
420
421 if (!__queryHandle->inState(SQL::Query::stPrepared)) {
423 return false;
424 }
425
426 return __setData(_pv, _n, _dataType, _assignType);
427}
428
429bool SQL::Param::setDataType(
430 DataType _dataType
431 )
432{
433#if __DCL_DEBUG
434 __DCL_ASSERT(_dataType != typeUnknown);
435 __DCL_ASSERT(_dataType != typeInputStream);
436 __DCL_ASSERT(_dataType != typeOutputStream);
437#else
438 if (_dataType == typeUnknown
439 || _dataType == typeInputStream
440 || _dataType == typeOutputStream) {
442 return false;
443 }
444#endif
445
446 if (!__queryHandle->inState(SQL::Query::stPrepared)) {
448 return false;
449 }
450
451 return __setDataType(_dataType);
452}
453
454// isNull, __setDataType, __getDataSize, __getData는
455// 드라이버에서 구현하지 않을 수도 있다.
456
458{
459 return true;
460}
461
463 DataType _dataType
464 )
465{
467 return false;
468}
469
471 size_t* _pn,
472 bool _maxSize
473 )
474{
476 return false;
477}
478
480 void* _pv,
481 size_t* _pn, // IN, OUT
482 DataType _dataType
483 )
484{
486 return false;
487}
488
490#undef __SET_ERROR
491#define __SET_ERROR(_errorCode) \
492 __connHandle->setErrorStatus(_errorCode, __THIS_FILE__, __LINE__)
493
495
497 _CONST SQL::Connection* _connHandle
498 )
499{
500 __connHandle = _connHandle;
501 __eof = true;
502 __affectedRows = -1;
503
504 __fieldCount = 0;
505 __paramCount = 0;
506 __placeholder = L'?';
507
508 __states = stStandBy;
509
510 __connHandle->addRef();
511}
512
514{
515 __connHandle->release();
516}
517
518bool SQL::Query::prepare(
519 const char* _sql,
520 size_t _sqllen,
521 size_t _paramCount
522 )
523{
524 __states = stStandBy;
525
526 __CHECK_ADDRESS(_sql)
527
528 if (__prepare(_sql, _sqllen, _paramCount)) {
529 __SET_STATE(stPrepared);
530 return true;
531 }
532 return false;
533}
534
535bool SQL::Query::execute()
536{
537 if (!inState(stPrepared)) {
539 return false;
540 }
541
542 if (__execute()) {
543 __SET_STATE(stExecuted);
544 return true;
545 }
546 return false;
547}
548
549bool SQL::Query::fetch()
550{
551 if(!inState(stExecuted)) {
553 return false;
554 }
555
556 if (__fetch()) {
557 __SET_STATE(stFetched);
558 return true;
559 }
560 return false;
561}
562
564{
566 return false;
567}
568
569bool SQL::Query::nextResult()
570{
571 if (!inState(stExecuted)) {
573 return false;
574 }
575 return __nextResult();
576}
577
578bool SQL::Query::getField(
579 size_t _index,
580 SQL::Field** _fieldHandleOut
581 )
582{
583 if (!inState(stExecuted)) {
585 return false;
586 }
587
588 if (_index >= __fieldCount) {
590 return false;
591 }
592 __CHECK_ADDRESS(_fieldHandleOut)
593
594 return __getField(_index, _fieldHandleOut);
595}
596
597bool SQL::Query::getParam(
598 size_t _index,
599 SQL::Param** _paramHandleOut
600 )
601{
602 if (!inState(stPrepared)) {
604 return false;
605 }
606
607 if (_index >= __paramCount) {
609 return false;
610 }
611 __CHECK_ADDRESS(_paramHandleOut);
612
613 return __getParam(_index, _paramHandleOut);
614}
615
617#undef __SET_ERROR
618#define __SET_ERROR(_errorCode) \
619 setErrorStatus(_errorCode, __THIS_FILE__, __LINE__)
620
621void SQL::Connection::setErrorStatus(
622 SQL::Error _errorCode,
623 const wchar_t* _filename,
624 int _line
625 )
626{
627 __errorCode = _errorCode;
628 __errorFileName = _filename;
629 __errorLine = _line;
630}
631
638
640{
641 long n = Thread::decrementAndGet(__refCount);
642 __DCL_ASSERT(n >= 0);
643 return n;
644}
645
647 const wchar_t* _serverTitle
648 )
649{
650 __refCount = 0;
651
652 __canTransact = false;
653 __serverTitle = _serverTitle;
654
657 __errorLine = 0;
658
660}
661
666
668 const char* _connString,
669 size_t _connlen
670 )
671{
672 if (inState(stOpenned)) {
674 return false;
675 }
676
677 __CHECK_ADDRESS(_connString)
678
679 if (__open(_connString, _connlen)) {
681 return true;
682 }
683 return false;
684}
685
687{
688 if (!inState(stOpenned)) {
690 return false;
691 }
692
693 if (refCount()) {
695 return false;
696 }
697
698 if (__close()) {
700 return true;
701 }
702 return false;
703}
704
706 const char* _sql,
707 size_t _sqllen
708 )
709{
710 if (!inState(stOpenned)) {
712 return false;
713 }
714
715 __CHECK_ADDRESS(_sql)
716
717 return __execute(_sql, _sqllen);
718}
719
721{
722 if (!inState(stOpenned)) {
724 return false;
725 }
726
729 return false;
730 }
731
732 if (__startTrans()) {
734 return true;
735 }
736 return false;
737}
738
740{
741 if (!inState(stOpenned)) {
743 return false;
744 }
745
746 if (!inState(stInTransaction)) {
748 return false;
749 }
750
751 if (__commitTrans()) {
753 return true;
754 }
755 return false;
756}
757
759{
760 if (!inState(stOpenned)) {
762 return false;
763 }
764
765 if (!inState(stInTransaction)) {
767 return false;
768 }
769
770 if (__rollbackTrans()) {
772 return true;
773 }
774 return false;
775}
776
778 char* _buf,
779 size_t* _buflen
780 )
781{
782 if ((_buf == NULL) || (_buflen == NULL) || (*_buflen <= 0))
783 return false;
784
785 return __getErrorMessage(_buf, _buflen);
786}
787
789 char* _buf,
790 size_t* _buflen
791 )
792{
793 if (!inState(stOpenned)) {
795 return false;
796 }
797
798 __CHECK_ADDRESS(_buf)
799 __CHECK_ADDRESS(_buflen)
800
801 return __getServerInfo(_buf, _buflen);
802}
803
805 SQL::Query** _queryHandleOut
806 )
807{
808 if (!inState(stOpenned)) {
810 return false;
811 }
812
813 __CHECK_ADDRESS(_queryHandleOut);
814
815 if (__createQueryInstance(_queryHandleOut)) {
816 addRef();
817 return true;
818 }
819 return false;
820}
821
823 SQL::Query* _queryHandle
824 )
825{
826 if (!inState(stOpenned)) {
828 return false;
829 }
830
831 if (_queryHandle->__connHandle != this) {
833 return false;
834 }
835
836 release();
837 _queryHandle->__destroy();
838 return true;
839}
840
841// static members
842// for driver implemtation
844 const char* _pszConnectionString,
845 size_t _n,
846 ListedByteStringToByteStringMap& _map
847 )
848{
849 __DCL_ASSERT(_pszConnectionString != NULL);
850 ByteStringArray elts;
851 ByteString::split(
852 _pszConnectionString, _pszConnectionString + _n,
853 ';', elts
854 );
855
856 for(ByteStringArray::Iterator it = elts.begin();
857 it != elts.end(); it++) {
858 ByteStringArray pair;
859 (*it).split('=', pair);
860 if (pair.size() > 0) {
861 ByteStringArray::Iterator itPair = pair.begin();
862 ByteString name = *itPair++;
863 ByteString value;
864 if (pair.size() > 1) {
865 value = *itPair;
866 }
867 _map[name.trim().toUpperCase()] = value.trim();
868 }
869 }
870 return _map.size();
871}
872
873__DCL_END_NAMESPACE
DCLCAPI int __open(const String &_path, int _oflags,...)
Definition _fcntl.cpp:23
#define __THIS_FILE__
Definition _trace.h:14
#define NULL
Definition Config.h:340
#define __countof(array, type)
Definition Config.h:365
wchar_t char_t
Definition Config.h:275
#define _CONST
Definition Config.h:353
#define INT16_MIN
Definition Config.h:312
#define __DCL_ASSERT(expr)
Definition Object.h:371
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
Definition Object.h:228
#define __T(str)
Definition Object.h:44
buf release()
size_t len
__DCL_BEGIN_NAMESPACE struct __SQL_ERROR SQL_ERROR
#define DATA_TYPE_NAME(type)
Definition SQLCore.cpp:106
#define __SQLERROR_MSG(code, msg)
Definition SQLCore.cpp:37
#define __SET_ERROR(_errorCode)
Definition SQLCore.cpp:153
#define __CHECK_ADDRESS(p)
Definition SQLCore.cpp:142
#define __UNSET_STATE(state)
Definition SQLCore.h:433
#define __SET_STATE(state)
Definition SQLCore.h:432
void CharsetConvertException *size_t n
Definition SQLField.cpp:254
int day() const
Definition DateTime.cpp:204
int month() const
Definition DateTime.cpp:197
int year() const
Definition DateTime.cpp:190
long days() const
Definition DateTime.cpp:637
bool commitTrans()
Definition SQLCore.cpp:739
bool __canTransact
Definition SQLCore.h:373
virtual bool __createQueryInstance(Query **_queryHandleOut)=0
long refCount() const
Definition SQLCore.h:318
bool rollbackTrans()
Definition SQLCore.cpp:758
virtual bool __getErrorMessage(char *_buf, size_t *_buflen)=0
virtual bool __getServerInfo(char *_buf, size_t *_buflen)=0
bool startTrans()
Definition SQLCore.cpp:720
virtual bool __startTrans()=0
virtual bool __execute(const char *_sql, size_t _sqllen)=0
const wchar_t * __serverTitle
Definition SQLCore.h:374
bool execute(const char *_sql, size_t _sqllen)
Definition SQLCore.cpp:705
bool open(const char *_connString, size_t _connlen)
Definition SQLCore.cpp:667
unsigned int __states
Definition SQLCore.h:381
bool getErrorMessage(char *_pbuf, size_t *_pn)
Definition SQLCore.cpp:777
bool getServerInfo(char *_pbuf, size_t *_pn)
Definition SQLCore.cpp:788
Connection(const wchar_t *_serverTitle)
Definition SQLCore.cpp:646
bool inState(unsigned int uState) const
Definition SQLCore.inl:99
bool destroyQueryInstance(Query *_queryHandle)
Definition SQLCore.cpp:822
virtual bool __commitTrans()=0
bool createQueryInstance(Query **_queryHandleOut)
Definition SQLCore.cpp:804
static size_t splitConnectionString(const char *_connString, size_t _strlen, ListedByteStringToByteStringMap &_map)
Definition SQLCore.cpp:843
Error __errorCode
Definition SQLCore.h:376
virtual bool __close()=0
virtual bool __rollbackTrans()=0
virtual ~Connection()
Definition SQLCore.cpp:662
const wchar_t * __errorFileName
Definition SQLCore.h:377
Query * __queryHandle
Definition SQLCore.h:184
DataType __dataType
Definition SQLCore.h:186
Field(Query *_queryHandle)
short __precision
Definition SQLCore.h:187
short __scale
Definition SQLCore.h:188
virtual ~Field()
Definition SQLCore.cpp:168
virtual bool __getData(void *_pv, size_t *_pn, DataType _dataType)
Definition SQLCore.cpp:479
virtual bool __getDataSize(size_t *_pn, bool _maxSize)
Definition SQLCore.cpp:470
virtual ~Param()
Definition SQLCore.cpp:323
Param(Query *_queryHandle)
virtual bool isNull() const
Definition SQLCore.cpp:457
virtual bool __setDataType(DataType _dataType)
Definition SQLCore.cpp:462
Connection * __connHandle
Definition SQLCore.h:287
virtual void __destroy()=0
Query(Connection *_connHandle)
virtual ~Query()
Definition SQLCore.cpp:513
virtual bool __nextResult()
Definition SQLCore.cpp:563
static const wchar_t * dataTypeName(DataType _dataType)
Definition SQLCore.cpp:108
DataType
Definition SQLCore.h:62
@ typeBinary
Definition SQLCore.h:77
@ typeClob
Definition SQLCore.h:80
@ typeNumeric
Definition SQLCore.h:67
@ typeTime
Definition SQLCore.h:69
@ typeLongBinary
Definition SQLCore.h:79
@ typeUInteger
Definition SQLCore.h:65
@ typeUnknown
Definition SQLCore.h:63
@ typeTimeStamp
Definition SQLCore.h:71
@ typeBlob
Definition SQLCore.h:81
@ typeInputStream
Definition SQLCore.h:84
@ typeTimeStampTz
Definition SQLCore.h:72
@ typeInterval
Definition SQLCore.h:73
@ typeIntervalDs
Definition SQLCore.h:75
@ typeDate
Definition SQLCore.h:68
@ typeOutputStream
Definition SQLCore.h:85
@ typeText
Definition SQLCore.h:76
@ typeTimeTz
Definition SQLCore.h:70
@ typeFloat
Definition SQLCore.h:66
@ typeInteger
Definition SQLCore.h:64
@ typeIntervalYm
Definition SQLCore.h:74
@ typeLongText
Definition SQLCore.h:78
Error
Definition SQLCore.h:19
@ eOutOfRange
Definition SQLCore.h:52
@ eNotSupportStatement
Definition SQLCore.h:28
@ eOutOfMemory
Definition SQLCore.h:24
@ eNotExecuted
Definition SQLCore.h:42
@ eInvalidBufferSize
Definition SQLCore.h:50
@ eInvalidData
Definition SQLCore.h:55
@ eInvalidConnectionString
Definition SQLCore.h:31
@ eNotSupportDataType
Definition SQLCore.h:48
@ eInvalidIndex
Definition SQLCore.h:44
@ eServerError
Definition SQLCore.h:21
@ eInvalidDataSize
Definition SQLCore.h:57
@ eBadAddress
Definition SQLCore.h:23
@ eInvalidDataType
Definition SQLCore.h:49
@ eNotFetched
Definition SQLCore.h:43
@ eNotConnected
Definition SQLCore.h:33
@ eConnected
Definition SQLCore.h:32
@ eNotInTransaction
Definition SQLCore.h:35
@ eNotSupportMethod
Definition SQLCore.h:25
@ eValueIsNull
Definition SQLCore.h:47
@ eInTransaction
Definition SQLCore.h:34
@ eNotAvailable
Definition SQLCore.h:38
@ eNotPrepared
Definition SQLCore.h:41
@ eHaveChildQuery
Definition SQLCore.h:36
@ eNoError
Definition SQLCore.h:20
@ eNoChildQuery
Definition SQLCore.h:37
static bool getErrorMessage(wchar_t *_buf, size_t *_buflen, Error _errorCode)
Definition SQLCore.cpp:40
static long incrementAndGet(volatile long &_n)
static long decrementAndGet(volatile long &_n)
int hour() const
Definition DateTime.cpp:467
const wchar_t * message
Definition SQLCore.cpp:31
SQL::Error error
Definition SQLCore.cpp:30