File: prguid18.htm

package info (click to toggle)
solid-doc 2.2-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 3,436 kB
  • ctags: 11,371
  • sloc: makefile: 58; sh: 2
file content (3319 lines) | stat: -rw-r--r-- 118,470 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
<HTML>
<HEAD>
<TITLE>prguide.htm</TITLE>
<LINK REL="ToC" HREF="httoc.htm">
<LINK REL="Index" HREF="htindex.htm">
<LINK REL="Next" HREF="prguid19.htm">
<LINK REL="Previous" HREF="prguid17.htm"></HEAD>
<BODY BGCOLOR="#FFFFFF">
<P ALIGN=CENTER>
<A HREF="prguid17.htm" TARGET="_self"><IMG SRC="graprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="httoc.htm" TARGET="_self"><IMG SRC="gratoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="htindex.htm" TARGET="_self"><IMG SRC="graindex.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Index"></A>
<A HREF="prguid19.htm" TARGET="_self"><IMG SRC="granext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>
<HR ALIGN=CENTER>
<P>
<UL>
<UL>
<LI>
<A HREF="#E74E5" >SQLExtendedFetch (ODBC 1.0, Level 2)</A>
<UL>
<LI>
<A HREF="#E11E161" >Syntax</A>
<LI>
<A HREF="#E11E162" >Returns</A>
<LI>
<A HREF="#E11E163" >Diagnostics</A>
<LI>
<A HREF="#E11E164" >Comments</A>
<UL>
<LI>
<A HREF="#E12E51" >Binding</A>
<LI>
<A HREF="#E12E52" >Positioning the Cursor</A>
<LI>
<A HREF="#E12E53" >Processing Errors</A>
<LI>
<A HREF="#E12E54" >fFetchType Argument</A>
<LI>
<A HREF="#E12E55" >irow Argument</A>
<LI>
<A HREF="#E12E56" >rgfRowStatus Argument</A></UL>
<LI>
<A HREF="#E11E165" >Code Example</A>
<LI>
<A HREF="#E11E166" >Related Functions</A></UL>
<LI>
<A HREF="#E10E80" >SQLFetch (ODBC 1.0, Core)</A>
<UL>
<LI>
<A HREF="#E11E167" >Syntax</A>
<LI>
<A HREF="#E11E168" >Returns</A>
<LI>
<A HREF="#E11E169" >Diagnostics</A>
<LI>
<A HREF="#E11E170" >Comments</A>
<LI>
<A HREF="#E11E171" >Code Example</A>
<LI>
<A HREF="#E11E172" >Related Functions</A></UL>
<LI>
<A HREF="#E10E81" >SQLFetchPrev (SOLID Extension)</A>
<UL>
<LI>
<A HREF="#E11E173" >Syntax</A>
<LI>
<A HREF="#E11E174" >Returns</A>
<LI>
<A HREF="#E11E175" >Diagnostics</A>
<LI>
<A HREF="#E11E176" >Comments</A>
<LI>
<A HREF="#E11E177" >Code Example</A>
<LI>
<A HREF="#E11E178" >Related Functions</A></UL>
<LI>
<A HREF="#E10E82" >SQLForeignKeys (ODBC 1.0, Level 2)</A>
<UL>
<LI>
<A HREF="#E11E179" >Syntax</A>
<LI>
<A HREF="#E11E180" >Returns</A>
<LI>
<A HREF="#E11E181" >Diagnostics</A>
<LI>
<A HREF="#E11E182" >Comments</A>
<LI>
<A HREF="#E11E183" >Code Example</A>
<LI>
<A HREF="#E11E184" >Related Functions</A></UL>
<LI>
<A HREF="#E10E83" >SQLFreeConnect (ODBC 1.0, Core)</A>
<UL>
<LI>
<A HREF="#E11E185" >Syntax</A>
<LI>
<A HREF="#E11E186" >Returns</A>
<LI>
<A HREF="#E11E187" >Diagnostics</A>
<LI>
<A HREF="#E11E188" >Comments</A>
<LI>
<A HREF="#E11E189" >Code Example</A>
<LI>
<A HREF="#E11E190" >Related Functions</A></UL></UL></UL>
<HR ALIGN=CENTER>
<A NAME="E74E5"></A>
<H2>
<FONT FACE="Arial"><B>SQLExtendedFetch (ODBC 1.0, Level 2)</B><A NAME="I2"></A></FONT></H2>
<BLOCKQUOTE>
<P><B>SQLExtendedFetch</B> extends the functionality of <B>SQLFetch</B> in the following ways:<A NAME="I3"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>It returns rowset data (one or more rows), in the form of an array, for each bound column.<A NAME="I4"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>It scrolls through the result set according to the setting of a scroll-type argument.<A NAME="I5"></A>
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P><B>SQLExtendedFetch</B> works in conjunction with <B>SQLSetStmtOption</B>.<A NAME="I6"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>To fetch one row of data at a time in a forward direction, an application should call <B>SQLFetch</B>.<A NAME="I7"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For more information about scrolling through result sets, see &quot;Using Block and Scrollable Cursors&quot; in Chapter 7, &quot;Retrieving Results.&quot;
</BLOCKQUOTE>
<A NAME="E11E161"></A>
<H3>
<FONT FACE="Arial">Syntax</FONT></H3>
<BLOCKQUOTE>
<P>RETCODE <B>SQLExtendedFetch</B>(<I>hstmt</I>, <I>fFetchType</I>, <I>irow</I>, <I>pcrow</I>, <I>rgfRowStatus</I>)<A NAME="I8"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <B>SQLExtendedFetch</B> function accepts the following arguments:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=80 VALIGN=top >
<BLOCKQUOTE>
<P><B>Type</B>
</BLOCKQUOTE></TD>
<TD WIDTH=86 VALIGN=top >
<A NAME="E7E772"></A>
<P>Argument
</TD><TD WIDTH=66 VALIGN=top >
<A NAME="E7E772"></A>
<P>Use
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E772"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=80 VALIGN=top >
<BLOCKQUOTE>
<P>HSTMT
</BLOCKQUOTE></TD>
<TD WIDTH=86 VALIGN=top >
<A NAME="E7E773"></A>
<P><I>hstmt</I>
</TD><TD WIDTH=66 VALIGN=top >
<A NAME="E7E773"></A>
<P>Input
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E773"></A>
<P>Statement handle.</TD>
</TR>
<TR>
<TD WIDTH=80 VALIGN=top >
<BLOCKQUOTE>
<P>UWORD
</BLOCKQUOTE></TD>
<TD WIDTH=86 VALIGN=top >
<A NAME="E7E774"></A>
<P><I>fFetchType</I>
</TD><TD WIDTH=66 VALIGN=top >
<A NAME="E7E774"></A>
<P>Input
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E774"></A>
<P>Type of fetch. For more information, see the &quot;Comments&quot; section.</TD>
</TR>
<TR>
<TD WIDTH=80 VALIGN=top >
<BLOCKQUOTE>
<P>SDWORD
</BLOCKQUOTE></TD>
<TD WIDTH=86 VALIGN=top >
<A NAME="E7E775"></A>
<P><I>irow</I>
</TD><TD WIDTH=66 VALIGN=top >
<A NAME="E7E775"></A>
<P>Input
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E775"></A>
<P>Number of the row to fetch. For more information, see the &quot;Comments&quot; section.</TD>
</TR>
<TR>
<TD WIDTH=80 VALIGN=top >
<BLOCKQUOTE>
<P>UDWORD FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=86 VALIGN=top >
<A NAME="E7E776"></A>
<P><I>pcrow</I>
</TD><TD WIDTH=66 VALIGN=top >
<A NAME="E7E776"></A>
<P>Output
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E776"></A>
<P>Number of rows actually fetched.</TD>
</TR>
<TR>
<TD WIDTH=80 VALIGN=top >
<BLOCKQUOTE>
<P>UWORD FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=86 VALIGN=top >
<A NAME="E7E777"></A>
<P><I>rgfRowStatus</I>
</TD><TD WIDTH=66 VALIGN=top >
<A NAME="E7E777"></A>
<P>Output
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E777"></A>
<P>An array of status values. For more information, see the &quot;Comments&quot; section.</TD></TR></TABLE>
<A NAME="E11E162"></A>
<H3>
<FONT FACE="Arial">Returns<A NAME="I9"></A></FONT></H3>
<BLOCKQUOTE>
<P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA_FOUND, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
</BLOCKQUOTE>
<A NAME="E11E163"></A>
<H3>
<FONT FACE="Arial">Diagnostics<A NAME="I10"></A></FONT></H3>
<BLOCKQUOTE>
<P>When <B>SQLExtendedFetch</B> returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLError</B>. The following table lists the SQLSTATE values commonly returned by <B>SQLExtendedFetch </B>and explains each one in the context of this function; the notation &quot;(DM)&quot; precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P><B>SQLSTATE</B>
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E778"></A>
<P>Error
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E778"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>01000
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E779"></A>
<P>General warning
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E779"></A>
<P>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>01004
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E780"></A>
<P>Data truncated
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E780"></A>
<P>The data returned for one or more columns was truncated. String values are right truncated. For numeric values, the fractional part of number was truncated. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>01S01
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E781"></A>
<P>Error in row
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E781"></A>
<P>An error occurred while fetching one or more rows. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>07006
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E782"></A>
<P>Restricted data type attribute violation
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E782"></A>
<P>A data value could not be converted to the C data type specified by <I>fCType</I> in <B>SQLBindCol</B>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>08S01
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E783"></A>
<P>Communication link failure
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E783"></A>
<P>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22003
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E784"></A>
<P>Numeric value out of range
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E784"></A>
<P>Returning the numeric value (as numeric or string) for one or more columns would have caused the whole (as opposed to fractional) part of the number to be truncated.
<BLOCKQUOTE>
<P>Returning the binary value for one or more columns would have caused a loss of binary significance.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For more information, see Appendix D, &quot;Data Types.&quot;</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22012
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E785"></A>
<P>Division by zero
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E785"></A>
<P>A value from an arithmetic expression was returned which resulted in division by zero.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>24000
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E786"></A>
<P>Invalid cursor state
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E786"></A>
<P>The <I>hstmt</I> was in an executed state but no result set was associated with the <I>hstmt</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>40001
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E787"></A>
<P>Serialization failure
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E787"></A>
<P>The transaction in which the fetch was executed was terminated to prevent deadlock.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>IM001
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E788"></A>
<P>Driver does not support this function
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E788"></A>
<P>(DM) The driver associated with the <I>hdbc</I> does not support the function.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1000
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E789"></A>
<P>General error
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E789"></A>
<P>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLError</B> in the argument <I>szErrorMsg</I> describes the error and its cause.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1001
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E790"></A>
<P>Memory allocation failure
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E790"></A>
<P>The driver was unable to allocate memory required to support execution or completion of the function.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1002
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E791"></A>
<P>Invalid column number
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E791"></A>
<P>A column number specified in the binding for one or more columns was greater than the number of columns in the result set.
<BLOCKQUOTE>
<P>Column 0 was bound with <B>SQLBindCol</B> and the SQL_USE_BOOKMARKS statement option was set to SQL_UB_OFF.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1008
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E792"></A>
<P>Operation canceled
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E792"></A>
<P>Asynchronous processing was enabled for the <I>hstmt</I>. The function was called and before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I>. Then the function was called again on the <I>hstmt</I>.
<BLOCKQUOTE>
<P>The function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I> from a different thread in a multithreaded application.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1010
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E793"></A>
<P>Function sequence error
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E793"></A>
<P>(DM) The specified <I>hstmt</I> was not in an executed state. The function was called without first calling <B>SQLExecDirect</B>, <B>SQLExecute</B>, or a catalog function..
<BLOCKQUOTE>
<P>(DM) An asynchronously executing function (not this one) was called for the <I>hstmt</I> and was still executing when this function was called.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, or <B>SQLSetPos</B> was called for the <I>hstmt</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>(DM) <B>SQLExtendedFetch</B> was called for an <I>hstmt</I> after <B>SQLFetch</B> was called and before <B>SQLFreeStmt</B> was called with the SQL_CLOSE option.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1106
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E794"></A>
<P>Fetch type out of range
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E794"></A>
<P>(DM) The value specified for the argument <I>fFetchType</I> was invalid (see &quot;Comments&quot;).
<BLOCKQUOTE>
<P>The value of the SQL_CURSOR_TYPE statement option was SQL_CURSOR_FORWARD_ONLY and the value of argument <I>fFetchType</I> was not SQL_FETCH_NEXT.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1107
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E795"></A>
<P>Row value out of range
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E795"></A>
<P>The value specified with the SQL_CURSOR_TYPE statement option was SQL_CURSOR_KEYSET_DRIVEN, but the value specified with the SQL_KEYSET_SIZE statement option was greater than 0 and less than the value specified with the SQL_ROWSET_SIZE statement option.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1111
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E796"></A>
<P>Invalid bookmark value
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E796"></A>
<P>The argument <I>fFetchType</I> was SQL_FETCH_BOOKMARK and the bookmark specified in the <I>irow</I> argument was not valid.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1C00
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E797"></A>
<P>Driver not capable
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E797"></A>
<P>Driver or data source does not support the specified fetch type.
<BLOCKQUOTE>
<P>The driver or data source does not support the conversion specified by the combination of the <I>fCType</I> in <B>SQLBindCol</B> and the SQL data type of the corresponding column. This error only applies when the SQL data type of the column was mapped to a driver-specific SQL data type.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The argument <I>fFetchType</I> was SQL_FETCH_RESUME and the driver supports ODBC 2.0.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1T00
</BLOCKQUOTE></TD>
<TD WIDTH=126 VALIGN=top >
<A NAME="E7E798"></A>
<P>Timeout expired
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E798"></A>
<P>The timeout period expired before the data source returned the result set. The timeout period is set through <B>SQLSetStmtOption</B>, SQL_QUERY_TIMEOUT.</TD></TR></TABLE>
<A NAME="E11E164"></A>
<H3>
<FONT FACE="Arial">Comments<A NAME="I11"></A></FONT></H3>
<BLOCKQUOTE>
<P><B>SQLExtendedFetch</B> returns one rowset of data to the application. An application cannot mix calls to <B>SQLExtendedFetch</B> and <B>SQLFetch</B> for the same cursor.<A NAME="I12"></A><A NAME="I13"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>An application specifies the number of rows in the rowset by calling <B>SQLSetStmtOption</B> with the SQL_ROWSET_SIZE statement option.
</BLOCKQUOTE>
<BLOCKQUOTE>
<A NAME="E12E51"></A>
<H4>
<FONT>Binding<A NAME="I14"></A><A NAME="I15"></A></FONT></H4>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If any columns in the result set have been bound with <B>SQLBindCol</B>, the driver converts the data for the bound columns as necessary and stores it in the locations bound to those columns. The result set can be bound in a column-wise (the default) or row-wise fashion.
</BLOCKQUOTE>
<BLOCKQUOTE>
<H5><B>Column-Wise Binding</B><A NAME="I16"></A></H5>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>To bind a result set in column-wise fashion, an application specifies SQL_BIND_BY_COLUMN for the SQL_BIND_TYPE statement option. (This is the default value.) For each column to be bound, the application:<A NAME="I17"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>1. Allocates an array of data storage buffers. The array has as many elements as there are rows in the rowset, plus an additional element if the application will search for key values or append new rows of data. Each buffer&#146;s size is the maximum size of the C data that can be returned for the column. For example, when the C data type is SQL_C_DEFAULT, each buffer&#146;s size is the column length. When the C data type is SQL_C_CHAR, each buffer&#146;s size is the display size of the data. For more information, see &quot;Converting Data from SQL to C Data Types&quot; and &quot;Precision, Scale, Length, and Display Size&quot; in Appendix D, &quot;Data Types.&quot;<A NAME="I18"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>2. Allocates an array of SDWORDs to hold the number of bytes available to return for each row in the column. The array has as many elements as there are rows in the rowset.<A NAME="I19"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>3. Calls <B>SQLBindCol</B>:
</BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<LI>The <I>rgbValue</I> argument specifies the address of the data storage array.
</BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<LI>The <I>cbValueMax</I> argument specifies the size of each buffer in the data storage array.
</BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<LI>The <I>pcbValue</I> argument specifies the address of the number-of-bytes array.<A NAME="I20"></A>
</BLOCKQUOTE></BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>When the application calls <B>SQLExtendedFetch</B>, the driver retrieves the data and the number of bytes available to return and stores them in the buffers allocated by the application:<A NAME="I21"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>For each bound column, the driver stores the data in the <I>rgbValue</I> buffer bound to the column. It stores the first row of data at the start of the buffer and each subsequent row of data at an offset of <I>cbValueMax</I> bytes from the data for the previous row.<A NAME="I22"></A><A NAME="I23"></A><A NAME="I24"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>For each bound column, the driver stores the number of bytes available to return in the <I>pcbValue</I> buffer bound to the column. This is the number of bytes available prior to calling <B>SQLExtendedFetch</B>. (If the number of bytes available to return cannot be determined in advance, the driver sets <I>pcbValue</I> to SQL_NO_TOTAL. If the data for the column is NULL, the driver sets <I>pcbValue</I> to SQL_NULL_DATA.) It stores the number of bytes available to return for the first row at the start of the buffer and the number of bytes available to return for each subsequent row at an offset of <B>sizeof(SDWORD)</B> from the value for the previous row.
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<H5><B>Row-Wise Binding</B><A NAME="I25"></A></H5>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>To bind a result set in row-wise fashion, an application:<A NAME="I26"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>1. Declares a structure that can hold a single row of retrieved data and the associated data lengths. For each bound column, the structure contains one field for the data and one SDWORD field for the number of bytes available to return. The data field&#146;s size is the maximum size of the C data that can be returned for the column.<A NAME="I27"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>2. Calls <B>SQLSetStmtOption</B> with <I>fOption</I> set to SQL_BIND_TYPE and <I>vParam</I> set to the size of the structure.<A NAME="I28"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>3. Allocates an array of these structures. The array has as many elements as there are rows in the rowset, plus an additional element if the application will search for key values or append new rows of data.<A NAME="I29"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>4. Calls <B>SQLBindCol</B> for each column to be bound:
</BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<LI>The <I>rgbValue</I> argument specifies the address of the column&#146;s data field in the first array element.
</BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<LI>The <I>cbValueMax</I> argument specifies the size of the column&#146;s data field.
</BLOCKQUOTE></BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<LI>The <I>pcbValue</I> argument specifies the address of the column&#146;s number-of-bytes field in the first array element.<A NAME="I30"></A>
</BLOCKQUOTE></BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>When the application calls <B>SQLExtendedFetch</B>, the driver retrieves the data and the number of bytes available to return and stores them in the buffers allocated by the application:<A NAME="I31"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>For each bound column, the driver stores the first row of data at the address specified by <I>rgbValue</I> for the column and each subsequent row of data at an offset of <I>vParam</I> bytes from the data for the previous row.<A NAME="I32"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>For each bound column, the driver stores the number of bytes available to return for the first row at the address specified by <I>pcbValue</I> and the number of bytes available to return for each subsequent row at an offset of <I>vParam</I> bytes from the value for the previous row. This is the number of bytes available prior to calling <B>SQLExtendedFetch</B>. (If the number of bytes available to return cannot be determined in advance, the driver sets <I>pcbValue</I> to SQL_NO_TOTAL. If the data for the column is NULL, the driver sets <I>pcbValue</I> to SQL_NULL_DATA.)
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<A NAME="E12E52"></A>
<H4>
<FONT>Positioning the Cursor<A NAME="I33"></A><A NAME="I34"></A><A NAME="I35"></A><A NAME="I36"></A><A NAME="I37"></A><A NAME="I38"></A><A NAME="I39"></A></FONT></H4>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The following operations require a cursor position:<A NAME="I40"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>Positioned update and delete statements.<A NAME="I41"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>Calls to <B>SQLGetData</B>.<A NAME="I42"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>Calls to <B>SQLSetPos</B> with the SQL_DELETE, SQL_REFRESH, and SQL_UPDATE options.<A NAME="I43"></A>
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>An application can specify a cursor position when it calls <B>SQLSetPos</B>. Before it executes a positioned update or delete statement or calls <B>SQLGetData</B>, the application must position the cursor by calling <B>SQLExtendedFetch</B> to retrieve a rowset; the cursor points to the first row in the rowset. To position the cursor to a different row in the rowset, the application calls <B>SQLSetPos</B>.<A NAME="I44"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The following table shows the rowset and return code returned when the application requests different rowsets.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P><B>Requested</B>
<BR><B>Rowset</B>
</BLOCKQUOTE></TD>
<TD WIDTH=156 VALIGN=top >
<BR>
<BLOCKQUOTE>
<P><B>Return Code</B>
</BLOCKQUOTE></TD>
<TD WIDTH=70 VALIGN=top >
<A NAME="E7E799"></A>
<P>Cursor
<BR><B>Position</B>
</TD><TD WIDTH=133 VALIGN=top >
<BR>
<BLOCKQUOTE>
<P><B>Returned Rowset</B></TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>Before start of result set
</BLOCKQUOTE></TD>
<TD WIDTH=156 VALIGN=top >
<A NAME="E7E800"></A>
<P>SQL_NO_DATA_FOUND
</TD><TD WIDTH=70 VALIGN=top >
<A NAME="E7E800"></A>
<P>Before start of result set
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E800"></A>
<P>None. The contents of the rowset buffers are undefined.</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>Overlaps start of result set
</BLOCKQUOTE></TD>
<TD WIDTH=156 VALIGN=top >
<A NAME="E7E801"></A>
<P>SQL_SUCCESS
</TD><TD WIDTH=70 VALIGN=top >
<A NAME="E7E801"></A>
<P>Row 1 of rowset
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E801"></A>
<P>First rowset in result set.</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>Within result set
</BLOCKQUOTE></TD>
<TD WIDTH=156 VALIGN=top >
<A NAME="E7E802"></A>
<P>SQL_SUCCESS
</TD><TD WIDTH=70 VALIGN=top >
<A NAME="E7E802"></A>
<P>Row 1 of rowset
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E802"></A>
<P>Requested rowset.</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>Overlaps end of result set
</BLOCKQUOTE></TD>
<TD WIDTH=156 VALIGN=top >
<A NAME="E7E803"></A>
<P>SQL_SUCCESS
</TD><TD WIDTH=70 VALIGN=top >
<A NAME="E7E803"></A>
<P>Row 1 of rowset
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E803"></A>
<P>For rows in the rowset that overlap the result set, data is returned.
<BLOCKQUOTE>
<P>For rows in the rowset outside the result set, the contents of the <I>rgbValue</I> and <I>pcbValue</I> buffers are undefined and the <I>rgfRowStatus</I> array contains SQL_ROW_NOROW.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>After end of result set
</BLOCKQUOTE></TD>
<TD WIDTH=156 VALIGN=top >
<A NAME="E7E804"></A>
<P>SQL_NO_DATA_FOUND
</TD><TD WIDTH=70 VALIGN=top >
<A NAME="E7E804"></A>
<P>After end of result set
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E804"></A>
<P>None. The contents of the rowset buffers are undefined.</TD></TR></TABLE>
<BLOCKQUOTE>
<P>For example, suppose a result set has 100 rows and the rowset size is 5. The following table shows the rowset and return code returned by <B>SQLExtendedFetch</B> for different values of <I>irow</I> when the fetch type is SQL_FETCH_RELATIVE:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=106 VALIGN=top >
<BLOCKQUOTE>
<P><B>Current Rowset</B>
</BLOCKQUOTE></TD>
<TD WIDTH=60 VALIGN=top >
<A NAME="E7E805"></A>
<P><I>irow</I>
</TD><TD WIDTH=153 VALIGN=top >
<A NAME="E7E805"></A>
<P>Return Code
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E805"></A>
<P>New Rowset</TD>
</TR>
<TR>
<TD WIDTH=106 VALIGN=top >
<BLOCKQUOTE>
<P>1 to 5
</BLOCKQUOTE></TD>
<TD WIDTH=60 VALIGN=top >
<A NAME="E7E806"></A>
<P>&#150;5
</TD><TD WIDTH=153 VALIGN=top >
<A NAME="E7E806"></A>
<P>SQL_NO_DATA_FOUND
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E806"></A>
<P>None.</TD>
</TR>
<TR>
<TD WIDTH=106 VALIGN=top >
<BLOCKQUOTE>
<P>1 to 5
</BLOCKQUOTE></TD>
<TD WIDTH=60 VALIGN=top >
<A NAME="E7E807"></A>
<P>&#150;3
</TD><TD WIDTH=153 VALIGN=top >
<A NAME="E7E807"></A>
<P>SQL_SUCCESS
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E807"></A>
<P>1 to 5</TD>
</TR>
<TR>
<TD WIDTH=106 VALIGN=top >
<BLOCKQUOTE>
<P>96 to 100
</BLOCKQUOTE></TD>
<TD WIDTH=60 VALIGN=top >
<A NAME="E7E808"></A>
<P>  5
</TD><TD WIDTH=153 VALIGN=top >
<A NAME="E7E808"></A>
<P>SQL_NO_DATA_FOUND
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E808"></A>
<P>None.</TD>
</TR>
<TR>
<TD WIDTH=106 VALIGN=top >
<BLOCKQUOTE>
<P>96 to 100
</BLOCKQUOTE></TD>
<TD WIDTH=60 VALIGN=top >
<A NAME="E7E809"></A>
<P>  3
</TD><TD WIDTH=153 VALIGN=top >
<A NAME="E7E809"></A>
<P>SQL_SUCCESS
</TD><TD WIDTH=133 VALIGN=top >
<A NAME="E7E809"></A>
<P>99 and 100. For rows 3, 4, and 5 in the rowset, the <I>rgfRowStatusArray</I> is set to SQL_ROW_NOROW.</TD></TR></TABLE>
<BLOCKQUOTE>
<P>Before <B>SQLExtendedFetch</B> is called the first time, the cursor is positioned before the start of the result set.<A NAME="I45"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For the purpose of moving the cursor, deleted rows (that is, rows with an entry in the <I>rgfRowStatus</I> array of SQL_ROW_DELETED) are treated no differently than other rows. For example, calling <B>SQLExtendedFetch</B> with <I>fFetchType</I> set to SQL_FETCH_ABSOLUTE and <I>irow</I> set to 15 returns the rowset starting at row 15, even if the <I>rgfRowStatus</I> array for row 15 is SQL_ROW_DELETED.
</BLOCKQUOTE>
<BLOCKQUOTE>
<A NAME="E12E53"></A>
<H4>
<FONT>Processing Errors<A NAME="I46"></A><A NAME="I47"></A><A NAME="I48"></A><A NAME="I49"></A><A NAME="I50"></A></FONT></H4>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If an error occurs that pertains to the entire rowset, such as SQLSTATE S1T00 (Timeout expired), the driver returns SQL_ERROR and the appropriate SQLSTATE. The contents of the rowset buffers are undefined and the cursor position is unchanged.<A NAME="I51"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If an error occurs that pertains to a single row, the driver:<A NAME="I52"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>Sets the element in the <I>rgfRowStatus</I> array for the row to SQL_ROW_ERROR.<A NAME="I53"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>Posts SQLSTATE 01S01 (Error in row) in the error queue.<A NAME="I54"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>Posts zero or more additional SQLSTATEs for the error after SQLSTATE 01S01 (Error in row) in the error queue.<A NAME="I55"></A>
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>After it has processed the error or warning, the driver continues the operation for the remaining rows in the rowset and returns SQL_SUCCESS_WITH_INFO. Thus, for each error that pertains to a single row, the error queue contains SQLSTATE 01S01 (Error in row) followed by zero or more additional SQLSTATEs.<A NAME="I56"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>After it has processed the error, the driver fetches the remaining rows in the rowset and returns SQL_SUCCESS_WITH_INFO. Thus, for each row that returned an error, the error queue contains SQLSTATE 01S01 (Error in row) followed by zero or more additional SQLSTATEs.<A NAME="I57"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If the rowset contains rows that have already been fetched, the driver is not required to return SQLSTATEs for errors that occurred when the rows were first fetched. It is, however, required to return SQLSTATE 01S01 (Error in row) for each row in which an error originally occurred and to return SQL_SUCCESS_WITH_INFO. For example, a static cursor that maintains a cache might cache row status information (so it can determine which rows contain errors) but might not cache the SQLSTATE associated with those errors.<A NAME="I58"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>Error rows do not affect relative cursor movements. For example, suppose the result set size is 100 and the rowset size is 10. If the current rowset is rows 11 through 20 and the element in the <I>rgfRowStatus</I> array for row 11 is SQL_ROW_ERROR, calling <B>SQLExtendedFetch</B> with the SQL_FETCH_NEXT fetch type still returns rows 21 through 30.<A NAME="I59"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If the driver returns any warnings, such as SQLSTATE 01004 (Data truncated), it returns warnings that apply to the entire rowset or to unknown rows in the rowset before it returns error information applying to specific rows. It returns warnings for specific rows along with any other error information about those rows.
</BLOCKQUOTE>
<BLOCKQUOTE>
<A NAME="E12E54"></A>
<H4>
<FONT>fFetchType Argument<A NAME="I60"></A></FONT></H4>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <I>fFetchType</I> argument specifies how to move through the result set. It is one of the following values:
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SQL_FETCH_NEXT
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SQL_FETCH_FIRST
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SQL_FETCH_LAST
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SQL_FETCH_PRIOR
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SQL_FETCH_ABSOLUTE
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SQL_FETCH_RELATIVE
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>SQL_FETCH_BOOKMARK<A NAME="I61"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If the value of the SQL_CURSOR_TYPE statement option is SQL_CURSOR_FORWARD_ONLY, the <I>fFetchType</I> argument must be SQL_FETCH_NEXT.<A NAME="I62"></A><A NAME="I63"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<NOTE>Note. In ODBC 1.0, <B>SQLExtendedFetch</B> supported the SQL_FETCH_RESUME fetch type. In ODBC 2.0, SQL_FETCH_RESUME is obsolete and the Driver Manager returns SQLSTATE S1C00 (Driver not capable) if an application specifies it for an ODBC 2.0 driver.</NOTE>
<HR ALIGN=CENTER>
</BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<NOTE>The SQL_FETCH_BOOKMARK fetch type was introduced in ODBC 2.0; the Driver Manager returns SQLSTATE S1106 (Fetch type out of range) if it is specified for an ODBC 1.0 driver.</NOTE>
<HR ALIGN=CENTER>
</BLOCKQUOTE>
<BLOCKQUOTE>
<H5><B>Moving by Row Position</B><A NAME="I64"></A><A NAME="I65"></A><A NAME="I66"></A><A NAME="I67"></A><A NAME="I68"></A><A NAME="I69"></A><A NAME="I70"></A><A NAME="I71"></A><A NAME="I72"></A><A NAME="I73"></A></H5>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P><B>SQLExtendedFetch</B> supports the following values of the <I>fFetchType</I> argument to move relative to the current rowset:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P><B>fFetchType Argument</B>
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E810"></A>
<P>Action</TD>
</TR>
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P>SQL_FETCH_NEXT
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E811"></A>
<P>The driver returns the next rowset. If the cursor is positioned before the start of the result set, this is equivalent to SQL_FETCH_FIRST.</TD>
</TR>
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P>SQL_FETCH_PRIOR
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E812"></A>
<P>The driver returns the prior rowset. If the cursor is positioned after the end of the result set, this is equivalent to SQL_FETCH_LAST.</TD>
</TR>
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P>SQL_FETCH_RELATIVE
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E813"></A>
<P>The driver returns the rowset irow rows from the start of the current rowset. If irow equals 0, the driver refreshes the current rowset. If the cursor is positioned before the start of the result set and irow is greater than 0 or if the cursor is positioned after the end of the result set and irow is less than 0, this is equivalent to SQL_FETCH_ABSOLUTE.</TD></TR></TABLE>
<BLOCKQUOTE>
<P>It supports the following values of the <I>fFetchType</I> argument to move to an absolute position in the result set:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P><B>fFetchType Argument</B>
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E814"></A>
<P>Action</TD>
</TR>
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P>SQL_FETCH_FIRST
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E815"></A>
<P>The driver returns the first rowset in the result set.</TD>
</TR>
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P>SQL_FETCH_LAST
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E816"></A>
<P>The driver returns the last complete rowset in the result set.</TD>
</TR>
<TR>
<TD WIDTH=173 VALIGN=top >
<BLOCKQUOTE>
<P>SQL_FETCH_ABSOLUTE
</BLOCKQUOTE></TD>
<TD WIDTH=280 VALIGN=top >
<A NAME="E7E817"></A>
<P>If irow is greater than 0, the driver returns the rowset starting at row irow.
<BLOCKQUOTE>
<P>If irow equals 0, the driver returns SQL_NO_DATA_FOUND and the cursor is positioned before the start of the result set.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If irow is less than 0, the driver returns the rowset starting at row n+irow+1, where n is the number of rows in the result set. For example, if irow is &#150;1, the driver returns the rowset starting at the last row in the result set. If the result set size is 10 and irow is &#150;10, the driver returns the rowset starting at the first row in the result set.</TD></TR></BLOCKQUOTE></TABLE>
<BLOCKQUOTE>
<H5><B>Positioning to a Bookmark</B><A NAME="I74"></A></H5>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>When an application calls <B>SQLExtendedFetch</B> with the SQL_FETCH_BOOKMARK fetch type, the driver retrieves the rowset starting with the row specified by the bookmark in the <I>irow</I> argument.<A NAME="I75"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>To inform the driver that it will use bookmarks, the application calls <B>SQLSetStmtOption</B> with the SQL_USE_BOOKMARKS option before opening the cursor. To retrieve the bookmark for a row, the application either positions the cursor on the row and calls <B>SQLGetStmtOption</B> with the SQL_GET_BOOKMARK option, or retrieves the bookmark from column 0 of the result set. If the application retrieves a bookmark from column 0 of the result set, it must set <I>fCType</I> in <B>SQLBindCol</B> or <B>SQLGetData</B> to SQL_C_BOOKMARK. The application stores the bookmarks for those rows in each rowset to which it will return later.<A NAME="I76"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>Bookmarks are 32-bit binary values; if a bookmark requires more than 32 bits, such as when it is a key value, the driver maps the bookmarks requested by the application to 32-bit binary values. The 32-bit binary values are then returned to the application. Because this mapping may require considerable memory, applications should only bind column 0 of the result set if they will actually use bookmarks for most rows. Otherwise, applications should call <B>SQLGetStmtOption</B> with the SQL_GET_BOOKMARK statement option or call <B>SQLGetData</B> for column 0.
</BLOCKQUOTE>
<BLOCKQUOTE>
<A NAME="E12E55"></A>
<H4>
<FONT><I>irow</I> Argument<A NAME="I77"></A></FONT></H4>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For the SQL_FETCH_ABSOLUTE fetch type, <B>SQLExtendedFetch</B> returns the rowset starting at the row number specified by the <I>irow</I> argument.<A NAME="I78"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For the SQL_FETCH_RELATIVE fetch type, <B>SQLExtendedFetch</B> returns the rowset starting <I>irow</I> rows from the first row in the current rowset.<A NAME="I79"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For the SQL_FETCH_BOOKMARK fetch type, the <I>irow</I> argument specifies the bookmark that marks the first row in the requested rowset.<A NAME="I80"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <I>irow</I> argument is ignored for the SQL_FETCH_NEXT, SQL_FETCH_PRIOR, SQL_FETCH_FIRST, and SQL_FETCH_LAST, fetch types.
</BLOCKQUOTE>
<BLOCKQUOTE>
<A NAME="E12E56"></A>
<H4>
<FONT>rgfRowStatus Argument<A NAME="I81"></A><A NAME="I82"></A><A NAME="I83"></A><A NAME="I84"></A></FONT></H4>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>In the <I>rgfRowStatus</I> array, <B>SQLExtendedFetch</B> returns any changes in status to each row since it was last retrieved from the data source. Rows may be unchanged (SQL_ROW_SUCCESS), updated (SQL_ROW_UPDATED), deleted (SQL_ROW_DELETED), added (SQL_ROW_ADDED), or were unretrievable due to an error (SQL_ROW_ERROR). For static cursors, this information is available for all rows. For keyset, mixed, and dynamic cursors, this information is only available for rows in the keyset; the driver does not save data outside the keyset and therefore cannot compare the newly retrieved data to anything.<A NAME="I85"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<NOTE>Note Some drivers cannot detect changes to data. To determine whether a driver can detect changes to refetched rows, an application calls <B>SQLGetInfo</B> with the SQL_ROW_UPDATES option.<A NAME="I86"></A></NOTE>
<HR ALIGN=CENTER>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The number of elements must equal the number of rows in the rowset (as defined by the SQL_ROWSET_SIZE statement option). If the number of rows fetched is less than the number of elements in the status array, the driver sets remaining status elements to SQL_ROW_NOROW.<A NAME="I87"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>When an application calls <B>SQLSetPos</B> with <I>fOption</I> set to SQL_DELETE or SQL_UPDATE, <B>SQLSetPos</B> changes the <I>rgfRowStatus</I> array for the changed row to SQL_ROW_DELETED or SQL_ROW_UPDATED.
</BLOCKQUOTE>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<NOTE>Note For keyset, mixed, and dynamic cursors, if a key value is updated, the row of data is considered to have been deleted and a new row added.</NOTE>
<HR ALIGN=CENTER>
</BLOCKQUOTE>
<A NAME="E11E165"></A>
<H3>
<FONT FACE="Arial">Code Example<A NAME="I88"></A><A NAME="I89"></A></FONT></H3>
<BLOCKQUOTE>
<P>The following two examples show how an application could use column-wise or row-wise binding to bind storage locations to the same result set. <A NAME="I90"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For more code examples, see <B>SQLSetPos</B>.
</BLOCKQUOTE>
<BLOCKQUOTE>
<H5><B>Column-Wise Binding</B><A NAME="I91"></A></H5>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>In the following example, an application declares storage locations for column-wise bound data and the returned numbers of bytes. Because column-wise binding is the default, there is no need, as in the row-wise binding example, to request column-wise binding with <B>SQLSetStmtOption</B>. However, the application does call <B>SQLSetStmtOption</B> to specify the number of rows in the rowset.<A NAME="I92"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The application then executes a <B>SELECT</B> statement to return a result set of the employee names and birthdays, which is sorted by birthday. It calls <B>SQLBindCol</B> to bind the columns of data, passing the addresses of storage locations for both the data and the returned numbers of bytes. Finally, the application fetches the rowset data with <B>SQLExtendedFetch</B> and prints each employee&#146;s name and birthday.
</BLOCKQUOTE>
<BLOCKQUOTE>
<PRE>
<FONT FACE="Courier New">#define ROWS 100
#define NAME_LEN 30
#define BDAY_LEN 11
UCHAR     szName[ROWS][NAME_LEN], szBirthday[ROWS][BDAY_LEN];
SWORD     sAge[ROWS];
SDWORD    cbName[ROWS], cbAge[ROWS], cbBirthday[ROWS];
UDWORD    crow, irow;
UWORD     rgfRowStatus[ROWS];
SQLSetStmtOption(hstmt, SQL_CONCURRENCY, SQL_CONCUR_READ_ONLY);
SQLSetStmtOption(hstmt, SQL_CURSOR_TYPE, SQL_CURSOR_KEYSET_DRIVEN);
SQLSetStmtOption(hstmt, SQL_ROWSET_SIZE, ROWS);
retcode = SQLExecDirect(hstmt,
<BR>   &quot;SELECT NAME, AGE, BIRTHDAY FROM EMPLOYEE ORDER BY 3, 2, 1&quot;,
<BR>            SQL_NTS);
if (retcode == SQL_SUCCESS) {
   SQLBindCol(hstmt, 1, SQL_C_CHAR, szName, NAME_LEN, cbName);
   SQLBindCol(hstmt, 2, SQL_C_SSHORT, sAge, 0, cbAge);
   SQLBindCol(hstmt, 3, SQL_C_CHAR, szBirthday, BDAY_LEN,
<BR>              cbBirthday);
   /* Fetch the rowset data and print each row. */
   /* On an error, display a message and exit.  */
   while (TRUE) {
      retcode = SQLExtendedFetch(hstmt, SQL_FETCH_NEXT, 1, &amp;crow,
<BR>                                  rgfRowStatus);
      if (retcode == SQL_ERROR || retcode == SQL_SUCCESS_WITH_INFO) {
         show_error();
      }
      if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO){
         for (irow = 0; irow &lt; crow; irow++) {
            if (rgfRowStatus[irow] != SQL_ROW_DELETED &amp;&amp; 
<BR>               rgfRowStatus[irow] != SQL_ROW_ERROR)
               fprintf(out, &quot;%-*s  %-2d  %*s&quot;,
<BR>                       NAME_LEN-1, szName[irow], sAge[irow],
<BR>                       BDAY_LEN-1, szBirthday[irow]);
         }
      } else {
         break;
      }
   }
}</FONT></PRE></BLOCKQUOTE>
<BLOCKQUOTE>
<H5><B>Row-Wise Binding</B><A NAME="I93"></A></H5>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>In the following example, an application declares an array of structures to hold row-wise bound data and the returned numbers of bytes. Using <B>SQLSetStmtOption</B>, it requests row-wise binding and passes the size of the structure to the driver. The driver will use this size to find successive storage locations in the array of structures. Using <B>SQLSetStmtOption</B>, it specifies the size of the rowset.<A NAME="I94"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The application then executes a <B>SELECT</B> statement to return a result set of the employee names and birthdays, which is sorted by birthday. It calls <B>SQLBindCol</B> to bind the columns of data, passing the addresses of storage locations for both the data and the returned numbers of bytes. Finally, the application fetches the rowset data with <B>SQLExtendedFetch</B> and prints each employee&#146;s name and birthday.
</BLOCKQUOTE>
<BLOCKQUOTE>
<PRE>
<FONT FACE="Courier New">#define ROWS 100
#define NAME_LEN 30
#define BDAY_LEN 11
typedef struct {
<BR>   UCHAR     szName[NAME_LEN];
<BR>   SDWORD    cbName;
<BR>   SWORD     sAge;
<BR>   SDWORD    cbAge;
<BR>   UCHAR     szBirthday[BDAY_LEN];
<BR>   SDWORD    cbBirthday;
<BR>   }   EmpTable;
EmpTable rget[ROWS];
UDWORD   crow, irow;
UWORD    rgfRowStatus[ROWS];
SQLSetStmtOption(hstmt, SQL_BIND_TYPE, sizeof(EmpTable));
SQLSetStmtOption(hstmt, SQL_CONCURRENCY, SQL_CONCUR_READ_ONLY);
SQLSetStmtOption(hstmt, SQL_CURSOR_TYPE, SQL_CURSOR_KEYSET_DRIVEN);
SQLSetStmtOption(hstmt, SQL_ROWSET_SIZE, ROWS);
retcode = SQLExecDirect(hstmt,
   &quot;SELECT NAME, AGE, BIRTHDAY FROM EMPLOYEE ORDER BY 3, 2, 1&quot;,
<BR>            SQL_NTS);
if (retcode == SQL_SUCCESS) {
   SQLBindCol(hstmt, 1, SQL_C_CHAR, rget[0].szName, NAME_LEN,
<BR>              &amp;rget[0].cbName);
   SQLBindCol(hstmt, 2, SQL_C_SSHORT, &amp;rget[0].sAge, 0,
<BR>              &amp;rget[0].cbAge);
   SQLBindCol(hstmt, 3, SQL_C_CHAR, rget[0].szBirthday, BDAY_LEN,
<BR>              &amp;rget[0].cbBirthday);
   /* Fetch the rowset data and print each row. */
   /* On an error, display a message and exit.  */
   while (TRUE) {
      retcode = SQLExtendedFetch(hstmt, SQL_FETCH_NEXT, 1, &amp;crow,
<BR>                                 rgfRowStatus);
      if (retcode == SQL_ERROR || retcode == SQL_SUCCESS_WITH_INFO) {
         show_error();
      }
      if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO){
         for (irow = 0; irow &lt; crow; irow++) {
            if (rgfRowStatus[irow] != SQL_ROW_DELETED &amp;&amp; 
<BR>               rgfRowStatus[irow] != SQL_ROW_ERROR)
               fprintf(out, &quot;%-*s  %-2d  %*s&quot;,
<BR>                    NAME_LEN-1, rget[irow].szName, rget[irow].sAge,
<BR>                    BDAY_LEN-1, rget[irow].szBirthday);
         }
      } else {
         break;
      }
   }
}</FONT></PRE></BLOCKQUOTE>
<A NAME="E11E166"></A>
<H3>
<FONT FACE="Arial">Related Functions</FONT></H3>

