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

#include <IFXQuery.h>

Inheritance diagram for IFXQuery:
SQL::Query Object

Public Member Functions

 IFXQuery (IFXConnection *_connection)
virtual ~IFXQuery ()
virtual void __destroy ()
virtual bool __prepare (const char *_sql, size_t _sqllen, size_t _paramCount)
virtual bool __execute ()
virtual bool __fetch ()
virtual bool __getField (size_t _index, SQL::Field **_fieldHandleOut)
virtual bool __getParam (size_t _index, SQL::Param **_paramHandleOut)
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

bool reset ()
bool initFields ()
bool initParams (size_t _paramCount)
Protected Member Functions inherited from SQL::Query
 Query (Connection *_connHandle)
virtual ~Query ()
virtual bool __moreResults (bool *_moreResults)
Protected Member Functions inherited from Object
virtual ~Object ()
 Object ()

Protected Attributes

ByteString __statementID
ByteString __cursorID
ifx_sqlda_t * __inSQLDA
ifx_sqlda_t * __outSQLDA
char * __outBuffer
bool __cursorDeclared
bool __cursorOpened
IFXParam__params
IFXField__fields
Protected Attributes inherited from SQL::Query
Connection__connHandle
bool __eof
int64_t __affectedRows
size_t __fieldCount
size_t __paramCount
wchar_t __placeholder
unsigned int __states

Additional Inherited Members

Public Types inherited from SQL::Query
enum  State { stStandBy = (unsigned int) 0x0001 , stPrepared = 0x0002 , stExecuted = 0x0004 , stFetched = 0x0008 }

Detailed Description

Definition at line 19 of file IFXQuery.h.

Constructor & Destructor Documentation

◆ IFXQuery()

IFXQuery::IFXQuery ( IFXConnection * _connection)

◆ ~IFXQuery()

IFXQuery::~IFXQuery ( )
virtual

Definition at line 95 of file IFXQuery.cpp.

96{
97#ifdef __DCL_DEBUG
98 if (!reset()) {
99 char buf[256];
100 size_t buflen = sizeof(buf) - 1;
101 bool b = conn()->__getErrorMessage(buf, &buflen);
102 buf[b ? buflen : 0] = '\0';
103 __DCL_TRACE1(L"Warning! Query reset error! %hs\n", buf);
104 }
105#else
106 (void)reset();
107#endif
108}
#define __DCL_TRACE1(fmt, arg1)
Definition Object.h:399
bool reset()
Definition IFXQuery.cpp:116

Member Function Documentation

◆ __destroy()

void IFXQuery::__destroy ( )
virtual

Implements SQL::Query.

Definition at line 110 of file IFXQuery.cpp.

111{
112// cerr << "IFXQuery::destory\n";
113 delete this;
114}

◆ __execute()

bool IFXQuery::__execute ( )
virtual

Implements SQL::Query.

Definition at line 485 of file IFXQuery.cpp.

