]> git.saurik.com Git - wxWidgets.git/blob - src/iodbc/catalog.c
Added facenames support to wxFont
[wxWidgets.git] / src / iodbc / catalog.c
1 /** Catalog functions of iODBC driver manager
2
3 Copyright (C) 1995 by Ke Jin <kejin@empress.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 **/
15
16 #include <../iodbc/iodbc.h>
17
18 #include <../iodbc/isql.h>
19 #include <../iodbc/isqlext.h>
20
21 #include <../iodbc/dlproc.h>
22
23 #include <../iodbc/herr.h>
24 #include <../iodbc/henv.h>
25 #include <../iodbc/hdbc.h>
26 #include <../iodbc/hstmt.h>
27
28 #include <../iodbc/itrace.h>
29
30 static RETCODE _iodbcdm_cata_state_ok (
31 HSTMT hstmt,
32 int fidx )
33 /* check state for executing catalog functions */
34 {
35 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
36 int sqlstat = en_00000;
37
38 if( pstmt->asyn_on == en_NullProc )
39 {
40 switch( pstmt->state )
41 {
42 case en_stmt_needdata:
43 case en_stmt_mustput:
44 case en_stmt_canput:
45 sqlstat = en_S1010;
46 break;
47
48 case en_stmt_fetched:
49 case en_stmt_xfetched:
50 sqlstat = en_24000;
51 break;
52
53 default:
54 break;
55 }
56 }
57 else if( pstmt->asyn_on != fidx )
58 {
59 sqlstat = en_S1010;
60 }
61
62 if( sqlstat != en_00000 )
63 {
64 PUSHSQLERR ( pstmt->herr, sqlstat );
65
66 return SQL_ERROR;
67 }
68
69 return SQL_SUCCESS;
70 }
71
72 static RETCODE _iodbcdm_cata_state_tr(
73 HSTMT hstmt,
74 int fidx,
75 RETCODE result )
76 /* state transition for catalog function */
77 {
78 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
79 DBC_t FAR* pdbc;
80
81 pdbc = (DBC_t FAR*)(pstmt->hdbc);
82
83 if( pstmt->asyn_on == fidx )
84 {
85 switch( result )
86 {
87 case SQL_SUCCESS:
88 case SQL_SUCCESS_WITH_INFO:
89 case SQL_ERROR:
90 pstmt->asyn_on = en_NullProc;
91 break;
92
93 case SQL_STILL_EXECUTING:
94 default:
95 return result;
96 }
97 }
98
99 if( pstmt->state <= en_stmt_executed )
100 {
101 switch( result )
102 {
103 case SQL_SUCCESS:
104 case SQL_SUCCESS_WITH_INFO:
105 pstmt->state = en_stmt_cursoropen;
106 break;
107
108 case SQL_ERROR:
109 pstmt->state = en_stmt_allocated;
110 pstmt->prep_state = 0;
111 break;
112
113 case SQL_STILL_EXECUTING:
114 pstmt->asyn_on = fidx;
115 break;
116
117 default:
118 break;
119 }
120 }
121
122 return result;
123 }
124
125 RETCODE SQL_API SQLGetTypeInfo(
126 HSTMT hstmt,
127 SWORD fSqlType )
128 {
129 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
130 HPROC hproc = SQL_NULL_HPROC;
131 int sqlstat = en_00000;
132 RETCODE retcode;
133
134 if( hstmt == SQL_NULL_HSTMT
135 || pstmt->hdbc == SQL_NULL_HDBC )
136 {
137 return SQL_INVALID_HANDLE;
138 }
139
140 for(;;)
141 {
142 if( fSqlType > SQL_TYPE_MAX )
143 {
144 sqlstat = en_S1004;
145 break;
146 }
147
148 if( fSqlType < SQL_TYPE_MIN
149 && fSqlType > SQL_TYPE_DRIVER_START )
150 /* Note: SQL_TYPE_DRIVER_START is a nagtive
151 * number So, we use ">" */
152 {
153 sqlstat = en_S1004;
154 break;
155 }
156
157 retcode = _iodbcdm_cata_state_ok( hstmt, en_GetTypeInfo );
158
159 if( retcode != SQL_SUCCESS )
160 {
161 return SQL_ERROR;
162 }
163
164 hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetTypeInfo );
165
166 if( hproc == SQL_NULL_HPROC )
167 {
168 sqlstat = en_IM001;
169 break;
170 }
171
172 sqlstat = en_00000;
173 if( 1 ) /* turn off solaris warning message */
174 break;
175 }
176
177 if( sqlstat != en_00000 )
178 {
179 PUSHSQLERR ( pstmt->herr, sqlstat );
180
181 return SQL_ERROR;
182 }
183
184 CALL_DRIVER ( pstmt->hdbc, retcode, hproc,
185 en_GetTypeInfo, ( pstmt->dhstmt, fSqlType) )
186
187 #if 0
188 retcode = hproc ( pstmt->dhstmt, fSqlType );
189 #endif
190
191 return _iodbcdm_cata_state_tr( hstmt, en_GetTypeInfo, retcode );
192 }
193
194 RETCODE SQL_API SQLSpecialColumns(
195 HSTMT hstmt,
196 UWORD fColType,
197 UCHAR FAR* szTableQualifier,
198 SWORD cbTableQualifier,
199 UCHAR FAR* szTableOwner,
200 SWORD cbTableOwner,
201 UCHAR FAR* szTableName,
202 SWORD cbTableName,
203 UWORD fScope,
204 UWORD fNullable )
205 {
206 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
207 HPROC hproc = SQL_NULL_HPROC;
208 RETCODE retcode;
209 int sqlstat = en_00000;
210
211 if( hstmt == SQL_NULL_HSTMT
212 || pstmt->hdbc == SQL_NULL_HDBC )
213 {
214 return SQL_INVALID_HANDLE;
215 }
216
217 for(;;)
218 {
219 if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
220 || ( cbTableOwner < 0 && cbTableOwner != SQL_NTS )
221 || ( cbTableName < 0 && cbTableName != SQL_NTS ) )
222 {
223 sqlstat = en_S1090;
224 break;
225 }
226
227 if( fColType != SQL_BEST_ROWID
228 && fColType != SQL_ROWVER )
229 {
230 sqlstat = en_S1097;
231 break;
232 }
233
234 if( fScope != SQL_SCOPE_CURROW
235 && fScope != SQL_SCOPE_TRANSACTION
236 && fScope != SQL_SCOPE_SESSION )
237 {
238 sqlstat = en_S1098;
239 break;
240 }
241
242 if( fNullable != SQL_NO_NULLS
243 && fNullable != SQL_NULLABLE )
244 {
245 sqlstat = en_S1099;
246 break;
247 }
248
249 retcode = _iodbcdm_cata_state_ok ( hstmt, en_SpecialColumns );
250
251 if( retcode != SQL_SUCCESS )
252 {
253 return SQL_ERROR;
254 }
255
256 hproc = _iodbcdm_getproc( pstmt->hdbc, en_SpecialColumns );
257
258 if( hproc == SQL_NULL_HPROC )
259 {
260 sqlstat = en_IM001;
261 break;
262 }
263
264 sqlstat = en_00000;
265 if( 1 ) /* turn off solaris warning message */
266 break;
267 }
268
269 if( sqlstat != en_00000 )
270 {
271 PUSHSQLERR ( pstmt->herr, sqlstat );
272
273 return SQL_ERROR;
274 }
275
276 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SpecialColumns, (
277 pstmt->dhstmt,
278 fColType,
279 szTableQualifier,
280 cbTableQualifier,
281 szTableOwner,
282 cbTableOwner,
283 szTableName,
284 cbTableName,
285 fScope,
286 fNullable ) )
287
288 #if 0
289 retcode = hproc(pstmt->dhstmt,
290 fColType,
291 szTableQualifier,
292 cbTableQualifier,
293 szTableOwner,
294 cbTableOwner,
295 szTableName,
296 cbTableName,
297 fScope,
298 fNullable );
299 #endif
300
301 return _iodbcdm_cata_state_tr( hstmt, en_SpecialColumns, retcode );
302 }
303
304 RETCODE SQL_API SQLStatistics(
305 HSTMT hstmt,
306 UCHAR FAR* szTableQualifier,
307 SWORD cbTableQualifier,
308 UCHAR FAR* szTableOwner,
309 SWORD cbTableOwner,
310 UCHAR FAR* szTableName,
311 SWORD cbTableName,
312 UWORD fUnique,
313 UWORD fAccuracy )
314 {
315 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
316 HPROC hproc = SQL_NULL_HPROC;
317 RETCODE retcode;
318 int sqlstat = en_00000;
319
320 if( hstmt == SQL_NULL_HSTMT
321 || pstmt->hdbc == SQL_NULL_HDBC )
322 {
323 return SQL_INVALID_HANDLE;
324 }
325
326 for(;;)
327 {
328 if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
329 || ( cbTableOwner < 0 && cbTableOwner != SQL_NTS )
330 || ( cbTableName < 0 && cbTableName != SQL_NTS ) )
331 {
332 sqlstat = en_S1090;
333 break;
334 }
335
336 if( fUnique != SQL_INDEX_UNIQUE
337 && fUnique != SQL_INDEX_ALL )
338 {
339 sqlstat = en_S1100;
340 break;
341 }
342
343 if( fAccuracy != SQL_ENSURE
344 && fAccuracy != SQL_QUICK )
345 {
346 sqlstat = en_S1101;
347 break;
348 }
349
350 retcode = _iodbcdm_cata_state_ok ( hstmt, en_Statistics );
351
352 if( retcode != SQL_SUCCESS )
353 {
354 return SQL_ERROR;
355 }
356
357 hproc = _iodbcdm_getproc( pstmt->hdbc, en_Statistics );
358
359 if( hproc == SQL_NULL_HPROC )
360 {
361 sqlstat = en_IM001;
362 break;
363 }
364
365 sqlstat = en_00000;
366
367 if( 1 ) /* turn off solaris warning message */
368 break;
369 }
370
371 if( sqlstat != en_00000 )
372 {
373 PUSHSQLERR ( pstmt->herr, sqlstat );
374
375 return SQL_ERROR;
376 }
377
378 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Statistics, (
379 pstmt->dhstmt,
380 szTableQualifier,
381 cbTableQualifier,
382 szTableOwner,
383 cbTableOwner,
384 szTableName,
385 cbTableName,
386 fUnique,
387 fAccuracy ) )
388
389 #if 0
390 retcode = hproc(pstmt->dhstmt,
391 szTableQualifier,
392 cbTableQualifier,
393 szTableOwner,
394 cbTableOwner,
395 szTableName,
396 cbTableName,
397 fUnique,
398 fAccuracy );
399 #endif
400
401 return _iodbcdm_cata_state_tr( hstmt, en_Statistics, retcode );
402 }
403
404 RETCODE SQL_API SQLTables(
405 HSTMT hstmt,
406 UCHAR FAR* szTableQualifier,
407 SWORD cbTableQualifier,
408 UCHAR FAR* szTableOwner,
409 SWORD cbTableOwner,
410 UCHAR FAR* szTableName,
411 SWORD cbTableName,
412 UCHAR FAR* szTableType,
413 SWORD cbTableType )
414 {
415 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
416 HPROC hproc = SQL_NULL_HPROC;
417 RETCODE retcode;
418 int sqlstat = en_00000;
419
420 if( hstmt == SQL_NULL_HSTMT
421 || pstmt->hdbc == SQL_NULL_HDBC )
422 {
423 return SQL_INVALID_HANDLE;
424 }
425
426 for(;;)
427 {
428 if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
429 || ( cbTableOwner < 0 && cbTableOwner != SQL_NTS )
430 || ( cbTableName < 0 && cbTableName != SQL_NTS )
431 || ( cbTableType < 0 && cbTableType != SQL_NTS ) )
432 {
433 sqlstat = en_S1090;
434 break;
435 }
436
437 retcode = _iodbcdm_cata_state_ok ( hstmt, en_Tables );
438
439 if( retcode != SQL_SUCCESS )
440 {
441 return SQL_ERROR;
442 }
443
444 hproc = _iodbcdm_getproc( pstmt->hdbc, en_Tables );
445
446 if( hproc == SQL_NULL_HPROC )
447 {
448 sqlstat = en_IM001;
449 break;
450 }
451
452 sqlstat = en_00000;
453
454 if( 1 ) /* turn off solaris warning message */
455 break;
456 }
457
458 if( sqlstat != en_00000 )
459 {
460 PUSHSQLERR ( pstmt->herr, sqlstat );
461
462 return SQL_ERROR;
463 }
464
465 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Tables, (
466 pstmt->dhstmt,
467 szTableQualifier,
468 cbTableQualifier,
469 szTableOwner,
470 cbTableOwner,
471 szTableName,
472 cbTableName,
473 szTableType,
474 cbTableType ) )
475
476 #if 0
477 retcode = hproc(pstmt->dhstmt,
478 szTableQualifier,
479 cbTableQualifier,
480 szTableOwner,
481 cbTableOwner,
482 szTableName,
483 cbTableName,
484 szTableType,
485 cbTableType );
486 #endif
487
488 return _iodbcdm_cata_state_tr( hstmt, en_Tables, retcode );
489 }
490
491 RETCODE SQL_API SQLColumnPrivileges(
492 HSTMT hstmt,
493 UCHAR FAR* szTableQualifier,
494 SWORD cbTableQualifier,
495 UCHAR FAR* szTableOwner,
496 SWORD cbTableOwner,
497 UCHAR FAR* szTableName,
498 SWORD cbTableName,
499 UCHAR FAR* szColumnName,
500 SWORD cbColumnName )
501 {
502 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
503 HPROC hproc = SQL_NULL_HPROC;
504 RETCODE retcode;
505 int sqlstat = en_00000;
506
507 if( hstmt == SQL_NULL_HSTMT
508 || pstmt->hdbc == SQL_NULL_HDBC )
509 {
510 return SQL_INVALID_HANDLE;
511 }
512
513 for(;;)
514 {
515 if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
516 || ( cbTableOwner < 0 && cbTableOwner != SQL_NTS )
517 || ( cbTableName < 0 && cbTableName != SQL_NTS )
518 || ( cbColumnName < 0 && cbColumnName != SQL_NTS ) )
519 {
520 sqlstat = en_S1090;
521 break;
522 }
523
524 retcode = _iodbcdm_cata_state_ok ( hstmt, en_ColumnPrivileges );
525
526 if( retcode != SQL_SUCCESS )
527 {
528 return SQL_ERROR;
529 }
530
531 hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColumnPrivileges );
532
533 if( hproc == SQL_NULL_HPROC )
534 {
535 sqlstat = en_IM001;
536 break;
537 }
538
539 sqlstat = en_00000;
540
541 if( 1 ) /* turn off solaris warning message */
542 break;
543 }
544
545 if( sqlstat != en_00000 )
546 {
547 PUSHSQLERR ( pstmt->herr, sqlstat );
548
549 return SQL_ERROR;
550 }
551
552 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ColumnPrivileges, (
553 pstmt->dhstmt,
554 szTableQualifier,
555 cbTableQualifier,
556 szTableOwner,
557 cbTableOwner,
558 szTableName,
559 cbTableName,
560 szColumnName,
561 cbColumnName ) )
562
563 #if 0
564 retcode = hproc(pstmt->dhstmt,
565 szTableQualifier,
566 cbTableQualifier,
567 szTableOwner,
568 cbTableOwner,
569 szTableName,
570 cbTableName,
571 szColumnName,
572 cbColumnName );
573 #endif
574
575 return _iodbcdm_cata_state_tr( hstmt, en_ColumnPrivileges, retcode );
576 }
577
578 RETCODE SQL_API SQLColumns(
579 HSTMT hstmt,
580 UCHAR FAR* szTableQualifier,
581 SWORD cbTableQualifier,
582 UCHAR FAR* szTableOwner,
583 SWORD cbTableOwner,
584 UCHAR FAR* szTableName,
585 SWORD cbTableName,
586 UCHAR FAR* szColumnName,
587 SWORD cbColumnName )
588 {
589 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
590 HPROC hproc = SQL_NULL_HPROC;
591 RETCODE retcode;
592 int sqlstat = en_00000;
593
594 if( hstmt == SQL_NULL_HSTMT
595 || pstmt->hdbc == SQL_NULL_HDBC )
596 {
597 return SQL_INVALID_HANDLE;
598 }
599
600 for(;;)
601 {
602 if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
603 || ( cbTableOwner < 0 && cbTableOwner != SQL_NTS )
604 || ( cbTableName < 0 && cbTableName != SQL_NTS )
605 || ( cbColumnName < 0 && cbColumnName != SQL_NTS ) )
606 {
607 sqlstat = en_S1090;
608 break;
609 }
610
611 retcode = _iodbcdm_cata_state_ok ( hstmt, en_Columns );
612
613 if( retcode != SQL_SUCCESS )
614 {
615 return SQL_ERROR;
616 }
617
618 hproc = _iodbcdm_getproc( pstmt->hdbc, en_Columns );
619
620 if( hproc == SQL_NULL_HPROC )
621 {
622 sqlstat = en_IM001;
623 break;
624 }
625
626 sqlstat = en_00000;
627
628 if( 1 ) /* turn off solaris warning message */
629 break;
630 }
631
632 if( sqlstat != en_00000 )
633 {
634 PUSHSQLERR ( pstmt->herr, sqlstat );
635
636 return SQL_ERROR;
637 }
638
639 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Columns, (
640 pstmt->dhstmt,
641 szTableQualifier,
642 cbTableQualifier,
643 szTableOwner,
644 cbTableOwner,
645 szTableName,
646 cbTableName,
647 szColumnName,
648 cbColumnName ) )
649
650 #if 0
651 retcode = hproc(pstmt->dhstmt,
652 szTableQualifier,
653 cbTableQualifier,
654 szTableOwner,
655 cbTableOwner,
656 szTableName,
657 cbTableName,
658 szColumnName,
659 cbColumnName );
660 #endif
661
662 return _iodbcdm_cata_state_tr( hstmt, en_Columns, retcode );
663 }
664
665 RETCODE SQL_API SQLForeignKeys(
666 HSTMT hstmt,
667 UCHAR FAR* szPkTableQualifier,
668 SWORD cbPkTableQualifier,
669 UCHAR FAR* szPkTableOwner,
670 SWORD cbPkTableOwner,
671 UCHAR FAR* szPkTableName,
672 SWORD cbPkTableName,
673 UCHAR FAR* szFkTableQualifier,
674 SWORD cbFkTableQualifier,
675 UCHAR FAR* szFkTableOwner,
676 SWORD cbFkTableOwner,
677 UCHAR FAR* szFkTableName,
678 SWORD cbFkTableName )
679 {
680 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
681 HPROC hproc = SQL_NULL_HPROC;
682 RETCODE retcode;
683 int sqlstat = en_00000;
684
685 if( hstmt == SQL_NULL_HSTMT
686 || pstmt->hdbc == SQL_NULL_HDBC )
687 {
688 return SQL_INVALID_HANDLE;
689 }
690
691 for(;;)
692 {
693 if( ( cbPkTableQualifier < 0 && cbPkTableQualifier != SQL_NTS )
694 || ( cbPkTableOwner < 0 && cbPkTableOwner != SQL_NTS )
695 || ( cbPkTableName < 0 && cbPkTableName != SQL_NTS )
696 || ( cbFkTableQualifier < 0 && cbFkTableQualifier != SQL_NTS )
697 || ( cbFkTableOwner < 0 && cbFkTableOwner != SQL_NTS )
698 || ( cbFkTableName < 0 && cbFkTableName != SQL_NTS ) )
699 {
700 sqlstat = en_S1090;
701 break;
702 }
703
704 retcode = _iodbcdm_cata_state_ok ( hstmt, en_ForeignKeys );
705
706 if( retcode != SQL_SUCCESS )
707 {
708 return SQL_ERROR;
709 }
710
711 hproc = _iodbcdm_getproc( pstmt->hdbc, en_ForeignKeys );
712
713 if( hproc == SQL_NULL_HPROC )
714 {
715 sqlstat = en_IM001;
716 break;
717 }
718
719 sqlstat = en_00000;
720
721 if( 1 ) /* turn off solaris warning message */
722 break;
723 }
724
725 if( sqlstat != en_00000 )
726 {
727 PUSHSQLERR ( pstmt->herr, sqlstat );
728
729 return SQL_ERROR;
730 }
731
732 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ForeignKeys, (
733 pstmt->dhstmt,
734 szPkTableQualifier,
735 cbPkTableQualifier,
736 szPkTableOwner,
737 cbPkTableOwner,
738 szPkTableName,
739 cbPkTableName,
740 szFkTableQualifier,
741 cbFkTableQualifier,
742 szFkTableOwner,
743 cbFkTableOwner,
744 szFkTableName,
745 cbFkTableName ) )
746
747 #if 0
748 retcode = hproc(pstmt->dhstmt,
749 szPkTableQualifier,
750 cbPkTableQualifier,
751 szPkTableOwner,
752 cbPkTableOwner,
753 szPkTableName,
754 cbPkTableName,
755 szFkTableQualifier,
756 cbFkTableQualifier,
757 szFkTableOwner,
758 cbFkTableOwner,
759 szFkTableName,
760 cbFkTableName );
761 #endif
762
763 return _iodbcdm_cata_state_tr( hstmt, en_ForeignKeys, retcode );
764 }
765
766 RETCODE SQL_API SQLPrimaryKeys(
767 HSTMT hstmt,
768 UCHAR FAR* szTableQualifier,
769 SWORD cbTableQualifier,
770 UCHAR FAR* szTableOwner,
771 SWORD cbTableOwner,
772 UCHAR FAR* szTableName,
773 SWORD cbTableName )
774 {
775 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
776 HPROC hproc = SQL_NULL_HPROC;
777 RETCODE retcode;
778 int sqlstat = en_00000;
779
780 if( hstmt == SQL_NULL_HSTMT
781 || pstmt->hdbc == SQL_NULL_HDBC )
782 {
783 return SQL_INVALID_HANDLE;
784 }
785
786 for(;;)
787 {
788 if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
789 || ( cbTableOwner < 0 && cbTableOwner != SQL_NTS )
790 || ( cbTableName < 0 && cbTableName != SQL_NTS ) )
791 {
792 sqlstat = en_S1090;
793 break;
794 }
795
796 retcode = _iodbcdm_cata_state_ok ( hstmt, en_PrimaryKeys );
797
798 if( retcode != SQL_SUCCESS )
799 {
800 return SQL_ERROR;
801 }
802
803 hproc = _iodbcdm_getproc( pstmt->hdbc, en_PrimaryKeys );
804
805 if( hproc == SQL_NULL_HPROC )
806 {
807 sqlstat = en_IM001;
808 break;
809 }
810
811 sqlstat = en_00000;
812
813 if( 1 ) /* turn off solaris warning message */
814 break;
815 }
816
817 if( sqlstat != en_00000 )
818 {
819 PUSHSQLERR ( pstmt->herr, sqlstat );
820
821 return SQL_ERROR;
822 }
823
824 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_PrimaryKeys, (
825 pstmt->dhstmt,
826 szTableQualifier,
827 cbTableQualifier,
828 szTableOwner,
829 cbTableOwner,
830 szTableName,
831 cbTableName ) )
832
833 #if 0
834 retcode = hproc(pstmt->dhstmt,
835 szTableQualifier,
836 cbTableQualifier,
837 szTableOwner,
838 cbTableOwner,
839 szTableName,
840 cbTableName );
841 #endif
842
843 return _iodbcdm_cata_state_tr( hstmt, en_PrimaryKeys, retcode );
844 }
845
846 RETCODE SQL_API SQLProcedureColumns(
847 HSTMT hstmt,
848 UCHAR FAR* szProcQualifier,
849 SWORD cbProcQualifier,
850 UCHAR FAR* szProcOwner,
851 SWORD cbProcOwner,
852 UCHAR FAR* szProcName,
853 SWORD cbProcName,
854 UCHAR FAR* szColumnName,
855 SWORD cbColumnName )
856 {
857 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
858 HPROC hproc = SQL_NULL_HPROC;
859 RETCODE retcode;
860 int sqlstat = en_00000;
861
862 if( hstmt == SQL_NULL_HSTMT
863 || pstmt->hdbc == SQL_NULL_HDBC )
864 {
865 return SQL_INVALID_HANDLE;
866 }
867
868 for(;;)
869 {
870 if( ( cbProcQualifier < 0 && cbProcQualifier != SQL_NTS )
871 || ( cbProcOwner < 0 && cbProcOwner != SQL_NTS )
872 || ( cbProcName < 0 && cbProcName != SQL_NTS )
873 || ( cbColumnName < 0 && cbColumnName != SQL_NTS ) )
874 {
875 sqlstat = en_S1090;
876 break;
877 }
878
879 retcode = _iodbcdm_cata_state_ok ( hstmt, en_ProcedureColumns );
880
881 if( retcode != SQL_SUCCESS )
882 {
883 return SQL_ERROR;
884 }
885
886 hproc = _iodbcdm_getproc( pstmt->hdbc, en_ProcedureColumns );
887
888 if( hproc == SQL_NULL_HPROC )
889 {
890 sqlstat = en_IM001;
891 break;
892 }
893
894 sqlstat = en_00000;
895
896 if( 1 ) /* turn off solaris warning message */
897 break;
898 }
899
900 if( sqlstat != en_00000 )
901 {
902 PUSHSQLERR ( pstmt->herr, sqlstat );
903
904 return SQL_ERROR;
905 }
906
907 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ProcedureColumns, (
908 pstmt->dhstmt,
909 szProcQualifier,
910 cbProcQualifier,
911 szProcOwner,
912 cbProcOwner,
913 szProcName,
914 cbProcName,
915 szColumnName,
916 cbColumnName ) )
917
918 #if 0
919 retcode = hproc(pstmt->dhstmt,
920 szProcQualifier,
921 cbProcQualifier,
922 szProcOwner,
923 cbProcOwner,
924 szProcName,
925 cbProcName,
926 szColumnName,
927 cbColumnName );
928 #endif
929
930 return _iodbcdm_cata_state_tr( hstmt, en_ProcedureColumns, retcode );
931 }
932
933 RETCODE SQL_API SQLProcedures(
934 HSTMT hstmt,
935 UCHAR FAR* szProcQualifier,
936 SWORD cbProcQualifier,
937 UCHAR FAR* szProcOwner,
938 SWORD cbProcOwner,
939 UCHAR FAR* szProcName,
940 SWORD cbProcName )
941 {
942 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
943 HPROC hproc = SQL_NULL_HPROC;
944 RETCODE retcode;
945 int sqlstat = en_00000;
946
947 if( hstmt == SQL_NULL_HSTMT
948 || pstmt->hdbc == SQL_NULL_HDBC )
949 {
950 return SQL_INVALID_HANDLE;
951 }
952
953 for(;;)
954 {
955 if( ( cbProcQualifier < 0 && cbProcQualifier != SQL_NTS )
956 || ( cbProcOwner < 0 && cbProcOwner != SQL_NTS )
957 || ( cbProcName < 0 && cbProcName != SQL_NTS ) )
958 {
959 sqlstat = en_S1090;
960 break;
961 }
962
963 retcode = _iodbcdm_cata_state_ok ( hstmt, en_Procedures );
964
965 if( retcode != SQL_SUCCESS )
966 {
967 return SQL_ERROR;
968 }
969
970 hproc = _iodbcdm_getproc( pstmt->hdbc, en_Procedures );
971
972 if( hproc == SQL_NULL_HPROC )
973 {
974 sqlstat = en_IM001;
975 break;
976 }
977
978 sqlstat = en_00000;
979
980 if( 1 ) /* turn off solaris warning message */
981 break;
982 }
983
984 if( sqlstat != en_00000 )
985 {
986 PUSHSQLERR ( pstmt->herr, sqlstat );
987
988 return SQL_ERROR;
989 }
990
991 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Procedures, (
992 pstmt->dhstmt,
993 szProcQualifier,
994 cbProcQualifier,
995 szProcOwner,
996 cbProcOwner,
997 szProcName,
998 cbProcName ) )
999
1000 #if 0
1001 retcode = hproc(pstmt->dhstmt,
1002 szProcQualifier,
1003 cbProcQualifier,
1004 szProcOwner,
1005 cbProcOwner,
1006 szProcName,
1007 cbProcName );
1008 #endif
1009
1010 return _iodbcdm_cata_state_tr( hstmt, en_Procedures, retcode );
1011 }
1012
1013 RETCODE SQL_API SQLTablePrivileges(
1014 HSTMT hstmt,
1015 UCHAR FAR* szTableQualifier,
1016 SWORD cbTableQualifier,
1017 UCHAR FAR* szTableOwner,
1018 SWORD cbTableOwner,
1019 UCHAR FAR* szTableName,
1020 SWORD cbTableName )
1021 {
1022
1023 STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
1024 HPROC hproc = SQL_NULL_HPROC;
1025 RETCODE retcode;
1026 int sqlstat = en_00000;
1027
1028 if( hstmt == SQL_NULL_HSTMT
1029 || pstmt->hdbc == SQL_NULL_HDBC )
1030 {
1031 return SQL_INVALID_HANDLE;
1032 }
1033
1034 for(;;)
1035 {
1036 if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
1037 || ( cbTableOwner < 0 && cbTableOwner != SQL_NTS )
1038 || ( cbTableName < 0 && cbTableName != SQL_NTS ) )
1039 {
1040 sqlstat = en_S1090;
1041 break;
1042 }
1043
1044 retcode = _iodbcdm_cata_state_ok ( hstmt, en_TablePrivileges );
1045
1046 if( retcode != SQL_SUCCESS )
1047 {
1048 return SQL_ERROR;
1049 }
1050
1051 hproc = _iodbcdm_getproc( pstmt->hdbc, en_TablePrivileges );
1052
1053 if( hproc == SQL_NULL_HPROC )
1054 {
1055 sqlstat = en_IM001;
1056 break;
1057 }
1058
1059 sqlstat = en_00000;
1060
1061 if( 1 ) /* turn off solaris warning message */
1062 break;
1063 }
1064
1065 if( sqlstat != en_00000 )
1066 {
1067 PUSHSQLERR ( pstmt->herr, sqlstat );
1068
1069 return SQL_ERROR;
1070 }
1071
1072 CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_TablePrivileges, (
1073 pstmt->dhstmt,
1074 szTableQualifier,
1075 cbTableQualifier,
1076 szTableOwner,
1077 cbTableOwner,
1078 szTableName,
1079 cbTableName ) )
1080
1081 #if 0
1082 retcode = hproc(pstmt->dhstmt,
1083 szTableQualifier,
1084 cbTableQualifier,
1085 szTableOwner,
1086 cbTableOwner,
1087 szTableName,
1088 cbTableName );
1089 #endif
1090
1091 return _iodbcdm_cata_state_tr( hstmt, en_TablePrivileges, retcode );
1092 }