<TABLE WIDTH=800 >
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P><B>For information about</B>
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E818"></A>
<P>See</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Assigning storage for a column in a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E819"></A>
<P><B>SQLBindCol</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Canceling statement processing
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E820"></A>
<P><B>SQLCancel</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning information about a column in a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E821"></A>
<P><B>SQLDescribeCol</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Executing an SQL statement
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E822"></A>
<P><B>SQLExecDirect</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Executing a prepared SQL statement
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E823"></A>
<P><B>SQLExecute</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning the number of result set columns
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E824"></A>
<P><B>SQLNumResultCols</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Positioning the cursor in a rowset
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E825"></A>
<P><B>SQLSetPos</B> (extension)</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Setting a statement option
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E826"></A>
<P><B>SQLSetStmtOption</B> (extension)</TD></TR></TABLE><A NAME="E10E80"></A>
<H2>
<FONT FACE="Arial"><B>SQLFetch</B><B> (ODBC 1.0, Core)</B><A NAME="I95"></A></FONT></H2>
<BLOCKQUOTE>
<P><B>SQLFetch</B> fetches a row of data from a result set. The driver returns data for all columns that were bound to storage locations with <B>SQLBindCol</B>.
</BLOCKQUOTE>
<A NAME="E11E167"></A>
<H3>
<FONT FACE="Arial">Syntax</FONT></H3>
<BLOCKQUOTE>
<P>RETCODE <B>SQLFetch</B>(<I>hstmt</I>)<A NAME="I96"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <B>SQLFetch</B> function accepts the following argument.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=125 VALIGN=top >
<BLOCKQUOTE>
<P><B>Type</B>
</BLOCKQUOTE></TD>
<TD WIDTH=125 VALIGN=top >
<A NAME="E7E827"></A>
<P>Argument
</TD><TD WIDTH=82 VALIGN=top >
<A NAME="E7E827"></A>
<P>Use
</TD><TD WIDTH=120 VALIGN=top >
<A NAME="E7E827"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=125 VALIGN=top >
<BLOCKQUOTE>
<P>HSTMT
</BLOCKQUOTE></TD>
<TD WIDTH=125 VALIGN=top >
<A NAME="E7E828"></A>
<P><I>hstmt</I>
</TD><TD WIDTH=82 VALIGN=top >
<A NAME="E7E828"></A>
<P>Input
</TD><TD WIDTH=120 VALIGN=top >
<A NAME="E7E828"></A>
<P>Statement handle.</TD></TR></TABLE>
<A NAME="E11E168"></A>
<H3>
<FONT FACE="Arial">Returns<A NAME="I97"></A></FONT></H3>
<BLOCKQUOTE>
<P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA_FOUND, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
</BLOCKQUOTE>
<A NAME="E11E169"></A>
<H3>
<FONT FACE="Arial">Diagnostics<A NAME="I98"></A></FONT></H3>
<BLOCKQUOTE>
<P>When <B>SQLFetch</B> returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLError</B>. The following table lists the SQLSTATE values commonly returned by <B>SQLFetch </B>and explains each one in the context of this function; the notation &quot;(DM)&quot; precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P><B>SQLSTATE</B>
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E829"></A>
<P>Error
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E829"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>01000
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E830"></A>
<P>General warning
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E830"></A>
<P>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>01004
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E831"></A>
<P>Data truncated
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E831"></A>
<P>The data returned for one or more columns was truncated. String values are right truncated. For numeric values, the fractional part of number was truncated. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>07006
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E832"></A>
<P>Restricted data type attribute violation
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E832"></A>
<P>The data value could not be converted to the data type specified by <I>fCType</I> in <B>SQLBindCol</B>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>08S01
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E833"></A>
<P>Communication link failure
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E833"></A>
<P>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22002
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E834"></A>
<P>Indicator value required but not supplied
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E834"></A>
<P>NULL data was fetched into a column whose <I>pcbValue</I> as set by <B>SQLBindCol</B> was a null pointer.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22003
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E835"></A>
<P>Numeric value out of range
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E835"></A>
<P>Returning the numeric value (as numeric or string) for one or more columns would have caused the whole (as opposed to fractional) part of the number to be truncated.
<BLOCKQUOTE>
<P>Returning the binary value for one or more columns would have caused a loss of binary significance.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For more information, see &quot;Converting Data from SQL to C Data Types&quot; in Appendix D, &quot;Data Types.&quot;</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22012
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E836"></A>
<P>Division by zero
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E836"></A>
<P>A value from an arithmetic expression was returned which resulted in division by zero.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>24000
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E837"></A>
<P>Invalid cursor state
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E837"></A>
<P>The <I>hstmt</I> was in an executed state but no result set was associated with the <I>hstmt</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>40001
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E838"></A>
<P>Serialization failure
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E838"></A>
<P>The transaction in which the fetch was executed was terminated to prevent deadlock.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>IM001
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E839"></A>
<P>Driver does not support this function
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E839"></A>
<P>(DM) The driver associated with the <I>hstmt</I> does not support the function.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1000
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E840"></A>
<P>General error
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E840"></A>
<P>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLError</B> in the argument <I>szErrorMsg</I> describes the error and its cause.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1001
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E841"></A>
<P>Memory allocation failure
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E841"></A>
<P>The driver was unable to allocate memory required to support execution or completion of the function.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1002
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E842"></A>
<P>Invalid column number
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E842"></A>
<P>A column number specified in the binding for one or more columns was greater than the number of columns in the result set.
<BLOCKQUOTE>
<P>A column number specified in the binding for a column was 0; <B>SQLFetch</B> cannot be used to retrieve bookmarks.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1008
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E843"></A>
<P>Operation canceled
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E843"></A>
<P>Asynchronous processing was enabled for the <I>hstmt</I>. The function was called and before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I>. Then the function was called again on the <I>hstmt</I>.
<BLOCKQUOTE>
<P>The function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I> from a different thread in a multithreaded application.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1010
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E844"></A>
<P>Function sequence error
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E844"></A>
<P>(DM) The specified <I>hstmt</I> was not in an executed state. The function was called without first calling <B>SQLExecDirect</B>, <B>SQLExecute</B>, or a catalog function..
<BLOCKQUOTE>
<P>(DM) An asynchronously executing function (not this one) was called for the <I>hstmt</I> and was still executing when this function was called.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, or <B>SQLSetPos</B> was called for the <I>hstmt</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>(DM) <B>SQLExtendedFetch</B> was called for an <I>hstmt</I> after <B>SQLFetch</B> was called and before <B>SQLFreeStmt</B> was called with the SQL_CLOSE option.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1C00
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E845"></A>
<P>Driver not capable
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E845"></A>
<P>The driver or data source does not support the conversion specified by the combination of the <I>fCType</I> in <B>SQLBindCol</B> and the SQL data type of the corresponding column. This error only applies when the SQL data type of the column was mapped to a driver-specific SQL data type.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1T00
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E846"></A>
<P>Timeout expired
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E846"></A>
<P>The timeout period expired before the data source returned the result set. The timeout period is set through <B>SQLSetStmtOption</B>, SQL_QUERY_TIMEOUT.</TD></TR></TABLE>
<A NAME="E11E170"></A>
<H3>
<FONT FACE="Arial">Comments<A NAME="I99"></A><A NAME="I100"></A><A NAME="I101"></A><A NAME="I102"></A><A NAME="I103"></A></FONT></H3>
<BLOCKQUOTE>
<P><B>SQLFetch</B> positions the cursor on the next row of the result set. Before <B>SQLFetch</B> is called the first time, the cursor is positioned before the start of the result set. When the cursor is positioned on the last row of the result set, <B>SQLFetch</B> returns SQL_NO_DATA_FOUND and the cursor is positioned after the end of the result set. An application cannot mix calls to <B>SQLExtendedFetch</B> and <B>SQLFetch</B> for the same cursor.<A NAME="I104"></A><A NAME="I105"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If the application called <B>SQLBindCol</B> to bind columns, <B>SQLFetch</B> stores data into the locations specified by the calls to <B>SQLBindCol</B>. If the application does not call <B>SQLBindCol</B> to bind any columns, <B>SQLFetch</B> doesn&#146;t return any data; it just moves the cursor to the next row. An application can call <B>SQLGetData</B> to retrieve data that is not bound to a storage location.<A NAME="I106"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The driver manages cursors during the fetch operation and places each value of a bound column into the associated storage. The driver follows these guidelines when performing a fetch operation:<A NAME="I107"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI><B>SQLFetch</B> accesses column data in left-to-right order.<A NAME="I108"></A><A NAME="I109"></A><A NAME="I110"></A><A NAME="I111"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>After each fetch, <I>pcbValue</I> (specified in <B>SQLBindCol</B>) contains the number of bytes available to return for the column. This is the number of bytes available prior to calling <B>SQLFetch</B>. If the number of bytes available to return cannot be determined in advance, the driver sets <I>pcbValue</I> to SQL_NO_TOTAL. (If SQL_MAX_LENGTH has been specified with <B>SQLSetStmtOption</B> and the number of bytes available to return is greater than SQL_MAX_LENGTH, <I>pcbValue</I> contains SQL_MAX_LENGTH.)
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<NOTE>Note The SQL_MAX_LENGTH statement option is intended to reduce network traffic and may not be supported by all drivers. To guarantee that data is truncated, an application should allocate a buffer of the desired size and specify this size in the <I>cbValueMax</I> argument.<A NAME="I112"></A><A NAME="I113"></A></NOTE>
<HR ALIGN=CENTER>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>If <I>rgbValue</I> is not large enough to hold the entire result, the driver stores part of the value and returns SQL_SUCCESS_WITH_INFO. A subsequent call to <B>SQLError</B> indicates that a truncation occurred. The application can compare <I>pcbValue</I> to <I>cbValueMax</I> (specified in <B>SQLBindCol</B>) to determine which column or columns were truncated. If <I>pcbValue</I> is greater than or equal to <I>cbValueMax</I>, then truncation occurred.<A NAME="I114"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>If the data value for the column is NULL, the driver stores SQL_NULL_DATA in <I>pcbValue</I>.<A NAME="I115"></A>
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P><B>SQLFetch</B> is valid only after a call that returns a result set.<A NAME="I116"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For information about conversions allowed by <B>SQLBindCol</B> and <B>SQLGetData</B>, see &quot;Converting Data from SQL to C Data Types&quot; in Appendix D, &quot;Data Types.&quot;
</BLOCKQUOTE>
<A NAME="E11E171"></A>
<H3>
<FONT FACE="Arial">Code Example<A NAME="I117"></A></FONT></H3>
<BLOCKQUOTE>
<P>See <B>SQLBindCol</B>, <B>SQLColumns</B>, <B>SQLGetData</B>, and <B>SQLProcedures</B>.
</BLOCKQUOTE>
<A NAME="E11E172"></A>
<H3>
<FONT FACE="Arial">Related Functions</FONT></H3>