486{
487/*
488 * EXEC SQL BEGIN DECLARE SECTION;
489 */
490#line 395 "ifxquery.ec"
491#line 396 "ifxquery.ec"
492 char *connID = conn()->connectionID();
493 char *stmtID = (_CONST char*)__statementID.data();
494 char *cursorID = (_CONST char*)__cursorID.data();
495/*
496 * EXEC SQL END DECLARE SECTION;
497 */
498#line 399 "ifxquery.ec"
499
500
501/*
502 * EXEC SQL SET CONNECTION :connID;
503 */
504#line 401 "ifxquery.ec"
505 {
506#line 401 "ifxquery.ec"
507 sqli_connect_set(0, connID, 0);
508#line 401 "ifxquery.ec"
509 }
510 if (SQLCODE < 0) {
511 __SET_ERROR_HANDLE(SQLCODE);
512 return false;
513 }
514 __DCL_ASSERT(SQLCODE == 0);
515
516 //if (__stmtType == SQ_SELECT) {
517 if (__outSQLDA && __outSQLDA->sqld > 0) {
518 if (!__cursorDeclared) {
519/*
520 * EXEC SQL DECLARE :cursorID CURSOR FOR :stmtID;
521 */
522#line 411 "ifxquery.ec"
523 {
524#line 411 "ifxquery.ec"
525 sqli_curs_decl_dynm(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cursorID, 0), cursorID, sqli_curs_locate(ESQLINTVERSION, stmtID, 1), 0, 0);
526#line 411 "ifxquery.ec"
527 }
528 if (SQLCODE < 0) {
529 __SET_ERROR_HANDLE(SQLCODE);
530 return false;
531 }
532 __cursorDeclared = true;
533 }
534
535 if (__cursorOpened) {
536/*
537 * EXEC SQL CLOSE :cursorID;
538 */
539#line 420 "ifxquery.ec"
540 {
541#line 420 "ifxquery.ec"
542 sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cursorID, 256));
543#line 420 "ifxquery.ec"
544 }
545 if (SQLCODE < 0) {
546 __SET_ERROR_HANDLE(SQLCODE);
547 return false;
548 }
549 __cursorOpened = false;
550 }
551
552 if (__inSQLDA)
553/*
554 * EXEC SQL OPEN :cursorID USING DESCRIPTOR __inSQLDA;
555 */
556#line 429 "ifxquery.ec"
557 {
558#line 429 "ifxquery.ec"
559 sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cursorID, 256), __inSQLDA, (char *)0, (struct value *)0, 1, 0);
560#line 429 "ifxquery.ec"
561 }
562 else
563/*
564 * EXEC SQL OPEN :cursorID;
565 */
566#line 431 "ifxquery.ec"
567 {
568#line 431 "ifxquery.ec"
569 sqli_curs_open(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cursorID, 256), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0, 0);
570#line 431 "ifxquery.ec"
571 }
572
573 if (SQLCODE < 0) {
574 __SET_ERROR_HANDLE(SQLCODE);
575 return false;
576 }
577
578 __cursorOpened = true;
579 __eof = false;
580 }
581 else {
582#if __USE_STMT_TYPE
583 // 2025.05.06 __outSQLDA 조건은 CURSOR로 처리 하므로
584 // 다음 EXEC SQL EXECUTE는 의미가 없다.
585 if (__outSQLDA && __inSQLDA)
586/*
587 * EXEC SQL EXECUTE :stmtID INTO DESCRIPTOR __outSQLDA
588 * USING DESCRIPTOR __inSQLDA;
589 */
590#line 446 "ifxquery.ec"
591 {
592#line 447 "ifxquery.ec"
593 sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, stmtID, 257), __inSQLDA, (char *)0, (struct value *)0, __outSQLDA, (char *)0, (struct value *)0, 0);
594#line 447 "ifxquery.ec"
595 }
596 else if (__outSQLDA)
597/*
598 * EXEC SQL EXECUTE :stmtID INTO DESCRIPTOR __outSQLDA;
599 */
600#line 449 "ifxquery.ec"
601 {
602#line 449 "ifxquery.ec"
603 sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, stmtID, 257), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, __outSQLDA, (char *)0, (struct value *)0, 0);
604#line 449 "ifxquery.ec"
605 }
606 else
607#endif
608 if (__inSQLDA)
609/*
610 * EXEC SQL EXECUTE : stmtID USING DESCRIPTOR __inSQLDA;
611 */
612#line 453 "ifxquery.ec"
613 {
614#line 453 "ifxquery.ec"
615 sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, stmtID, 257), __inSQLDA, (char *)0, (struct value *)0, (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0);
616#line 453 "ifxquery.ec"
617 }
618 else
619/*
620 * EXEC SQL EXECUTE :stmtID;
621 */
622#line 455 "ifxquery.ec"
623 {
624#line 455 "ifxquery.ec"
625 sqli_exec(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, stmtID, 257), (ifx_sqlda_t *)0, (char *)0, (struct value *)0, (ifx_sqlda_t *)0, (char *)0, (struct value *)0, 0);
626#line 455 "ifxquery.ec"
627 }
628
629 if (SQLCODE < 0) {
630 __SET_ERROR_HANDLE(SQLCODE);
631 Query::__affectedRows = -1;
632 return false;
633 }
634
635#if __USE_STMT_TYPE
636 if (__stmtType == SQ_EXECPROC) {
637 for(size_t i = 0; i < Query::__fieldCount; i++) {
638 if (!__fields[i].onAfterFetch())
639 return false;
640 }
641 }
642 else {
643 // INSERT, UPDATE, DELETE
644 Query::__affectedRows = sqlca.sqlerrd[2];
645 }
646#else
647 // INSERT, UPDATE, DELETE
648 Query::__affectedRows = sqlca.sqlerrd[2];
649#endif
650 }
651
652 for(size_t i = 0; i < Query::__paramCount; i++) {
653 if (!(__params[i].onAfterExecute()))
654 return false;
655 }
656
657 return true;
658}
#define _CONST
Definition Config.h:325
#define __SET_ERROR_HANDLE(_SQLCODE)
#define __DCL_ASSERT(expr)
Definition Object.h:394
bool __cursorOpened
Definition IFXQuery.h:37
IFXParam * __params
Definition IFXQuery.h:39
IFXField * __fields
Definition IFXQuery.h:40
ifx_sqlda_t * __inSQLDA
Definition IFXQuery.h:32
ByteString __statementID
Definition IFXQuery.h:21
bool __cursorDeclared
Definition IFXQuery.h:36
ifx_sqlda_t * __outSQLDA
Definition IFXQuery.h:33
ByteString __cursorID
Definition IFXQuery.h:27
bool __eof
Definition SQLCore.h:303

