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