<TABLE WIDTH=800 >
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P><B>For information about</B>
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E847"></A>
<P>See</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Assigning storage for a column in a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E848"></A>
<P><B>SQLBindCol</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Canceling statement processing
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E849"></A>
<P><B>SQLCancel</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning information about a column in a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E850"></A>
<P><B>SQLDescribeCol</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Executing an SQL statement
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E851"></A>
<P><B>SQLExecDirect</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Executing a prepared SQL statement
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E852"></A>
<P><B>SQLExecute</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Fetching a block of data or scrolling through a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E853"></A>
<P><B>SQLExtendedFetch</B> (extension)</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Freeing a statement handle
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E854"></A>
<P><B>SQLFreeStmt</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Fetching part or all of a column of data
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E855"></A>
<P><B>SQLGetData</B> (extension)</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning the number of result set columns
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E856"></A>
<P><B>SQLNumResultCols</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Preparing a statement for execution
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E857"></A>
<P><B>SQLPrepare</B></TD></TR></TABLE><A NAME="E10E81"></A>
<H2>
<FONT FACE="Arial"><B>SQLFetchPrev (SOLID Extension)</B><A NAME="I118"></A></FONT></H2>
<BLOCKQUOTE>
<P><B>SQLFetchPrev</B> fetches a row of data from a result set. The driver returns data for all columns that were bound to storage locations with <B>SQLBindCol</B>.
</BLOCKQUOTE>
<A NAME="E11E173"></A>
<H3>
<FONT FACE="Arial">Syntax</FONT></H3>
<BLOCKQUOTE>
<P>RETCODE <B>SQLFetchPrev</B>(<I>hstmt</I>)<A NAME="I119"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <B>SQLFetchPrev</B> function accepts the following argument.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=125 VALIGN=top >
<BLOCKQUOTE>
<P><B>Type</B>
</BLOCKQUOTE></TD>
<TD WIDTH=125 VALIGN=top >
<A NAME="E7E858"></A>
<P>Argument
</TD><TD WIDTH=82 VALIGN=top >
<A NAME="E7E858"></A>
<P>Use
</TD><TD WIDTH=120 VALIGN=top >
<A NAME="E7E858"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=125 VALIGN=top >
<BLOCKQUOTE>
<P>HSTMT
</BLOCKQUOTE></TD>
<TD WIDTH=125 VALIGN=top >
<A NAME="E7E859"></A>
<P><I>hstmt</I>
</TD><TD WIDTH=82 VALIGN=top >
<A NAME="E7E859"></A>
<P>Input
</TD><TD WIDTH=120 VALIGN=top >
<A NAME="E7E859"></A>
<P>Statement handle.</TD></TR></TABLE>
<A NAME="E11E174"></A>
<H3>
<FONT FACE="Arial">Returns<A NAME="I120"></A></FONT></H3>
<BLOCKQUOTE>
<P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA_FOUND, SQL_ERROR, or SQL_INVALID_HANDLE.
</BLOCKQUOTE>
<A NAME="E11E175"></A>
<H3>
<FONT FACE="Arial">Diagnostics<A NAME="I121"></A></FONT></H3>
<BLOCKQUOTE>
<P>When <B>SQLFetchPrev</B> returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLError</B>. The following table lists the SQLSTATE values commonly returned by <B>SQLFetchPrev </B>and explains each one in the context of this function. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P><B>SQLSTATE</B>
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E860"></A>
<P>Error
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E860"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>01000
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E861"></A>
<P>General warning
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E861"></A>
<P>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>01004
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E862"></A>
<P>Data truncated
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E862"></A>
<P>The data returned for one or more columns was truncated. String values are right truncated. For numeric values, the fractional part of number was truncated. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>07006
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E863"></A>
<P>Restricted data type attribute violation
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E863"></A>
<P>The data value could not be converted to the data type specified by <I>fCType</I> in <B>SQLBindCol</B>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>08S01
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E864"></A>
<P>Communication link failure
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E864"></A>
<P>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22002
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E865"></A>
<P>Indicator value required but not supplied
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E865"></A>
<P>NULL data was fetched into a column whose <I>pcbValue</I> as set by <B>SQLBindCol</B> was a null pointer.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22003
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E866"></A>
<P>Numeric value out of range
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E866"></A>
<P>Returning the numeric value (as numeric or string) for one or more columns would have caused the whole (as opposed to fractional) part of the number to be truncated.
<BLOCKQUOTE>
<P>Returning the binary value for one or more columns would have caused a loss of binary significance.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For more information, see &quot;Converting Data from SQL to C Data Types&quot; in Appendix D, &quot;Data Types.&quot;</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>22012
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E867"></A>
<P>Division by zero
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E867"></A>
<P>A value from an arithmetic expression was returned which resulted in division by zero.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>24000
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E868"></A>
<P>Invalid cursor state
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E868"></A>
<P>The <I>hstmt</I> was in an executed state but no result set was associated with the <I>hstmt</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>40001
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E869"></A>
<P>Serialization failure
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E869"></A>
<P>The transaction in which the fetch was executed was terminated to prevent deadlock.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1000
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E870"></A>
<P>General error
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E870"></A>
<P>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLError</B> in the argument <I>szErrorMsg</I> describes the error and its cause.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1001
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E871"></A>
<P>Memory allocation failure
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E871"></A>
<P>The driver was unable to allocate memory required to support execution or completion of the function.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1002
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E872"></A>
<P>Invalid column number
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E872"></A>
<P>A column number specified in the binding for one or more columns was greater than the number of columns in the result set.
<BLOCKQUOTE>
<P>A column number specified in the binding for a column was 0; <B>SQLFetch</B> cannot be used to retrieve bookmarks.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1008
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E873"></A>
<P>Operation canceled
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E873"></A>
<P>Asynchronous processing was enabled for the <I>hstmt</I>. The function was called and before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I>. Then the function was called again on the <I>hstmt</I>.
<BLOCKQUOTE>
<P>The function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I> from a different thread in a multithreaded application.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1010
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E874"></A>
<P>Function sequence error
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E874"></A>
<P>The specified <I>hstmt</I> was not in an executed state. The function was called without first calling <B>SQLExecDirect</B>, <B>SQLExecute</B>, or a catalog function..
<BLOCKQUOTE>
<P>An asynchronously executing function (not this one) was called for the <I>hstmt</I> and was still executing when this function was called.
</BLOCKQUOTE>
<BLOCKQUOTE>
<P><B>SQLExecute</B>, <B>SQLExecDirect</B>, or <B>SQLSetPos</B> was called for the <I>hstmt</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1C00
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E875"></A>
<P>Driver not capable
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E875"></A>
<P>The driver or data source does not support the conversion specified by the combination of the <I>fCType</I> in <B>SQLBindCol</B> and the SQL data type of the corresponding column. This error only applies when the SQL data type of the column was mapped to a driver-specific SQL data type.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>S1T00
</BLOCKQUOTE></TD>
<TD WIDTH=131 VALIGN=top >
<A NAME="E7E876"></A>
<P>Timeout expired
</TD><TD WIDTH=221 VALIGN=top >
<A NAME="E7E876"></A>
<P>The timeout period expired before the data source returned the result set. The timeout period is set through <B>SQLSetStmtOption</B>, SQL_QUERY_TIMEOUT.</TD></TR></TABLE>
<A NAME="E11E176"></A>
<H3>
<FONT FACE="Arial">Comments<A NAME="I122"></A><A NAME="I123"></A><A NAME="I124"></A><A NAME="I125"></A><A NAME="I126"></A></FONT></H3>
<BLOCKQUOTE>
<P><B>SQLFetchPrev</B> positions the cursor on the previous row of the result set. <B>SQLFetchPrev </B>returns SQL_NO_DATA_FOUND and the cursor is positioned before the start of the result set if <B>SQLFetchPrev</B> is called before <B>SQLFetch</B> has been called. When the cursor is positioned on the first row of the result set, <B>SQLFetchPrev</B> returns the data of the first row again. An application cannot mix calls to <B>SQLExtendedFetch</B> and <B>SQLFetchPrev</B> for the same cursor.<A NAME="I127"></A><A NAME="I128"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If the application called <B>SQLBindCol</B> to bind columns, <B>SQLFetchPrev</B> stores data into the locations specified by the calls to <B>SQLBindCol</B>. If the application does not call <B>SQLBindCol</B> to bind any columns, <B>SQLFetchPrev</B> doesn&#146;t return any data; it just moves the cursor to the next row. An application can call <B>SQLGetData</B> to retrieve data that is not bound to a storage location.<A NAME="I129"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The driver manages cursors during the fetch operation and places each value of a bound column into the associated storage. The driver follows these guidelines when performing a fetch operation:<A NAME="I130"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI><B>SQLFetchPrev</B> accesses column data in left-to-right order.<A NAME="I131"></A><A NAME="I132"></A><A NAME="I133"></A><A NAME="I134"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>After each fetch, <I>pcbValue</I> (specified in <B>SQLBindCol</B>) contains the number of bytes available to return for the column. This is the number of bytes available prior to calling <B>SQLFetchPrev</B>. If the number of bytes available to return cannot be determined in advance, the driver sets <I>pcbValue</I> to SQL_NO_TOTAL.<A NAME="I135"></A><A NAME="I136"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>If <I>rgbValue</I> is not large enough to hold the entire result, the driver stores part of the value and returns SQL_SUCCESS_WITH_INFO. A subsequent call to <B>SQLError</B> indicates that a truncation occurred. The application can compare <I>pcbValue</I> to <I>cbValueMax</I> (specified in <B>SQLBindCol</B>) to determine which column or columns were truncated. If <I>pcbValue</I> is greater than or equal to <I>cbValueMax</I>, then truncation occurred.<A NAME="I137"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>If the data value for the column is NULL, the driver stores SQL_NULL_DATA in <I>pcbValue</I>.<A NAME="I138"></A>
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P><B>SQLFetchPrev</B> is valid only after a call that returns a result set.<A NAME="I139"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>For information about conversions allowed by <B>SQLBindCol</B> and <B>SQLGetData</B>, see &quot;Converting Data from SQL to C Data Types&quot; in Appendix D, &quot;Data Types.&quot;
</BLOCKQUOTE>
<A NAME="E11E177"></A>
<H3>
<FONT FACE="Arial">Code Example<A NAME="I140"></A></FONT></H3>
<BLOCKQUOTE>
<P>See <B>SQLBindCol</B>, <B>SQLColumns</B>, <B>SQLGetData</B>, and <B>SQLProcedures</B>.
</BLOCKQUOTE>
<A NAME="E11E178"></A>
<H3>
<FONT FACE="Arial">Related Functions</FONT></H3>