◆ __fetch()

bool IFXQuery::__fetch ( )
virtual

Implements SQL::Query.

Definition at line 660 of file IFXQuery.cpp.

661{
662 // SELECT, EXECUTE PROCEDURE
663 __DCL_ASSERT(!eof());
664 __DCL_ASSERT(__outSQLDA && __outSQLDA->sqld > 0);
665
666/*
667 * EXEC SQL BEGIN DECLARE SECTION;
668 */
669#line 494 "ifxquery.ec"
670#line 495 "ifxquery.ec"
671 char *connID = conn()->connectionID();
672 char *cursorID = (_CONST char*)__cursorID.data();
673/*
674 * EXEC SQL END DECLARE SECTION;
675 */
676#line 497 "ifxquery.ec"
677
678
679/*
680 * EXEC SQL SET CONNECTION :connID;
681 */
682#line 499 "ifxquery.ec"
683 {
684#line 499 "ifxquery.ec"
685 sqli_connect_set(0, connID, 0);
686#line 499 "ifxquery.ec"
687 }
688 if (SQLCODE < 0) {
689 __SET_ERROR_HANDLE(SQLCODE);
690 return false;
691 }
692 __DCL_ASSERT(SQLCODE == 0);
693
694/*
695 * EXEC SQL FETCH :cursorID USING DESCRIPTOR __outSQLDA;
696 */
697#line 506 "ifxquery.ec"
698 {
699#line 506 "ifxquery.ec"
700 static _FetchSpec _FS0 = { 0, 1, 0 };
701 sqli_curs_fetch(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cursorID, 256), (ifx_sqlda_t *)0, __outSQLDA, (char *)0, &_FS0);
702#line 506 "ifxquery.ec"
703 }
704
705 if (SQLCODE == 0) {
706 for (size_t i = 0; i < Query::__fieldCount; i++) {
707 if (!__fields[i].onAfterFetch())
708 return false;
709 }
710 return true;
711 }
712 else if (SQLCODE == SQLNOTFOUND) {
713 Query::__eof = true;
714 if (__cursorOpened) {
715 __cursorOpened = false;
716/*
717 * EXEC SQL CLOSE :cursorID;
718 */
719#line 519 "ifxquery.ec"
720 {
721#line 519 "ifxquery.ec"
722 sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cursorID, 256));
723#line 519 "ifxquery.ec"
724 }
725 if (SQLCODE < 0) {
726 __SET_ERROR_HANDLE(SQLCODE);
727 return false;
728 }
729 }
730 return true;
731 }
732
733 __SET_ERROR_HANDLE(SQLCODE);
734 return false;
735}

