DCL 3.7.4
Loading...
Searching...
No Matches
IFXQuery.cpp
Go to the documentation of this file.
1#line 1 "ifxquery.ec"
2#include <dcl/Config.h>
3
4#include <sqlhdr.h>
5#include <sqliapi.h>
6
7#include <sqlda.h>
8#include <sqlstype.h>
9#include <sqltypes.h>
10
11#include <stdlib.h> // malloc, free
12#include <string.h> // memset
13
14#include <dcl/Object.h>
15#if __DCL_HAVE_ALLOC_DEBUG
16#undef __DCL_ALLOC_LEVEL
17#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
18#endif
19
20#include <dcl/Numeric.h>
21#include <dcl/SQLCore.h>
22
23#include "IFXConnection.h"
24#include "IFXQuery.h"
25#include "IFXField.h"
26#include "IFXParam.h"
27#include "IFXUtils.h" // for void ndebug_free(void* _pv)
28
29#define __TRACE_THIS 0
30#if __TRACE_THIS
31#define __DCL_TRACE0_N __DCL_TRACE0
32#define __DCL_TRACE1_N __DCL_TRACE1
33#define __DCL_TRACE2_N __DCL_TRACE2
34#define __DCL_TRACE3_N __DCL_TRACE3
35#define __DCL_TRACE4_N __DCL_TRACE4
36#else
37#define __DCL_TRACE0_N(fmt)
38#define __DCL_TRACE1_N(fmt, arg)
39#define __DCL_TRACE2_N(fmt, arg1, arg2)
40#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
41#define __DCL_TRACE4_N(fmt, arg1, arg2, arg3, arg4)
42#endif
43
44#undef __THIS_FILE__
45static const char_t __THIS_FILE__[] = __T("dcl/sql/IFXQuery.ec");
46
47__DCL_BEGIN_NAMESPACE
48
49#define __SET_ERROR(_error) \
50 conn()->setErrorHandle(_error, 0L, __THIS_FILE__, __LINE__)
51#define __SET_ERROR_HANDLE(_SQLCODE) \
52 conn()->setErrorHandle(SQL::eServerError, _SQLCODE, __THIS_FILE__, __LINE__)
53#define __SET_ERROR_MSG(_message) \
54 conn()->setErrorMessage(_message, __THIS_FILE__, __LINE__)
55
57
58#if defined(__DCL_DEBUG) && __TRACE_THIS
59#define __SQ_NAME(_sq) case _sq: return L ## #_sq;
60static const wchar_t* __STMT_STRING(int _sq)
61{
62 switch (_sq) {
63 __SQ_NAME(SQ_SELECT)
64 __SQ_NAME(SQ_UPDATE)
65 __SQ_NAME(SQ_DELETE)
66 __SQ_NAME(SQ_INSERT)
67 __SQ_NAME(SQ_EXECPROC)
68 }
69 return L"SQ_OTHER..";
70}
71#endif
72
74 : Query(_connection)
75{
76 ByteString strID;
77 strID = ByteString::format("%zx", (size_t)this);
78 __statementID = "stmt_" + strID;
79 __cursorID = "curs_" + strID;
80
81#if __USE_STMT_TYPE
82 __stmtType = __SQ_UNKNOWN;
83#endif
84 __inSQLDA = NULL;
85 __outSQLDA = NULL;
86 __outBuffer = NULL;
87
88 __cursorOpened = false;
89 __cursorDeclared = false;
90
91 __fields = NULL;
92 __params = NULL;
93}
94
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}
109
111{
112// cerr << "IFXQuery::destory\n";
113 delete this;
114}
115
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}
251
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}
332
333bool IFXQuery::initParams(size_t _paramCount)
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}
358
359bool IFXQuery::__prepare(const char* _sql, size_t _sqllen,
360 size_t _paramCount)
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}
484
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}
659
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}
736
737bool IFXQuery::__getField(size_t _index, SQL::Field** _fieldHandleOut)
738{
739 __DCL_ASSERT(Query::__fieldCount > 0);
740 __DCL_ASSERT((0 <= _index) && (_index < Query::__fieldCount));
741 *_fieldHandleOut = &__fields[_index];
742 return true;
743}
744
745bool IFXQuery::__getParam(size_t _index, SQL::Param** _paramHandleOut)
746{
747 __DCL_ASSERT(Query::__paramCount > 0);
748 __DCL_ASSERT((0 <= _index) && (_index < Query::__paramCount));
749 *_paramHandleOut = &__params[_index];
750 return true;
751}
752
753__DCL_END_NAMESPACE
754
755#line 548 "ifxquery.ec"
#define __THIS_FILE__
Definition _trace.h:14
#define NULL
Definition Config.h:312
wchar_t char_t
Definition Config.h:247
#define _CONST
Definition Config.h:325
#define __DCL_TRACE1_N(fmt, arg)
#define __DCL_TRACE2_N(fmt, arg1, arg2)
#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
#define __DCL_TRACE4_N(fmt, arg1, arg2, arg3, arg4)
#define __SET_ERROR_HANDLE(_SQLCODE)
int mint
Definition IFXParam.cpp:11
#define __SQ_UNKNOWN
Definition IFXQuery.h:10
#define ndebug_free(_p)
Definition IFXUtils.h:23
IOException *size_t r
Definition MediaInfo.cpp:82
#define __DCL_TRACE1(fmt, arg1)
Definition Object.h:399
#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
#define __SET_ERROR(_errorCode)
Definition SQLCore.cpp:149
bool __cursorOpened
Definition IFXQuery.h:37
virtual bool __prepare(const char *_sql, size_t _sqllen, size_t _paramCount)
Definition IFXQuery.cpp:359
virtual bool __execute()
Definition IFXQuery.cpp:485
IFXParam * __params
Definition IFXQuery.h:39
IFXQuery(IFXConnection *_connection)
IFXField * __fields
Definition IFXQuery.h:40
virtual bool __getField(size_t _index, SQL::Field **_fieldHandleOut)
Definition IFXQuery.cpp:737
ifx_sqlda_t * __inSQLDA
Definition IFXQuery.h:32
bool initFields()
Definition IFXQuery.cpp:252
virtual ~IFXQuery()
Definition IFXQuery.cpp:95
char * __outBuffer
Definition IFXQuery.h:34
virtual bool __getParam(size_t _index, SQL::Param **_paramHandleOut)
Definition IFXQuery.cpp:745
virtual void __destroy()
Definition IFXQuery.cpp:110
bool initParams(size_t _paramCount)
Definition IFXQuery.cpp:333
virtual bool __fetch()
Definition IFXQuery.cpp:660
ByteString __statementID
Definition IFXQuery.h:21
bool __cursorDeclared
Definition IFXQuery.h:36
bool reset()
Definition IFXQuery.cpp:116
ifx_sqlda_t * __outSQLDA
Definition IFXQuery.h:33
ByteString __cursorID
Definition IFXQuery.h:27
bool __eof
Definition SQLCore.h:303
@ eOutOfMemory
Definition SQLCore.h:24