<TABLE WIDTH=800 >
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P><B>For information about</B>
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E877"></A>
<P>See</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Assigning storage for a column in a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E878"></A>
<P><B>SQLBindCol</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Canceling statement processing
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E879"></A>
<P><B>SQLCancel</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning information about a column in a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E880"></A>
<P><B>SQLDescribeCol</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Executing an SQL statement
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E881"></A>
<P><B>SQLExecDirect</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Executing a prepared SQL statement
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E882"></A>
<P><B>SQLExecute</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Fetching a row of data
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E883"></A>
<P><B>SQLFetch</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Freeing a statement handle
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E884"></A>
<P><B>SQLFreeStmt</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Fetching part or all of a column of data
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E885"></A>
<P><B>SQLGetData</B> (extension)</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning the number of result set columns
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E886"></A>
<P><B>SQLNumResultCols</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Preparing a statement for execution
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E887"></A>
<P><B>SQLPrepare</B></TD></TR></TABLE><A NAME="E10E82"></A>
<H2>
<FONT FACE="Arial"><B>SQLForeignKeys (ODBC 1.0, Level 2)</B><A NAME="I141"></A></FONT></H2>
<BLOCKQUOTE>
<P><B>SQLForeignKeys</B> can return:<A NAME="I142"></A>
</BLOCKQUOTE>
<UL>
<BLOCKQUOTE>
<LI>A list of foreign keys in the specified table (columns in the specified table that refer to primary keys in other tables).<A NAME="I143"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<LI>A list of foreign keys in other tables that refer to the primary key in the specified table.<A NAME="I144"></A>
</BLOCKQUOTE></UL>
<BLOCKQUOTE>
<P>The driver returns each list as a result set on the specified <I>hstmt</I>.
</BLOCKQUOTE>
<A NAME="E11E179"></A>
<H3>
<FONT FACE="Arial">Syntax</FONT></H3>
<BLOCKQUOTE>
<P>RETCODE <B>SQLForeignKeys</B>(<I>hstmt</I>, <I>szPkTableQualifier</I>, <I>cbPkTableQualifier</I>, <I>szPkTableOwner</I>, <I>cbPkTableOwner</I>, <I>szPkTableName</I>, <I>cbPkTableName</I>, <I>szFkTableQualifier</I>, <I>cbFkTableQualifier</I>, <I>szFkTableOwner</I>, <I>cbFkTableOwner</I>, <I>szFkTableName</I>, <I>cbFkTableName</I>)<A NAME="I145"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <B>SQLForeignKeys</B> function accepts the following arguments.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P><B>Type</B>
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E888"></A>
<P>Argument
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E888"></A>
<P>Use
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E888"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>HSTMT
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E889"></A>
<P><I>hstmt</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E889"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E889"></A>
<P>Statement handle.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>UCHAR FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E890"></A>
<P><I>szPkTableQualifie</I><I>r</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E890"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E890"></A>
<P>Primary key table qualifier. If a driver supports qualifiers for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string (&quot;&quot;) denotes those tables that do not have qualifiers.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>SWORD
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E891"></A>
<P><I>cbPkTableQualifie</I><I>r</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E891"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E891"></A>
<P>Length of <I>szPkTableQualifier</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>UCHAR FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E892"></A>
<P><I>szPkTableOwner</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E892"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E892"></A>
<P>Primary key owner name. If a driver supports owners for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string (&quot;&quot;) denotes those tables that do not have owners.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>SWORD
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E893"></A>
<P><I>cbPkTableOwner</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E893"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E893"></A>
<P>Length of <I>szPkTableOwner</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>UCHAR FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E894"></A>
<P><I>szPkTableName</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E894"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E894"></A>
<P>Primary key table name.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>SWORD
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E895"></A>
<P><I>cbPkTableName</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E895"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E895"></A>
<P>Length of <I>szPkTableName</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>UCHAR FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E896"></A>
<P><I>szFkTableQualifie</I><I>r</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E896"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E896"></A>
<P>Foreign key table qualifier. If a driver supports qualifiers for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string (&quot;&quot;) denotes those tables that do not have qualifiers.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>SWORD
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E897"></A>
<P><I>cbFkTableQualifie</I><I>r</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E897"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E897"></A>
<P>Length of <I>szFkTableQualifier</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>UCHAR FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E898"></A>
<P><I>szFkTableOwner</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E898"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E898"></A>
<P>Foreign key owner name. If a driver supports owners for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string (&quot;&quot;) denotes those tables that do not have owners.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>SWORD
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E899"></A>
<P><I>cbFkTableOwner</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E899"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E899"></A>
<P>Length of <I>szFkTableOwner</I>.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>UCHAR FAR *
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E900"></A>
<P><I>szFkTableName</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E900"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E900"></A>
<P>Foreign key table name.</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>SWORD
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E901"></A>
<P><I>cbFkTableName</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E901"></A>
<P>Input
</TD><TD WIDTH=166 VALIGN=top >
<A NAME="E7E901"></A>
<P>Length of <I>szFkTableName</I>.</TD></TR></TABLE>
<A NAME="E11E180"></A>
<H3>
<FONT FACE="Arial">Returns<A NAME="I146"></A></FONT></H3>
<BLOCKQUOTE>
<P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
</BLOCKQUOTE>
<A NAME="E11E181"></A>
<H3>
<FONT FACE="Arial">Diagnostics<A NAME="I147"></A></FONT></H3>
<BLOCKQUOTE>
<P>When <B>SQLForeignKeys</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLError</B>. The following table lists the SQLSTATE values commonly returned by <B>SQLForeignKeys</B> and explains each one in the context of this function; the notation &quot;(DM)&quot; precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P><B>SQLSTATE</B>
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E902"></A>
<P>Error
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E902"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>01000
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E903"></A>
<P>General warning
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E903"></A>
<P>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>08S01
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E904"></A>
<P>Communication link failure
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E904"></A>
<P>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>24000
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E905"></A>
<P>Invalid cursor state
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E905"></A>
<P>(DM) A cursor was open on the <I>hstmt</I> and <B>SQLFetch</B> or <B>SQLExtendedFetch</B> had been called.
<BLOCKQUOTE>
<P>A cursor was open on the <I>hstmt</I> but <B>SQLFetch</B> or <B>SQLExtendedFetch</B> had not been called.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>IM001
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E906"></A>
<P>Driver does not support this function
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E906"></A>
<P>(DM) The driver associated with the <I>hstmt</I> does not support the function.</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1000
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E907"></A>
<P>General error
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E907"></A>
<P>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLError</B> in the argument <I>szErrorMsg</I> describes the error and its cause.</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1001
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E908"></A>
<P>Memory allocation failure
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E908"></A>
<P>The driver was unable to allocate memory required to support execution or completion of the function.</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1008
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E909"></A>
<P>Operation canceled
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E909"></A>
<P>Asynchronous processing was enabled for the <I>hstmt</I>. The function was called and before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I>. Then the function was called again on the <I>hstmt</I>.
<BLOCKQUOTE>
<P>The function was called and, before it completed execution, <B>SQLCancel</B> was called on the <I>hstmt</I> from a different thread in a multithreaded application.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1009
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E910"></A>
<P>Invalid argument value
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E910"></A>
<P>(DM) The arguments <I>szPkTableName</I> and <I>szFkTableName</I> were both null pointers.</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1010
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E911"></A>
<P>Function sequence error
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E911"></A>
<P>(DM) An asynchronously executing function (not this one) was called for the <I>hstmt</I> and was still executing when this function was called.
<BLOCKQUOTE>
<P>(DM) <B>SQLExecute</B>, <B>SQLExecDirect</B>, or <B>SQLSetPos</B> was called for the <I>hstmt</I> and returned SQL_NEED_DATA. This function was called before data was sent for all data-at-execution parameters or columns.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1090
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E912"></A>
<P>Invalid string or buffer length
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E912"></A>
<P>(DM) The value of one of the name length arguments was less than 0, but not equal to SQL_NTS.</TD>
</TR>
<TR>
<TD WIDTH=86 VALIGN=top ><BR></TD>
<TD WIDTH=146 VALIGN=top ><BR></TD>
<TD WIDTH=220 VALIGN=top >
<BLOCKQUOTE>
<P>The<B> </B>value of one of the name length arguments exceeded the maximum length value for the corresponding qualifier or name (see &quot;Comments&quot;).</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1C00
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E913"></A>
<P>Driver not capable
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E913"></A>
<P>A table qualifier was specified and the driver or data source does not support qualifiers.
<BLOCKQUOTE>
<P>A table owner was specified and the driver or data source does not support owners.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=86 VALIGN=top ><BR></TD>
<TD WIDTH=146 VALIGN=top ><BR></TD>
<TD WIDTH=220 VALIGN=top >
<BLOCKQUOTE>
<P>The combination of the current settings of the SQL_CONCURRENCY and SQL_CURSOR_TYPE statement options was not supported by the driver or data source.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=86 VALIGN=top >
<BLOCKQUOTE>
<P>S1T00
</BLOCKQUOTE></TD>
<TD WIDTH=146 VALIGN=top >
<A NAME="E7E914"></A>
<P>Timeout expired
</TD><TD WIDTH=220 VALIGN=top >
<A NAME="E7E914"></A>
<P>The timeout period expired before the data source returned the result set. The timeout period is set through <B>SQLSetStmtOption</B>, SQL_QUERY_TIMEOUT.</TD></TR></TABLE>
<A NAME="E11E182"></A>
<H3>
<FONT FACE="Arial">Comments<A NAME="I148"></A></FONT></H3>
<BLOCKQUOTE>
<P>If <I>szPkTableName</I> contains a table name, <B>SQLForeignKeys</B> returns a result set containing the primary key of the specified table and all of the foreign keys that refer to it.<A NAME="I149"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If <I>szFkTableName</I> contains a table name, <B>SQLForeignKeys</B> returns a result set containing all of the foreign keys in the specified table and the primary keys (in other tables) to which they refer.<A NAME="I150"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>If both <I>szPkTableName</I> and <I>szFkTableName</I> contain table names, <B>SQLForeignKeys</B> returns the foreign keys in the table specified in <I>szFkTableName</I> that refer to the primary key of the table specified in <I>szPkTableName</I>. This should be one key at most.<A NAME="I151"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P><B>SQLForeignKeys</B> returns results as a standard result set. If the foreign keys associated with a primary key are requested, the result set is ordered by FKTABLE_QUALIFIER, FKTABLE_OWNER, FKTABLE_NAME, and KEY_SEQ. If the primary keys associated with a foreign key are requested, the result set is ordered by PKTABLE_QUALIFIER, PKTABLE_OWNER, PKTABLE_NAME, and KEY_SEQ. The following table lists the columns in the result set.<A NAME="I152"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The lengths of VARCHAR columns shown in the table are maximums; the actual lengths depend on the data source. To determine the actual lengths of the TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, and COLUMN_NAME columns, an application can call <B>SQLGetInfo</B> with the SQL_MAX_QUALIFIER_NAME_LEN, SQL_MAX_OWNER_NAME_LEN, SQL_MAX_TABLE_NAME_LEN, and SQL_MAX_COLUMN_NAME_LEN options.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P><B>Column Name</B>
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E915"></A>
<P>Data Type
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E915"></A>
<P>Comments</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>PKTABLE_QUALIFIER
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E916"></A>
<P>Varchar(128)
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E916"></A>
<P>Primary key table qualifier identifier; NULL if not applicable to the data source. If a driver supports qualifiers for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string (&quot;&quot;) for those tables that do not have qualifiers.</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>PKTABLE_OWNER
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E917"></A>
<P>Varchar(128) 
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E917"></A>
<P>Primary key table owner identifier; NULL if not applicable to the data source. If a driver supports owners for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string (&quot;&quot;) for those tables that do not have owners.</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>PKTABLE_NAME
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E918"></A>
<P>Varchar(128)
<BR>not NULL
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E919"></A>
<P>Primary key table identifier.<A NAME="I153"></A></TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>PKCOLUMN_NAME
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E920"></A>
<P>Varchar(128)
<BR>not NULL
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E921"></A>
<P>Primary key column identifier.<A NAME="I154"></A><A NAME="I155"></A></TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>FKTABLE_QUALIFIER
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E922"></A>
<P>Varchar(128)
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E922"></A>
<P>Foreign key table qualifier identifier; NULL if not applicable to the data source. If a driver supports qualifiers for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string (&quot;&quot;) for those tables that do not have qualifiers.</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>FKTABLE_OWNER
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E923"></A>
<P>Varchar(128) 
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E923"></A>
<P>Foreign key table owner identifier; NULL if not applicable to the data source. If a driver supports owners for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string (&quot;&quot;) for those tables that do not have owners.</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>FKTABLE_NAME
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E924"></A>
<P>Varchar(128)
<BR>not NULL
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E925"></A>
<P>Foreign key table identifier.</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>FKCOLUMN_NAME
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E926"></A>
<P>Varchar(128)
<BR>not NULL
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E927"></A>
<P>Foreign key column identifier.</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>KEY_SEQ
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E928"></A>
<P>Smallint
<BR>not NULL
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E929"></A>
<P>Column sequence number in key (starting with 1).<A NAME="I156"></A><A NAME="I157"></A><A NAME="I158"></A><A NAME="I159"></A></TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>UPDATE_RULE
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E930"></A>
<P>Smallint
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E930"></A>
<P>Action to be applied to the foreign key when the SQL operation is <B>UPDATE</B>:
<BLOCKQUOTE>
<P>SQL_CASCADE
<BR>SQL_RESTRICT
<BR>SQL_SET_NULL
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>NULL if not applicable to the data source.<A NAME="I160"></A><A NAME="I161"></A><A NAME="I162"></A><A NAME="I163"></A></TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>DELETE_RULE
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E931"></A>
<P>Smallint
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E931"></A>
<P>Action to be applied to the foreign key when the SQL operation is <B>DELETE</B>:
<BLOCKQUOTE>
<P>SQL_CASCADE
<BR>SQL_RESTRICT
<BR>SQL_SET_NULL
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>NULL if not applicable to the data source.</TD>
</TR>
</BLOCKQUOTE>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>FK_NAME
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E932"></A>
<P>Varchar(128)
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E932"></A>
<P>Foreign key identifier. NULL if not applicable to the data source.</TD>
</TR>
<TR>
<TD WIDTH=146 VALIGN=top >
<BLOCKQUOTE>
<P>PK_NAME
</BLOCKQUOTE></TD>
<TD WIDTH=106 VALIGN=top >
<A NAME="E7E933"></A>
<P>Varchar(128)
</TD><TD WIDTH=200 VALIGN=top >
<A NAME="E7E933"></A>
<P>Primary key identifier. NULL if not applicable to the data source.</TD></TR></TABLE><A NAME="I164"></A>
<BLOCKQUOTE>
<HR ALIGN=CENTER>
<NOTE>Note The FK_NAME and PK_NAME columns were added in ODBC 2.0. ODBC 1.0 drivers may return different, driver-specific columns with the same column numbers.</NOTE>
<HR ALIGN=CENTER>
</BLOCKQUOTE>
<A NAME="E11E183"></A>
<H3>
<FONT FACE="Arial">Code Example<A NAME="I165"></A></FONT></H3>
<BLOCKQUOTE>
<P>This example uses four tables:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=120 VALIGN=top >
<BLOCKQUOTE>
<P><B>SALES_ORDER</B>
</BLOCKQUOTE></TD>
<TD WIDTH=109 VALIGN=top >
<A NAME="E7E934"></A>
<P>SALES_LINE
</TD><TD WIDTH=128 VALIGN=top >
<A NAME="E7E934"></A>
<P>CUSTOMER
</TD><TD WIDTH=95 VALIGN=top >
<A NAME="E7E934"></A>
<P>EMPLOYEE</TD>
</TR>
<TR>
<TD WIDTH=120 VALIGN=top >
<BLOCKQUOTE>
<P>SALES_ID
</BLOCKQUOTE></TD>
<TD WIDTH=109 VALIGN=top >
<A NAME="E7E935"></A>
<P>SALES_ID
</TD><TD WIDTH=128 VALIGN=top >
<A NAME="E7E935"></A>
<P>CUSTOMER_ID
</TD><TD WIDTH=95 VALIGN=top >
<A NAME="E7E935"></A>
<P>EMPLOYEE_ID</TD>
</TR>
<TR>
<TD WIDTH=120 VALIGN=top >
<BLOCKQUOTE>
<P>CUSTOMER_ID
</BLOCKQUOTE></TD>
<TD WIDTH=109 VALIGN=top >
<A NAME="E7E936"></A>
<P>LINE_NUMBER
</TD><TD WIDTH=128 VALIGN=top >
<A NAME="E7E936"></A>
<P>CUST_NAME
</TD><TD WIDTH=95 VALIGN=top >
<A NAME="E7E936"></A>
<P>NAME</TD>
</TR>
<TR>
<TD WIDTH=120 VALIGN=top >
<BLOCKQUOTE>
<P>EMPLOYEE_ID
</BLOCKQUOTE></TD>
<TD WIDTH=109 VALIGN=top >
<A NAME="E7E937"></A>
<P>PART_ID
</TD><TD WIDTH=128 VALIGN=top >
<A NAME="E7E937"></A>
<P>ADDRESS
</TD><TD WIDTH=95 VALIGN=top >
<A NAME="E7E937"></A>
<P>AGE</TD>
</TR>
<TR>
<TD WIDTH=120 VALIGN=top >
<BLOCKQUOTE>
<P>TOTAL_PRICE
</BLOCKQUOTE></TD>
<TD WIDTH=109 VALIGN=top >
<A NAME="E7E938"></A>
<P>QUANTITY
</TD><TD WIDTH=128 VALIGN=top >
<A NAME="E7E938"></A>
<P>PHONE
</TD><TD WIDTH=95 VALIGN=top >
<A NAME="E7E938"></A>
<P>BIRTHDAY</TD>
</TR>
<TR>
<TD WIDTH=120 VALIGN=top ><BR></TD>
<TD WIDTH=109 VALIGN=top >
<BLOCKQUOTE>
<P>PRICE
</BLOCKQUOTE></TD>
<TD WIDTH=128 VALIGN=top ><BR></TD>
<TD WIDTH=95 VALIGN=top ><BR></TD></TR></TABLE>
<BLOCKQUOTE>
<P>In the SALES_ORDER table, CUSTOMER_ID identifies the customer to whom the sale has been made. It is a foreign key that refers to CUSTOMER_ID in the CUSTOMER table. EMPLOYEE_ID identifies the employee who made the sale. It is a foreign key that refers to EMPLOYEE_ID in the EMPLOYEE table.<A NAME="I166"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>In the SALES_LINE table, SALES_ID identifies the sales order with which the line item is associated. It is a foreign key that refers to SALES_ID in the SALES_ORDER table.<A NAME="I167"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>This example calls <B>SQLPrimaryKeys</B> to get the primary key of the SALES_ORDER table. The result set will have one row and the significant columns are:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=167 VALIGN=top >
<BLOCKQUOTE>
<P><B>TABLE_NAME</B>
</BLOCKQUOTE></TD>
<TD WIDTH=167 VALIGN=top >
<A NAME="E7E939"></A>
<P>COLUMN_NAME
</TD><TD WIDTH=119 VALIGN=top >
<A NAME="E7E939"></A>
<P>KEY_SEQ</TD>
</TR>
<TR>
<TD WIDTH=167 VALIGN=top >
<BLOCKQUOTE>
<P>SALES_ORDER
</BLOCKQUOTE></TD>
<TD WIDTH=167 VALIGN=top >
<A NAME="E7E940"></A>
<P>SALES_ID
</TD><TD WIDTH=119 VALIGN=top >
<A NAME="E7E940"></A>
<P>1</TD></TR></TABLE>
<BLOCKQUOTE>
<P>Next, the example calls <B>SQLForeignKeys</B> to get the foreign keys in other tables that reference the primary key of the SALES_ORDER table. The result set will have one row and the significant columns are:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P><B>PKTABLE_</B>
<BR><B>NAME</B>
</BLOCKQUOTE></TD>
<TD WIDTH=100 VALIGN=top >
<A NAME="E7E941"></A>
<P>PKCOLUMN_
<BR><B>NAME</B>
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E942"></A>
<P>FKTABLE_
<BR><B>NAME</B>
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E943"></A>
<P>FKCOLUMN_
<BR><B>NAME</B>
</TD><TD WIDTH=52 VALIGN=top >
<A NAME="E7E944"></A>
<P>KEY_
<BR><B>SEQ</B></TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>SALES_ORDER
</BLOCKQUOTE></TD>
<TD WIDTH=100 VALIGN=top >
<A NAME="E7E945"></A>
<P>SALES_ID
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E945"></A>
<P>SALES_LINE
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E945"></A>
<P>SALES_ID
</TD><TD WIDTH=52 VALIGN=top >
<A NAME="E7E945"></A>
<P>1</TD></TR></TABLE>
<BLOCKQUOTE>
<P>Finally, the example calls <B>SQLForeignKeys</B> to get the foreign keys in the SALES_ORDER table the refer to the primary keys of other tables. The result set will have two rows and the significant columns are:
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P><B>PKTABLE_</B>
<BR><B>NAME</B>
</BLOCKQUOTE></TD>
<TD WIDTH=100 VALIGN=top >
<A NAME="E7E946"></A>
<P>PKCOLUMN_
<BR><B>NAME</B>
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E947"></A>
<P>FKTABLE_
<BR><B>NAME</B>
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E948"></A>
<P>FKCOLUMN_
<BR><B>NAME</B>
</TD><TD WIDTH=52 VALIGN=top >
<A NAME="E7E949"></A>
<P>KEY_
<BR><B>SEQ</B></TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>CUSTOMER
</BLOCKQUOTE></TD>
<TD WIDTH=100 VALIGN=top >
<A NAME="E7E950"></A>
<P>CUSTOMER_ID
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E950"></A>
<P>SALES_ORDER
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E950"></A>
<P>CUSTOMER_ID
</TD><TD WIDTH=52 VALIGN=top >
<A NAME="E7E950"></A>
<P>1</TD>
</TR>
<TR>
<TD WIDTH=100 VALIGN=top >
<BLOCKQUOTE>
<P>EMPLOYEE
</BLOCKQUOTE></TD>
<TD WIDTH=100 VALIGN=top >
<A NAME="E7E951"></A>
<P>EMPLOYEE_ID
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E951"></A>
<P>SALES_ORDER
</TD><TD WIDTH=100 VALIGN=top >
<A NAME="E7E951"></A>
<P>EMPLOYEE_ID
</TD><TD WIDTH=52 VALIGN=top >
<A NAME="E7E951"></A>
<P>1</TD></TR></TABLE>
<BLOCKQUOTE>
<PRE>
<FONT FACE="Courier New">#define TAB_LEN SQL_MAX_TABLE_NAME_LEN + 1
#define COL_LEN SQL_MAX_COLUMN_NAME_LEN + 1
LPSTR   szTable;             /* Table to display       */
UCHAR   szPkTable[TAB_LEN];  /* Primary key table name */
UCHAR   szFkTable[TAB_LEN];  /* Foreign key table name */
UCHAR   szPkCol[COL_LEN];    /* Primary key column     */
UCHAR   szFkCol[COL_LEN];    /* Foreign key column     */
HSTMT      hstmt;
SDWORD      cbPkTable, cbPkCol, cbFkTable, cbFkCol, cbKeySeq;
SWORD      iKeySeq;
RETCODE      retcode;
/* Bind the columns that describe the primary and foreign keys.  */
/* Ignore the table owner, name, and qualifier for this example. */
SQLBindCol(hstmt, 3, SQL_C_CHAR, szPkTable, TAB_LEN, &amp;cbPkTable);
SQLBindCol(hstmt, 4, SQL_C_CHAR, szPkCol, COL_LEN, &amp;cbPkCol);
SQLBindCol(hstmt, 5, SQL_C_SSHORT, &amp;iKeySeq, TAB_LEN, &amp;cbKeySeq);
SQLBindCol(hstmt, 7, SQL_C_CHAR, szFkTable, TAB_LEN, &amp;cbFkTable);
SQLBindCol(hstmt, 8, SQL_C_CHAR, szFkCol, COL_LEN, &amp;cbFkCol);
strcpy(szTable, &quot;SALES_ORDER&quot;);
/* Get the names of the columns in the primary key.              */
retcode = SQLPrimaryKeys(hstmt,
                         NULL, 0,           /* Table qualifier   */
                         NULL, 0,           /* Table owner       */
                         szTable, SQL_NTS); /* Table name        */
