DCL 4.0
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
138
139#define __CHECK_ADDRESS(p) \
140{ \
141 if (p == NULL) { \
142 __SET_ERROR(eBadAddress); \
143 return false; \
144 } \
145}
146
147
149#undef __SET_ERROR
150#define __SET_ERROR(_errorCode) \
151 __queryHandle->connection()->setErrorStatus(_errorCode, __THIS_FILE__, __LINE__)
152
154
155SQL::Field::Field(Query* _queryHandle)
156{
157 __queryHandle = _queryHandle;
159 __precision = -1;
160 __scale = 0;
161}
162
166
167bool SQL::Field::getDataSize(
168 size_t* _pn,
169 bool _maxSize
170 )
171{
172 __DCL_ASSERT(__dataType != typeUnknown);
173
174 // check query state
175 __DCL_ASSERT(__queryHandle->inState(SQL::Query::stExecuted));
176 /*
177 EXECUTE PROCEDURE 의 경우 fetch 하지 않고
178 바로 접근할 수 있어야 함 2004.02.04
179 if (!__queryHandle->inState(SQL::Query::stFetched))
180 {
181 __SET_ERROR(eMustFetched);
182 return false;
183 }
184 */
185
186 __CHECK_ADDRESS(_pn)
187
188 if (!_maxSize) {
189 if (isNull()) {
191 return false;
192 }
193 }
194
195 return __getDataSize(_pn, _maxSize);
196}
197
198static bool __CheckAccessType(
199 SQL::DataType _dataType, // field, or param datatype
200 SQL::DataType _accessType // buffer datatype
201 )
202{
203 switch(_dataType) {
204 case SQL::typeInteger :
205 case SQL::typeUInteger :
206 case SQL::typeFloat :
207 case SQL::typeDate :
208 case SQL::typeTime :
209 case SQL::typeTimeStamp :
214 if (_accessType == _dataType)
215 return true;
216 break;
217 case SQL::typeNumeric :
218 if (_accessType == SQL::typeInteger
219 || _accessType == SQL::typeUInteger
220 || _accessType == SQL::typeFloat
221 || _accessType == SQL::typeText)
222 return true;
223 break;
224 case SQL::typeText :
225 case SQL::typeLongText :
226 case SQL::typeClob :
227 if (_accessType == SQL::typeText
228 || _accessType == SQL::typeOutputStream)
229 return true;
230 break;
231 case SQL::typeBinary :
233 case SQL::typeBlob :
234 if (_accessType == SQL::typeBinary
235 || _accessType == SQL::typeOutputStream)
236 return true;
237 break;
238 default :
239 __DCL_ASSERT(false);
240 }
241 return false;
242}
243
244bool SQL::Field::getData(
245 void* _pv, // buffer, OUT
246 size_t* _pn, // sizeof *_pv, IN, OUT
247 DataType _dataType // typeof *_pv
248 )
249{
250 __DCL_ASSERT(__dataType != typeUnknown);
251
252#if __DCL_DEBUG
253 __DCL_ASSERT(_dataType != typeUnknown);
254 __DCL_ASSERT(_dataType != typeNumeric);
255 __DCL_ASSERT(_dataType != typeInputStream);
256#else
257 if (_dataType == typeUnknown
258 || _dataType == typeNumeric
259 || _dataType == typeInputStream) {
261 return false;
262 }
263#endif
264
265 /*
266 EXECUTE PROCEDURE 의 경우 fetch 하지 않고 바로 접근 2004.0204
267 if (!__queryHandle->inState(SQL::Query::stFetched)) {
268 __SET_ERROR(eMustFetched);
269 return false;
270 }
271 */
272
273 __CHECK_ADDRESS(_pv)
274 __CHECK_ADDRESS(_pn)
275
276 if (isNull()) {
278 return false;
279 }
280
281 if (!__CheckAccessType(__dataType, _dataType)) {
283 return false;
284 }
285
286 return __getData(_pv, _pn, _dataType);
287}
288
290
291SQL::Param::Param(SQL::Query* _queryHandle)
292 : Field(_queryHandle)
293{
294}
295
299
300
301void SQL::Param::setName(String _name)
302{
303 __name = _name;
304}
305
306bool SQL::Param::setData(
307 _CONST void* _pv, // data, IN
308 size_t _n, // sizeof *_pv
309 DataType _dataType, // typeof *_pv
310 DataType _assignType // assign to server type
311 )
312{
313#if __DCL_DEBUG
314 switch(_dataType) {
315 case typeInteger :
316 case typeUInteger :
317 case typeFloat :
318 case typeDate :
319 if (_dataType == typeDate) {
320 const Date* p = (const Date*)_pv;
322 (-9999 <= p->nYear && p->nYear <= 9999)
323 && (1 <= p->nMonth && p->nMonth <= 12)
324 && (1 <= p->nDay && p->nDay <= 31)
325 );
326 }
327 case typeTime :
328 if (_dataType == typeTime) {
329 const Time* p = (const Time*)_pv;
331 (p->nHour <= 23)
332 && (p->nMin <= 59)
333 && (p->nSec <= 59)
334 && (p->nFrac <= 999999999)
335 );
336 }
337 case typeTimeStamp :
338 case typeTimeStampTz :
339 if (_dataType == typeTimeStamp || _dataType == typeTimeStampTz) {
340 const TimeStamp* p = (const TimeStamp*)_pv;
342 (-9999 <= p->nYear && p->nYear <= 9999)
343 && (1 <= p->nMonth && p->nMonth <= 12)
344 && (1 <= p->nDay && p->nDay <= 31)
345 && (p->nHour <= 23)
346 && (p->nMin <= 59)
347 && (p->nSec <= 59)
348 && (p->nFrac <= 999999999)
349 && (-720 <= p->nTzMin && p->nTzMin < 840)
350 );
351 }
352 case typeIntervalYm :
353 case typeIntervalDs :
354 if (_dataType == typeIntervalYm || _dataType == typeIntervalDs) {
355 const Interval* p = (const Interval*)_pv;
357 (-999999999 <= p->nYears && p->nYears <= 999999999)
358 && (-11 <= p->nMonths && p->nMonths <= 11)
359 && (-999999999 <= p->nDays && p->nDays <= 999999999)
360 && (p->nHours <= 23)
361 && (p->nMins <= 59)
362 && (p->nSecs <= 59)
363 && (p->nFracs <= 999999999)
364 );
365 }
366 // typeInteger ~ typeIntervalDs
367#if __DCL_DEBUG
368 __DCL_ASSERT(_dataType == _assignType);
369#else
370 if (_dataType != _assignType) {
372 return false;
373 }
374#endif
375 break;
376 case typeText :
377 switch(_assignType)
378 {
379 case typeNumeric :
380 case typeText :
381 case typeLongText :
382 case typeClob :
383 break;
384 default :
385#if __DCL_DEBUG
386 __DCL_ASSERT(false);
387#else
389 return false;
390#endif
391 }
392 break;
393 case typeBinary :
394 switch(_assignType) {
395 case typeBinary :
396 case typeLongBinary :
397 case typeBlob :
398 break;
399 default :
400#if __DCL_DEBUG
401 __DCL_ASSERT(false);
402#else
404 return false;
405#endif
406 }
407 break;
408 case typeInputStream :
409 switch(_assignType) {
410 case typeText :
411 case typeBinary :
412 case typeLongText :
413 case typeLongBinary :
414 case typeClob :
415 case typeBlob :
416 break;
417 default :
418#if __DCL_DEBUG
419 __DCL_ASSERT(false);
420#else
422 return false;
423#endif
424 }
425 break;
426 default :
427 /*
428 case typeUnknown :
429 case typeNumeric :
430 case typeLongText :
431 case typeLongBinary :
432 case typeClob :
433 case typeBlob :
434 case typeOutputStream :
435 */
436#if __DCL_DEBUG
437 __DCL_ASSERT(false);
438#else
440 return false;
441#endif
442 }
443#endif
444
445 __DCL_ASSERT(__queryHandle->inState(SQL::Query::stPrepared));
446
447 __CHECK_ADDRESS(_pv)
448
449 return __setData(_pv, _n, _dataType, _assignType);
450}
451
452
453bool SQL::Param::setDataType(
454 DataType _dataType
455 )
456{
457#if __DCL_DEBUG
458 __DCL_ASSERT(_dataType != typeUnknown);
459 __DCL_ASSERT(_dataType != typeInputStream);
460 __DCL_ASSERT(_dataType != typeOutputStream);
461#else
462 if (_dataType == typeUnknown
463 || _dataType == typeInputStream
464 || _dataType == typeOutputStream) {
466 return false;
467 }
468#endif
469
470 __DCL_ASSERT(__queryHandle->inState(SQL::Query::stPrepared));
471
472 return __setDataType(_dataType);
473}
474
475// isNull, __setDataType, __getDataSize, __getData는
476// 드라이버에서 구현하지 않을 수도 있다.
477
479{
480 return true;
481}
482
484 DataType _dataType
485 )
486{
488 return false;
489}
490
492 size_t* _pn,
493 bool _maxSize
494 )
495{
497 return false;
498}
499
501 void* _pv,
502 size_t* _pn, // IN, OUT
503 DataType _dataType
504 )
505{
507 return false;
508}
509
511#undef __SET_ERROR
512#define __SET_ERROR(_errorCode) \
513 __connHandle->setErrorStatus(_errorCode, __THIS_FILE__, __LINE__)
514
516
518{
519 __connHandle = _connHandle;
520 __eof = true;
521 __affectedRows = -1;
522
523 __fieldCount = 0;
524 __paramCount = 0;
525 __placeholder = L'?';
526
527 __states = stStandBy;
528
529 __connHandle->addRef();
530}
531
533{
534 __connHandle->release();
535}
536
537bool SQL::Query::prepare(const char* _sql, size_t _sqllen,
538 size_t _paramCount)
539{
540 __states = stStandBy;
541
542 __CHECK_ADDRESS(_sql)
543
544 if (__prepare(_sql, _sqllen, _paramCount)) {
545 __SET_STATE(stPrepared);
546 return true;
547 }
548 return false;
549}
550
551bool SQL::Query::execute()
552{
553 if (!inState(stPrepared)) {
555 return false;
556 }
557
558 if (__execute()) {
559 __SET_STATE(stExecuted);
560 return true;
561 }
562 return false;
563}
564
565bool SQL::Query::fetch()
566{
567 if(!inState(stExecuted)) {
569 return false;
570 }
571
572 if (__fetch()) {
573 __SET_STATE(stFetched);
574 return true;
575 }
576 return false;
577}
578
580{
582 return false;
583}
584
585bool SQL::Query::nextResult()
586{
587 if (!inState(stExecuted)) {
589 return false;
590 }
591 return __nextResult();
592}
593
594bool SQL::Query::getField(size_t _index, SQL::Field** _fieldHandleOut)
595{
596 if (!inState(stExecuted)) {
598 return false;
599 }
600
601 if (_index >= __fieldCount) {
603 return false;
604 }
605 __CHECK_ADDRESS(_fieldHandleOut)
606
607 return __getField(_index, _fieldHandleOut);
608}
609
610bool SQL::Query::getParam(size_t _index, SQL::Param** _paramHandleOut)
611{
612 if (!inState(stPrepared)) {
614 return false;
615 }
616
617 if (_index >= __paramCount) {
619 return false;
620 }
621 __CHECK_ADDRESS(_paramHandleOut);
622
623 return __getParam(_index, _paramHandleOut);
624}
625
627#undef __SET_ERROR
628#define __SET_ERROR(_errorCode) \
629 setErrorStatus(_errorCode, __THIS_FILE__, __LINE__)
630
631void SQL::Connection::setErrorStatus(
632 SQL::Error _errorCode, const wchar_t* _filename, int _line)
633{
634 __errorCode = _errorCode;
635 __errorFileName = _filename;
636 __errorLine = _line;
637}
638
645
647{
648 long n = Thread::decrementAndGet(__refCount);
649 __DCL_ASSERT(n >= 0);
650 return n;
651}
652
653SQL::Connection::Connection(const wchar_t* _serverTitle)
654{
655 __refCount = 0;
656
657 __canTransact = false;
658 __serverTitle = _serverTitle;
659
662 __errorLine = 0;
663
665}
666
671
672bool SQL::Connection::open(const char* _connString, size_t _connlen)
673{
674 if (inState(stOpenned)) {
676 return false;
677 }
678
679 __CHECK_ADDRESS(_connString)
680
681 if (__open(_connString, _connlen)) {
683 return true;
684 }
685 return false;
686}
687
689{
690 if (!inState(stOpenned)) {
692 return false;
693 }
694
695 if (refCount()) {
697 return false;
698 }
699
700 if (__close()) {
702 return true;
703 }
704 return false;
705}
706
707bool SQL::Connection::execute(const char* _sql, size_t _sqllen)
708{
709 if (!inState(stOpenned)) {
711 return false;
712 }
713
714 __CHECK_ADDRESS(_sql)
715
716 return __execute(_sql, _sqllen);
717}
718
720{
721 if (!inState(stOpenned)) {
723 return false;
724 }
725
728 return false;
729 }
730
731 if (__startTrans()) {
733 return true;
734 }
735 return false;
736}
737
739{
740 if (!inState(stOpenned)) {
742 return false;
743 }
744
745 if (!inState(stInTransaction)) {
747 return false;
748 }
749
750 if (__commitTrans()) {
752 return true;
753 }
754 return false;
755}
756
758{
759 if (!inState(stOpenned)) {
761 return false;
762 }
763
764 if (!inState(stInTransaction)) {
766 return false;
767 }
768
769 if (__rollbackTrans()) {
771 return true;
772 }
773 return false;
774}
775
776bool SQL::Connection::getErrorMessage(char* _buf, size_t* _buflen)
777{
778 if ((_buf == NULL) || (_buflen == NULL) || (*_buflen <= 0))
779 return false;
780
781 return __getErrorMessage(_buf, _buflen);
782}
783
784bool SQL::Connection::getServerInfo(char* _buf, size_t* _buflen)
785{
786 if (!inState(stOpenned)) {
788 return false;
789 }
790
791 __CHECK_ADDRESS(_buf)
792 __CHECK_ADDRESS(_buflen)
793
794 return __getServerInfo(_buf, _buflen);
795}
796
798{
799 if (!inState(stOpenned)) {
801 return false;
802 }
803
804 __CHECK_ADDRESS(_queryHandleOut);
805
806 if (__createQueryInstance(_queryHandleOut)) {
807 addRef();
808 return true;
809 }
810 return false;
811}
812
814{
815 if (!inState(stOpenned)) {
817 return false;
818 }
819
820 if (_queryHandle->__connHandle != this) {
822 return false;
823 }
824
825 release();
826 _queryHandle->__destroy();
827 return true;
828}
829
830// static members
831// for driver implemtation
833 const char* _pszConnectionString, size_t _n,
834 ListedByteStringToByteStringMap& _map
835 )
836{
837 __DCL_ASSERT(_pszConnectionString != NULL);
838 ByteStringArray elts;
839 ByteString::split(
840 _pszConnectionString, _pszConnectionString + _n,
841 ';', elts
842 );
843
844 for(ByteStringArray::Iterator it = elts.begin(); it != elts.end(); it++) {
845 ByteStringArray pair;
846 (*it).split('=', pair);
847 if (pair.size() > 0) {
848 ByteStringArray::Iterator itPair = pair.begin();
849 ByteString name = *itPair++;
850 ByteString value;
851 if (pair.size() > 1) {
852 value = *itPair;
853 }
854 _map[name.trim().toUpperCase()] = value.trim();
855 }
856 }
857 return _map.size();
858}
859
860__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 __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:150
#define __CHECK_ADDRESS(p)
Definition SQLCore.cpp:139
#define __UNSET_STATE(state)
Definition SQLCore.h:431
#define __SET_STATE(state)
Definition SQLCore.h:430
void CharsetConvertException *size_t n
Definition SQLField.cpp:253
bool commitTrans()
Definition SQLCore.cpp:738
bool __canTransact
Definition SQLCore.h:371
virtual bool __createQueryInstance(Query **_queryHandleOut)=0
long refCount() const
Definition SQLCore.h:316
bool rollbackTrans()
Definition SQLCore.cpp:757
virtual bool __getErrorMessage(char *_buf, size_t *_buflen)=0
virtual bool __getServerInfo(char *_buf, size_t *_buflen)=0
bool startTrans()
Definition SQLCore.cpp:719
virtual bool __startTrans()=0
virtual bool __execute(const char *_sql, size_t _sqllen)=0
const wchar_t * __serverTitle
Definition SQLCore.h:372
bool execute(const char *_sql, size_t _sqllen)
Definition SQLCore.cpp:707
bool open(const char *_connString, size_t _connlen)
Definition SQLCore.cpp:672
unsigned int __states
Definition SQLCore.h:379
bool getErrorMessage(char *_pbuf, size_t *_pn)
Definition SQLCore.cpp:776
bool getServerInfo(char *_pbuf, size_t *_pn)
Definition SQLCore.cpp:784
Connection(const wchar_t *_serverTitle)
Definition SQLCore.cpp:653
bool inState(unsigned int uState) const
Definition SQLCore.inl:99
bool destroyQueryInstance(Query *_queryHandle)
Definition SQLCore.cpp:813
virtual bool __commitTrans()=0
bool createQueryInstance(Query **_queryHandleOut)
Definition SQLCore.cpp:797
static size_t splitConnectionString(const char *_connString, size_t _strlen, ListedByteStringToByteStringMap &_map)
Definition SQLCore.cpp:832
Error __errorCode
Definition SQLCore.h:374
virtual bool __close()=0
virtual bool __rollbackTrans()=0
virtual ~Connection()
Definition SQLCore.cpp:667
const wchar_t * __errorFileName
Definition SQLCore.h:375
Query * __queryHandle
Definition SQLCore.h:182
DataType __dataType
Definition SQLCore.h:184
Field(Query *_queryHandle)
short __precision
Definition SQLCore.h:185
short __scale
Definition SQLCore.h:186
virtual ~Field()
Definition SQLCore.cpp:163
virtual bool __getData(void *_pv, size_t *_pn, DataType _dataType)
Definition SQLCore.cpp:500
virtual bool __getDataSize(size_t *_pn, bool _maxSize)
Definition SQLCore.cpp:491
virtual ~Param()
Definition SQLCore.cpp:296
Param(Query *_queryHandle)
virtual bool isNull() const
Definition SQLCore.cpp:478
virtual bool __setDataType(DataType _dataType)
Definition SQLCore.cpp:483
Connection * __connHandle
Definition SQLCore.h:285
virtual void __destroy()=0
Query(Connection *_connHandle)
virtual ~Query()
Definition SQLCore.cpp:532
virtual bool __nextResult()
Definition SQLCore.cpp:579
static const wchar_t * dataTypeName(DataType _dataType)
Definition SQLCore.cpp:108
DataType
Definition SQLCore.h:62
@ typeBinary
Definition SQLCore.h:76
@ typeClob
Definition SQLCore.h:79
@ typeNumeric
Definition SQLCore.h:67
@ typeTime
Definition SQLCore.h:69
@ typeLongBinary
Definition SQLCore.h:78
@ typeUInteger
Definition SQLCore.h:65
@ typeUnknown
Definition SQLCore.h:63
@ typeTimeStamp
Definition SQLCore.h:70
@ typeBlob
Definition SQLCore.h:80
@ typeInputStream
Definition SQLCore.h:83
@ typeTimeStampTz
Definition SQLCore.h:71
@ typeInterval
Definition SQLCore.h:72
@ typeIntervalDs
Definition SQLCore.h:74
@ typeDate
Definition SQLCore.h:68
@ typeOutputStream
Definition SQLCore.h:84
@ typeText
Definition SQLCore.h:75
@ typeFloat
Definition SQLCore.h:66
@ typeInteger
Definition SQLCore.h:64
@ typeIntervalYm
Definition SQLCore.h:73
@ typeLongText
Definition SQLCore.h:77
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)
const wchar_t * message
Definition SQLCore.cpp:31
SQL::Error error
Definition SQLCore.cpp:30