◆ __getField()

bool IFXQuery::__getField ( size_t _index,
SQL::Field ** _fieldHandleOut )
virtual

Implements SQL::Query.

Definition at line 737 of file IFXQuery.cpp.

738{
739 __DCL_ASSERT(Query::__fieldCount > 0);
740 __DCL_ASSERT((0 <= _index) && (_index < Query::__fieldCount));
741 *_fieldHandleOut = &__fields[_index];
742 return true;
743}

◆ __getParam()

bool IFXQuery::__getParam ( size_t _index,
SQL::Param ** _paramHandleOut )
virtual

Implements SQL::Query.

Definition at line 745 of file IFXQuery.cpp.

746{
747 __DCL_ASSERT(Query::__paramCount > 0);
748 __DCL_ASSERT((0 <= _index) && (_index < Query::__paramCount));
749 *_paramHandleOut = &__params[_index];
750 return true;
751}

◆ __prepare()

bool IFXQuery::__prepare ( const char * _sql,
size_t _sqllen,
size_t _paramCount )
virtual

Implements SQL::Query.

Definition at line 359 of file IFXQuery.cpp.

361{
362 if (!reset())
363 return false;
364
365/*
366 * EXEC SQL BEGIN DECLARE SECTION;
367 */
368#line 313 "ifxquery.ec"
369#line 314 "ifxquery.ec"
370 char *connID = conn()->connectionID();
371 char *stmtID = (_CONST char*)__statementID.data();
372 char *sql = (_CONST char*)_sql;
373/*
374 * EXEC SQL END DECLARE SECTION;
375 */
376#line 317 "ifxquery.ec"
377
378
379/*
380 * EXEC SQL SET CONNECTION : connID;
381 */
382#line 319 "ifxquery.ec"
383 {
384#line 319 "ifxquery.ec"
385 sqli_connect_set(0, connID, 0);
386#line 319 "ifxquery.ec"
387 }
388 if (SQLCODE < 0) {
389 __SET_ERROR_HANDLE(SQLCODE);
390 return false;
391 }
392 __DCL_ASSERT(SQLCODE == 0);
393
394/*
395 * EXEC SQL PREPARE : stmtID FROM : sql;
396 */
397#line 326 "ifxquery.ec"
398 {
399#line 326 "ifxquery.ec"
400 sqli_prep(ESQLINTVERSION, stmtID, sql,(ifx_literal_t *)0, (ifx_namelist_t *)0, -1, 0, 0);
401#line 326 "ifxquery.ec"
402 }
403 if (SQLCODE < 0) {
404 __SET_ERROR_HANDLE(SQLCODE);
405 return false;
406 }
407
408/*
409 * EXEC SQL DESCRIBE INPUT : stmtID INTO __inSQLDA;
410 */
411#line 332 "ifxquery.ec"
412 {
413#line 332 "ifxquery.ec"
414 sqli_describe_input_stmt(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, stmtID, 257), &__inSQLDA, 0);
415#line 332 "ifxquery.ec"
416 }
417 if (SQLCODE < 0) {
418 __SET_ERROR_HANDLE(SQLCODE);
419 return false;
420 }
421#if __TRACE_THIS && 1
422 if (__inSQLDA) {
423 __DCL_TRACE2_N(L"__inSQLDA[%p] sqld[%d]]\n",
424 __inSQLDA, __inSQLDA->sqld);
425 ifx_sqlvar_t* sqlvar = __inSQLDA->sqlvar;
426 for (int2 i = 0; i < __inSQLDA->sqld; i++, sqlvar++) {
427 __DCL_TRACE3_N(L"[%10hs][%2d] sqllen[%4d]\n",
428 rtypname(sqlvar->sqltype), sqlvar->sqltype, sqlvar->sqllen);
429 }
430 }
431#endif
432
433/*
434 * EXEC SQL DESCRIBE OUTPUT :stmtID INTO __outSQLDA;
435 */
436#line 349 "ifxquery.ec"
437 {
438#line 349 "ifxquery.ec"
439 sqli_describe_output_stmt(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, stmtID, 257), &__outSQLDA, 0);
440#line 349 "ifxquery.ec"
441 }
442 if (SQLCODE < 0) {
443 __SET_ERROR_HANDLE(SQLCODE);
444 return false;
445 }
446
447 __DCL_TRACE1_N(L"stmtType[%ls]\n",
448 __STMT_STRING(SQLCODE == 0 ? SQ_SELECT : SQLCODE));
449#if __USE_STMT_TYPE
450 __stmtType = sqlca.sqlcode;
451 if (__stmtType == 0)
452 __stmtType = SQ_SELECT;
453
454 switch (__stmtType) {
455 case SQ_SELECT:
456 case SQ_EXECPROC: {
457 break;
458 }
459 default: {
460 if (__outSQLDA) {
463 }
464 }
465 }
466#endif
467
468 __DCL_TRACE2_N(L"__outSQLDA[%p] sqld[%d]\n",
469 __outSQLDA, __outSQLDA ? __outSQLDA->sqld : -1);
470 if (__outSQLDA && __outSQLDA->sqld > 0) {
471 if (!initFields())
472 return false;
473 }
474
475 __DCL_TRACE2_N(L"__inSQLDA[%p] sqld[%d]\n",
476 __inSQLDA, __inSQLDA ? __inSQLDA->sqld : -1);
477 if (_paramCount > 0) {
478 if (!initParams(_paramCount))
479 return false;
480 }
481
482 return true;
483}
#define NULL
Definition Config.h:312
#define __DCL_TRACE1_N(fmt, arg)
#define __DCL_TRACE2_N(fmt, arg1, arg2)
#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
#define ndebug_free(_p)
Definition IFXUtils.h:23
bool initFields()
Definition IFXQuery.cpp:252
bool initParams(size_t _paramCount)
Definition IFXQuery.cpp:333