while ((retcode == SQL_SUCCESS) || (retcode == SQL SUCCESS_WITH_INFO)) {
   /* Fetch and display the result set. This will be a list of the */
   /* columns in the primary key of the SALES_ORDER table.         */
   retcode = SQLFetch(hstmt);
   if (retcode == SQL_SUCCESS || retcode != SQL_SUCCESS_WITH_INFO)
      fprintf(out, &quot;Column: %s    Key Seq: %hd \n&quot;, szPkCol, iKeySeq);
}
/* Close the cursor (the hstmt is still allocated).                */
SQLFreeStmt(hstmt, SQL_CLOSE);
/* Get all the foreign keys that refer to SALES_ORDER primary key. */
retcode = SQLForeignKeys(hstmt,
                         NULL, 0,          /* Primary qualifier    */
                         NULL, 0,          /* Primary owner        */
                         szTable, SQL_NTS, /* Primary table        */
                         NULL, 0,          /* Foreign qualifier    */
                         NULL, 0,          /* Foreign owner        */
                         NULL, 0);         /* Foreign table        */
while ((retcode == SQL_SUCCESS) || (retcode == SQL_SUCCESS_WITH_INFO)) {
   /* Fetch and display the result set. This will be all of the    */
   /* foreign keys in other tables that refer to the SALES_ORDER   */
   /* primary key.                                                 */
   retcode = SQLFetch(hstmt);
   if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
      fprintf(out, &quot;%-s ( %-s ) &lt;-- %-s ( %-s )\n&quot;, szPkTable,
<BR>              szPkCol, szFkTable, szFkCol);
}
/* Close the cursor (the hstmt is still allocated).                 */
SQLFreeStmt(hstmt, SQL_CLOSE);
/* Get all the foreign keys in the SALES_ORDER table.               */
retcode = SQLForeignKeys(hstmt,
                         NULL, 0,           /* Primary qualifier    */
                         NULL, 0,           /* Primary owner        */
                         NULL, 0,           /* Primary table        */
                         NULL, 0,           /* Foreign qualifier    */
                         NULL, 0,           /* Foreign owner        */
                         szTable, SQL_NTS); /* Foreign table        */