◆ initFields()

bool IFXQuery::initFields ( )
protected

Definition at line 252 of file IFXQuery.cpp.

253{
255 (Query::__fieldCount == 0)
256 && (__fields == NULL)
257 && (__outBuffer == NULL)
258 && (__outSQLDA != NULL)
259 && (__outSQLDA->sqld > 0)
260 );
261
262 // __outSQLDA에 적용할, 레코드 버퍼 크기를 계산한다.
263 mintptr offset = 0;
264 ifx_sqlvar_t* sqlvar = __outSQLDA->sqlvar;
265 for(int2 i = 0; i < __outSQLDA->sqld; i++, sqlvar++) {
266 offset = rtypalign(offset, sqlvar->sqltype);
267 mint msize = rtypmsize(sqlvar->sqltype, sqlvar->sqllen);
268 __DCL_TRACE4_N(L"[%10hs] sqllen[%4d] msize[%4d] offset[%4d]\n",
269 rtypname(sqlvar->sqltype), sqlvar->sqllen,
270 msize, offset
271 );
272 switch (sqlvar->sqltype & SQLTYPE) {
273 case SQLDECIMAL:
274 case SQLMONEY:
275 case SQLDTIME:
276 case SQLINTERVAL:
277 break;
278 default:
279 sqlvar->sqllen = msize;
280 }
281 offset += msize;
282 /*
283 SQLTYPE sqllen rtypmsize
284 ===========================================
285 SQLCHAR 서버컬럼최대길이 sqllen + 1
286 SQLVCHAR '\0'을 포함한 버퍼의 크기
287 SQLNCHAR
288 SQLNVCHAR
289 SQLLVARCHAR
290 -------------------------------------------
291 SQLDECIMAL DECIMAL(p,s) sizeof(dec_t)
292 SQLMONEY 의 p,s의미
293 -------------------------------------------
294 SQLDTIME qualifier sizeof(dtime_t)
295 SQLINTERVAL qualifier sizeof(intrvl_t)
296 */
297 }
298
299 __DCL_TRACE1_N(L"outBuffer [%zd]\n", offset);
300 if (offset > 0) {
301 __outBuffer = (char*)malloc(offset);
302 __DCL_ASSERT((size_t)__outBuffer % sizeof(void*) == 0);
303 if (__outBuffer == NULL) {
305 return false;
306 }
307 }
308
309 sqlvar = __outSQLDA->sqlvar;
310 offset = 0;
311 for(int2 i = 0; i < __outSQLDA->sqld; i++, sqlvar++) {
312 offset = rtypalign(offset, sqlvar->sqltype);
313 sqlvar->sqldata = __outBuffer + offset;
314 offset += rtypmsize(sqlvar->sqltype, sqlvar->sqllen);
315 }
316
317 Query::__fieldCount = __outSQLDA->sqld;
318 __fields = new IFXField[Query::__fieldCount];
319 if (__fields == NULL) {
321 return false;
322 }
323
324 sqlvar = __outSQLDA->sqlvar;
325 for (size_t i = 0; i < Query::__fieldCount; i++, sqlvar++) {
326 if (!__fields[i].init(this, sqlvar))
327 return false;
328 }
329
330 return true;
331}
#define __DCL_TRACE4_N(fmt, arg1, arg2, arg3, arg4)
int mint
Definition IFXParam.cpp:11
#define __SET_ERROR(_errorCode)
Definition SQLCore.cpp:149
char * __outBuffer
Definition IFXQuery.h:34
@ eOutOfMemory
Definition SQLCore.h:24

◆ initParams()

bool IFXQuery::initParams ( size_t _paramCount)
protected

Definition at line 333 of file IFXQuery.cpp.

334{
335 __DCL_ASSERT((Query::__paramCount == 0)
336 && (__params == NULL)
337 && (__inSQLDA != NULL)
338 && (__inSQLDA->sqld > 0)
339 );
340
341 __DCL_ASSERT(__inSQLDA->sqld == (int2)_paramCount);
342
343 Query::__paramCount = __inSQLDA->sqld;
344 __params = new IFXParam[Query::__paramCount];
345 if (__params == NULL) {
347 return false;
348 }
349
350 ifx_sqlvar_t* sqlvar = __inSQLDA->sqlvar;
351 for(size_t i = 0; i < Query::__paramCount; i++, sqlvar++) {
352 if (!__params[i].init(this, sqlvar))
353 return false;
354 }
355
356 return true;
357}

◆ reset()

bool IFXQuery::reset ( )
protected

Definition at line 116 of file IFXQuery.cpp.

117{
118 bool r = true;
119
120/*
121 * EXEC SQL BEGIN DECLARE SECTION;
122 */
123#line 116 "ifxquery.ec"
124#line 117 "ifxquery.ec"
125 char *connID = conn()->connectionID();
126 char *stmtID = (_CONST char*)__statementID.data();
127 char *cursorID = (_CONST char*)__cursorID.data();
128/*
129 * EXEC SQL END DECLARE SECTION;
130 */
131#line 120 "ifxquery.ec"
132
133
134/*
135 * EXEC SQL SET CONNECTION :connID;
136 */
137#line 122 "ifxquery.ec"
138 {
139#line 122 "ifxquery.ec"
140 sqli_connect_set(0, connID, 0);
141#line 122 "ifxquery.ec"
142 }
143 if (r && SQLCODE < 0) {
144 __SET_ERROR_HANDLE(SQLCODE);
145 r = false;
146 }
147 __DCL_ASSERT(SQLCODE == 0);
148
149 if (__cursorOpened) {
150 __cursorOpened = false;
151/*
152 * EXEC SQL CLOSE :cursorID;
153 */
154#line 131 "ifxquery.ec"
155 {
156#line 131 "ifxquery.ec"
157 sqli_curs_close(ESQLINTVERSION, sqli_curs_locate(ESQLINTVERSION, cursorID, 256));
158#line 131 "ifxquery.ec"
159 }
160 if (r && SQLCODE < 0) {
161 __SET_ERROR_HANDLE(SQLCODE);
162 r = false;
163 }
164 }
165
166 if (__cursorDeclared) {
167 __cursorDeclared = false;
168/*
169 * EXEC SQL FREE :cursorID;
170 */
171#line 140 "ifxquery.ec"
172 {
173#line 140 "ifxquery.ec"
174 sqli_mt_free(cursorID);
175#line 140 "ifxquery.ec"
176 }
177 if (r && SQLCODE < 0) {
178 __SET_ERROR_HANDLE(SQLCODE);
179 r = false;
180 }
181 }
182
183#if __USE_STMT_TYPE
184 if (__stmtType != __SQ_UNKNOWN) {
185/*
186 * EXEC SQL FREE :stmtID;
187 */
188#line 149 "ifxquery.ec"
189 {
190#line 149 "ifxquery.ec"
191 sqli_mt_free(stmtID);
192#line 149 "ifxquery.ec"
193 }
194 __stmtType = __SQ_UNKNOWN;
195 }
196#else
197 if (__outSQLDA || __inSQLDA) {
198/*
199 * EXEC SQL FREE :stmtID;
200 */
201#line 154 "ifxquery.ec"
202 {
203#line 154 "ifxquery.ec"
204 sqli_mt_free(stmtID);
205#line 154 "ifxquery.ec"
206 }
207 if (r && SQLCODE < 0) {
208 __SET_ERROR_HANDLE(SQLCODE);
209 r = false;
210 }
211 }
212#endif
213
214 Query::__eof = true;
215 Query::__affectedRows = -1;
216
217 // clear fields
218 if (__fields) {
219 __DCL_ASSERT(Query::__fieldCount > 0);
220 delete[] __fields;
221 __fields = NULL;
222 Query::__fieldCount = 0;
223 }
224
225 // clear binds
226 if (__params) {
227 __DCL_ASSERT(Query::__paramCount > 0);
228 delete[] __params;
229 __params = NULL;
230 Query::__paramCount = 0;
231 }
232
233 if (__outBuffer) {
234 free(__outBuffer);
236 }
237
238 if (__outSQLDA) {
239 // __outSQLDA는 Informix API에서 할당됨.
242 }
243
244 if (__inSQLDA) {
246 __inSQLDA = NULL;
247 }
248
249 return r;
250}
#define __SQ_UNKNOWN
Definition IFXQuery.h:10
IOException *size_t r
Definition MediaInfo.cpp:82

Member Data Documentation

◆ __cursorDeclared

bool IFXQuery::__cursorDeclared
protected

Definition at line 36 of file IFXQuery.h.

◆ __cursorID

ByteString IFXQuery::__cursorID
protected

Definition at line 27 of file IFXQuery.h.

◆ __cursorOpened

bool IFXQuery::__cursorOpened
protected

Definition at line 37 of file IFXQuery.h.

◆ __fields

IFXField* IFXQuery::__fields
protected

Definition at line 40 of file IFXQuery.h.

◆ __inSQLDA

ifx_sqlda_t* IFXQuery::__inSQLDA
protected

Definition at line 32 of file IFXQuery.h.

◆ __outBuffer

char* IFXQuery::__outBuffer
protected

Definition at line 34 of file IFXQuery.h.

◆ __outSQLDA

ifx_sqlda_t* IFXQuery::__outSQLDA
protected

Definition at line 33 of file IFXQuery.h.

◆ __params

IFXParam* IFXQuery::__params
protected

Definition at line 39 of file IFXQuery.h.

◆ __statementID

ByteString IFXQuery::__statementID
protected

Definition at line 26 of file IFXQuery.h.


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