while ((retcode == SQL_SUCCESS) || (retcode == SQL_SUCCESS_WITH_INFO)) {
   /* Fetch and display the result set. This will be all of the    */
   /* primary keys in other tables that are referred to by foreign */
   /* keys in the SALES_ORDER table.                               */
   retcode = SQLFetch(hstmt);
   if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
      fprintf(out, &quot;%-s ( %-s )--&gt; %-s ( %-s )\n&quot;, szFkTable, szFkCol,
              szPkTable, szPkCol);
}
/* Free the hstmt. */
SQLFreeStmt(hstmt, SQL_DROP);</FONT></PRE></BLOCKQUOTE>
<A NAME="E11E184"></A>
<H3>
<FONT FACE="Arial">Related Functions</FONT></H3>

<TABLE WIDTH=800 >
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P><B>For information about</B>
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E952"></A>
<P>See</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Assigning storage for a column in a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E953"></A>
<P><B>SQLBindCol</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Canceling statement processing
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E954"></A>
<P><B>SQLCancel</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Fetching a block of data or scrolling through a result set
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E955"></A>
<P><B>SQLExtendedFetch</B> (extension)</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Fetching a row of data
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E956"></A>
<P><B>SQLFetch</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning the columns of a primary key
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E957"></A>
<P><B>SQLPrimaryKeys</B> (extension)</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Returning table statistics and indexes
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E958"></A>
<P><B>SQLStatistics</B> (extension)</TD></TR></TABLE><P> <A NAME="I168"></A><A NAME="I169"></A><A NAME="I170"></A>
<A NAME="E10E83"></A>
<H2>
<FONT FACE="Arial"><B>SQLFreeConnect</B><B> (ODBC 1.0, Core)</B></FONT></H2>
<A NAME="E7E959"></A>
<P><A NAME="I171"></A><A NAME="I172"></A><A NAME="I173"></A><A NAME="I174"></A><A NAME="I175"></A>
<BLOCKQUOTE>
<P><B>SQLFreeConnect</B> releases a connection handle and frees all memory associated with the handle.
</BLOCKQUOTE>
<A NAME="E11E185"></A>
<H3>
<FONT FACE="Arial">Syntax</FONT></H3>
<BLOCKQUOTE>
<P>RETCODE <B>SQLFreeConnect</B>(<I>hdbc</I>)<A NAME="I176"></A>
</BLOCKQUOTE>
<BLOCKQUOTE>
<P>The <B>SQLFreeConnect</B> function accepts the following argument.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P><B>Type</B>
</BLOCKQUOTE></TD>
<TD WIDTH=100 VALIGN=top >
<A NAME="E7E960"></A>
<P>Argument
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E960"></A>
<P>Use
</TD><TD WIDTH=179 VALIGN=top >
<A NAME="E7E960"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>HDBC
</BLOCKQUOTE></TD>
<TD WIDTH=100 VALIGN=top >
<A NAME="E7E961"></A>
<P><I>hdbc</I>
</TD><TD WIDTH=80 VALIGN=top >
<A NAME="E7E961"></A>
<P>Input
</TD><TD WIDTH=179 VALIGN=top >
<A NAME="E7E961"></A>
<P>Connection handle.</TD></TR></TABLE>
<A NAME="E11E186"></A>
<H3>
<FONT FACE="Arial">Returns<A NAME="I177"></A></FONT></H3>
<BLOCKQUOTE>
<P>SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.
</BLOCKQUOTE>
<A NAME="E11E187"></A>
<H3>
<FONT FACE="Arial">Diagnostics<A NAME="I178"></A></FONT></H3>
<BLOCKQUOTE>
<P>When <B>SQLFreeConnect</B> returns SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained by calling <B>SQLError</B>. The following table lists the SQLSTATE values commonly returned by <B>SQLFreeConnect </B>and explains each one in the context of this function; the notation &quot;(DM)&quot; precedes the descriptions of SQLSTATEs returned by the Driver Manager. The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.
</BLOCKQUOTE>
<TABLE WIDTH=800 >
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P><B>SQLSTATE</B>
</BLOCKQUOTE></TD>
<TD WIDTH=133 VALIGN=top >
<A NAME="E7E962"></A>
<P>Error
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E962"></A>
<P>Description</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>01000
</BLOCKQUOTE></TD>
<TD WIDTH=133 VALIGN=top >
<A NAME="E7E963"></A>
<P>General warning
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E963"></A>
<P>Driver-specific informational message. (Function returns SQL_SUCCESS_WITH_INFO.)</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>08S01
</BLOCKQUOTE></TD>
<TD WIDTH=133 VALIGN=top >
<A NAME="E7E964"></A>
<P>Communication link failure
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E964"></A>
<P>The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>S1000
</BLOCKQUOTE></TD>
<TD WIDTH=133 VALIGN=top >
<A NAME="E7E965"></A>
<P>General error
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E965"></A>
<P>An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by <B>SQLError</B> in the argument <I>szErrorMsg</I> describes the error and its cause.</TD>
</TR>
<TR>
<TD WIDTH=93 VALIGN=top >
<BLOCKQUOTE>
<P>S1010
</BLOCKQUOTE></TD>
<TD WIDTH=133 VALIGN=top >
<A NAME="E7E966"></A>
<P>Function sequence error
</TD><TD WIDTH=226 VALIGN=top >
<A NAME="E7E966"></A>
<P>(DM) The function was called prior to calling <B>SQLDisconnect</B> for the <I>hdbc</I>.</TD></TR></TABLE>
<A NAME="E11E188"></A>
<H3>
<FONT FACE="Arial">Comments<A NAME="I179"></A><A NAME="I180"></A></FONT></H3>
<BLOCKQUOTE>
<P>Prior to calling <B>SQLFreeConnect, </B>an application must call <B>SQLDisconnect</B> for the <I>hdbc.</I> Otherwise, <B>SQLFreeConnect</B> returns SQL_ERROR and the <I>hdbc</I> remains valid. Note that <B>SQLDisconnect</B> automatically drops any <I>hstmts</I> open on the <I>hdbc</I>.
</BLOCKQUOTE>
<A NAME="E11E189"></A>
<H3>
<FONT FACE="Arial">Code Example<A NAME="I181"></A></FONT></H3>
<BLOCKQUOTE>
<P>See <B>SQLBrowseConnect</B> and <B>SQLConnect</B>.
</BLOCKQUOTE>
<A NAME="E11E190"></A>
<H3>
<FONT FACE="Arial">Related Functions</FONT></H3>

<TABLE WIDTH=800 >
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P><B>For information about</B>
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E967"></A>
<P>See</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Allocating a statement handle
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E968"></A>
<P><B>SQLAllocConnect</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Connecting to a data source
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E969"></A>
<P><B>SQLConnect</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Disconnecting from a data source
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E970"></A>
<P><B>SQLDisconnect</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Connecting to a data source using a connection string or dialog box
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E971"></A>
<P><B>SQLDriverConnect</B> (extension)</TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P>Freeing an environment handle
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E972"></A>
<P><B>SQLFreeEnv</B></TD>
</TR>
<TR>
<TD WIDTH=250 VALIGN=top >
<BLOCKQUOTE>
<P> Freeing a statement handle
</BLOCKQUOTE></TD>
<TD WIDTH=202 VALIGN=top >
<A NAME="E7E973"></A>
<P><B>SQLFreeStmt</B></TD></TR></TABLE><P ALIGN=CENTER>
<A HREF="prguid17.htm" TARGET="_self"><IMG SRC="graprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"></A>
<A HREF="httoc.htm" TARGET="_self"><IMG SRC="gratoc.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="TOC"></A>
<A HREF="htindex.htm" TARGET="_self"><IMG SRC="graindex.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Index"></A>
<A HREF="prguid19.htm" TARGET="_self"><IMG SRC="granext.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Next Page"></A>

<center><p><font SIZE=-2>Copyright &copy; 1992-1997 Solid Information Technology Ltd All rights reserved.</font></p></center>
</BODY></HTML>