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 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890
|
<?xml version="1.0"?>
<fpdoc-descriptions>
<package name="fcl">
<!--
====================================================================
sqldb
====================================================================
-->
<module name="sqldb">
<short>
A set of classes for connecting to SQL databases and running SQL commands on
them.
</short>
<descr>
<p>
The SQLDB unit defines four main classes to handle data in SQL based
databases.
</p>
<ol>
<li><link id ="TSQLConnection"/> represents the connection to the database.
Here, properties pertaining to the connection (machine, database, user
password) must be set. This is an abstract class, which should not be used
directly. Per database type (mysql, firebird, postgres, oracle, sqlite)
a descendent should be made and used.</li>
<li><link id ="TSQLQuery"/> is a <link id="#fcl.db.TDataset"/> descendent
which can be used to view and manipulate the result of an SQL select query.
It can also be used to execute all kinds of SQL statements.</li>
<li><link id="TSQLTransaction"/> represents the transaction in which an SQL
command is running. SQLDB supports multiple simultaneous transactions in a
database connection. For databases that do not support this functionality
natively, it is simulated by maintaining multiple connections to the
database.
</li>
<li>
<link id="TSQLScript"/> can be used when many SQL commands must be executed
on a database, for example when creating a database.
</li>
</ol>
<p>
There is also a unified way to retrieve schema information, and a
registration for connector types. More information on how to use these
components can be found in <link id="UsingSQLDB"/>.
</p>
</descr>
<topic name="UsingParams">
<short>Using parameters</short>
<descr>
<p>
SQLDB implements parametrized queries, simulating them if the native SQL
client does not support parametrized queries. A parametrized query means that the
SQL statement contains placeholders for actual values. The following is a
typical example:
</p>
<code>
SELECT * FROM MyTable WHERE (id=:id)
</code>
<p>
The <var>:id</var> is a parameter with the name <var>id</var>.
It does not contain a value yet. The
value of the parameter will be specified separately. In SQLDB this happens
through the <var>TParams</var> collection, where each element of
the collection is a named parameter, specified in the SQL statement. The
value can be specified as follows:
</p>
<code>
Params.ParamByname('id').AsInteger:=123;
</code>
<p>
This will tell SQLDB that the parameter <var>id</var> is of type integer, and has value 123.
</p>
<p>
SQLDB uses parameters for 3 purposes:
</p>
<ol>
<li>When executing a query multiple times, simply with different values,
this helps increase the speed if the server supports parametrized queries:
the query must be prepared only once.</li>
<li>Master-Detail relationships between datasets can be established based on a parametrized
detail query: the value of the parameters in the detail query is
automatically obtained from fields with the same names in the master
dataset. As the user scrolls through the master dataset, the detail dataset
is refreshed with the new values of the params.
</li>
<li>
Updating of data in the database happens through parametrized update/delete/insert
statements: the <link id="TSQLQuery.UpdateSQL"/> , <link
id="TSQLQuery.DeleteSQL"/>, <link id="TSQLQuery.InsertSQL"/> properties of
<link id="TSQLQuery"/> must contain parametrized queries.
</li>
</ol>
<p>
An additional advantage of using parameters is that they help to avoid SQL
injection: by specifying a parameter type and value, SQLDB will
automatically check whether the value is of the correct type, and will apply
proper quoting when the native engine does not support parameters directly.
</p>
</descr>
<seealso>
<link id="TSQLQuery.Params"/>
<link id="UpdateSQLs"/>
</seealso>
</topic>
<topic name="UpdateSQLs">
<short>Automatic generation of update SQL statements</short>
<descr>
<p>
SQLDB (more in particular, <link id="TSQLQuery"/>) can automatically generate
update statements for the data it fetches. To this end, it will scan the SQL
statement and determine the main table in the query: this is the first table
encountered in the <var>FROM</var> part of the <var>SELECT</var> statement.
</p>
<p>
For <var>INSERT</var> and <var>UPDATE</var> operations, the SQL statement
will update/insert all fields that have <var>pfInUpdate</var> in their
<var>ProviderFlags</var> property. Read-only fields will not be added to the
SQL statement. Fields that are NULL will not be added to an insert query,
which means that the database server will insert whatever is in the
<var>DEFAULT</var> clause of the corresponding field definition.
</p>
<p>
The <var>WHERE</var> clause for update and delete statements consists
of all fields with <var>pfInKey</var> in their <var>ProviderFlags</var> property.
Depending on the value of the <link id="TSQLQuery.UpdateMode">UpdateMode</link>
property, additional fields may be added to the <var>WHERE</var> clause:
</p>
<dl>
<dt>upWhereKeyOnly</dt>
<dd>No additional fields are added: only fields marked with <var>pfInKey</var>
are used in the WHERE clause</dd>
<dt>upWhereChanged</dt>
<dd>All fields whose value changed are added to the WHERE clause, using
their old value.</dd>
<dt>upWhereAll</dt>
<dd>All fields are added to the WHERE clause, using their old value.</dd>
</dl>
<p>
In order to let SQLDB generate correct statements, it is important to set
the <link id="#fcl.db.TField.ProviderFlags">ProviderFlags</link> properties
correct for all fields.
</p>
<p>
In many cases, for example when only a single table is queried, and no <var>AS</var> field aliases
are used , setting <link id="TSQLQuery.UsePrimaryKeyAsKey"/> combined
with <var>UpdateMode</var> equal to <var>upWhereKeyOnly</var> is sufficient.
</p>
<p>
If the automatically generated queries are not correct, it is possible to
specify the SQL statements to be used in the
<link id="TSQLQuery.UpdateSQL">UpdateSQL</link>,
<link id="TSQLQuery.InsertSQL">InsertSQL</link> and
<link id="TSQLQuery.DeleteSQL">DeleteSQL</link> properties.
The new field values should be specified using params with the same name as the
field. The old field values should be specified using the <var>OLD_</var>
prefix to the field name. The following example demonstrates this:
</p>
<code>
INSERT INTO MYTABLE
(MYFIELD,MYFIELD2)
VALUES
(:MYFIELD,:MYFIELD2);
UPDATE MYTABLE SET
MYFIELD=:MYFIELD
MYFIELD2=:MYFIELD2
WHERE
(MYFIELD=:OLD_MYFIELD);
DELETE FROM MYTABLE WHERE (MyField=:OLD_MYFIELD);
</code>
</descr>
<seealso>
<link id="UsingParams"/>
<link id="TSQLQuery"/>
<link id="TSQLQuery.UpdateSQL">UpdateSQL</link>
<link id="TSQLQuery.InsertSQL">InsertSQL</link>
<link id="TSQLQuery.UpdateSQL">DeleteSQL</link>
</seealso>
</topic>
<topic name="RetrievingSchemaInformation">
<short>Retrieving Schema Information</short>
<descr>
<p>
Schema Information (lists of available database objects) can be retrieved using some
specialized calls in <link id="TSQLConnection"/>:
</p>
<ul>
<li>
<link id="TSQLConnection.GetTableNames"/> retrieves a list of available tables.
The system tables can be requested.
</li>
<li>
<link id="TSQLConnection.GetProcedureNames"/> retrieves a list of available
stored procedures.
</li>
<li>
<link id="TSQLConnection.GetFieldNames"/> retrieves a list of fields for a
given table.
</li>
</ul>
<p>
These calls are pretty straightforward and need little explanation.
A more versatile system is the schema info query: the <link
id="TCustomSQLQuery.SetSchemaInfo"/> method can be used to create a result
set (dataset) with schema information. The parameter <var>SchemaType</var>
determines the resulting information when the dataset is opened.
The following information can be requested:
</p>
<dl>
<dt>stTables</dt>
<dd>
Retrieves the list of user Tables in database.
This is used internally by <link id="TSQLConnection.GetTableNames"/>.
</dd>
<dt>stSysTables</dt>
<dd>
Retrieves the list of system Tables in database. This is
used internally by <link id="TSQLConnection.GetTableNames"/> when the system
tables are requested
</dd>
<dt>stProcedures</dt>
<dd>
Retrieves a list of stored procedures in database. This is used internally
by <link id="TSQLConnection.GetProcedureNames"/>.
</dd>
<dt>stColumns</dt>
<dd>
Retrieves the list of columns (fields) in a table.
This is used internally by <link id="TSQLConnection.GetFieldNames"/>.
</dd>
<dt>stProcedureParams</dt>
<dd>
This retrieves the parameters for a stored procedure.
</dd>
<dt>stIndexes</dt>
<dd>
Retrieves the indexes for one or more tables. (currently not implemented)
</dd>
<dt>
stPackages
</dt>
<dd>
Retrieves packages for databases that support them. (currently not implemented).
</dd>
</dl>
</descr>
</topic>
<topic name="UniversalConnectors">
<short>Using the universal TSQLConnector type</short>
<descr>
<p>
The normal procedure when using SQLDB is to use one of the <link id="TSQLConnection"/>
descendent components. When the database backend changes, another descendent
of <var>TSQLConnection</var> must be used. When using a lot of different
connection types and components, this may be confusing and a lot of work.
</p>
<p>
There is a universal connector component <link id="TSQLConnector"/> which can
connect to any database supported by SQLDB: it works as a proxy. Behind the
scenes it uses a normal <var>TSQLConnection</var> descendent to do the real
work. All this happens transparantly to the user code, the universal
connector acts and works like any normal connection component.
</p>
<p>
The type of database can be set in its <link id="TSQLConnector.ConnectorType">ConnectorType</link> property.
By setting the <var>ConnectorType</var> property, the connector knows which
<var>TSQLConnection</var> descendent must be created.
</p>
<p>
Each <var>TSQLConnection</var> descendent registers itself with a unique
name in the initialization section of the unit implementing it: this is the
name that should be specified in the <var>ConnectorType</var> of the
universal connection.
The list of available connections can be retrieved with the <link id="GetConnectionList"/>
call.
</p>
<p>
From this mechanism it follows that before a particular connection type can be used,
its definition must be present in the list of connector types. This means
that the unit of the connection type (<var>ibconnection</var>,
<var>pqconnection</var> etc.) must be included in the <var>uses</var> clause
of the program file: if it is not included, the connection type will not be
registered, and it will not be available for use in the universal
connector.
</p>
<p>
The universal connector only exposes the properties common to all connection
types (the ones in <var>TSQLConnection</var>). It does not expose properties
for all the properties available in specific <var>TSQLConnection</var> descendents.
This means that if connection-specific options must be used, they must be included in
the <link id="TSQLConnection.Params">Params</link> property of the universal
connector in the form <var>Name=Value</var>. When the actual connection instance
is created, the connection-specific properties will be set from the
specified parameters.
</p>
</descr>
<seealso>
<link id="TSQLConnection"/>
<link id="TSQLConnector"/>
</seealso>
</topic>
<topic name="UsingSQLDB">
<short>Using SQLDB to access databases</short>
<descr>
<p>
SQLDB can be used to connect to any SQL capable database. It allows to
execute SQL statements on any supported database type in a uniform way,
and allows to fetch and manipulate result sets (such as returned by a SELECT
statement) using a standard <link id="#fcl.db.TDataset">TDataset</link>
interface. SQLDB takes care that updates to the database are posted
automatically to the database, in a cached manner.
</p>
<p>
When using SQLDB, 3 components are always needed:
</p>
<ol>
<li>
A <link id="TSQLConnection"/> descendent. This represents the
connection to the database: the location of the database, and the username
and password to authenticate the connection must be specified here.
For each supported database type (Firebird, PostgreSQL, MySQL) there
is a separate connection component. They all descend from <var>TSQLConnection</var>.
</li>
<li>
A <link id="TSQLTransaction"/> component. SQLDB allows you to have
multiple active but independent transactions in your application.
(useful for instance in middle-tier applications). If the native database
client library does not support this directly, it is emulated using multiple
connections to the database.
</li>
<li>
A <link id="TSQLQuery"/> component. This encapsulates an SQL statement.
Any kind of SQL statement can be executed. The <var>TSQLQuery</var>
component is a <var>TDataset</var> descendent: If the statement returns a result
set, then it can be manipulated using the usual <var>TDataset</var>
mechanisms.
</li>
</ol>
<p>
The 3 components must be linked together: the connection must point to a
default transaction (it is used to execute certain queries for metadata),
the transaction component must point to a connection component. The
TSQLQuery component must point to both a transaction and a database.
</p>
<p>
So in order to view the contents of a table, typically the procedure goes like this:
</p>
<code>
{$mode objfpc}{$h+}
uses sqldb, ibconnection;
Var
C : TSQLConnection;
T : TSQLTransaction;
Q : TSQLQuery;
begin
// Create a connection.
C:=TIBConnection.Create(Nil);
try
// Set credentials.
C.UserName:='MyUSER';
C.Password:='Secret';
C.DatabaseName:='/home/firebird/events.fb';
// Create a transaction.
T:=TSQLTransaction.Create(C);
// Point to the database instance
T.Database:=C;
// Now we can open the database.
C.Connected:=True;
// Create a query to return data
Q:=TSQLQuery.Create(C);
// Point to database and transaction.
Q.Database:=C;
Q.Transaction:=T;
// Set the SQL select statement
Q.SQL.Text:='SELECT * FROM USERS';
// And now use the standard TDataset methods.
Q.Open;
While not Q.EOF do
begin
Writeln(Q.FieldByName('U_NAME').AsString);
Q.Next
end;
Q.Close;
finally
C.Free;
end;
end.
</code>
<p>
The above code is quite simple. The connection type is
<var>TIBConnection</var>, which is used for Firebird/Interbase databases.
To connect to another database (for instance PostgreSQL), the exact same
code could be used, but instead of a <var>TIBConnection</var>, a
<var>TPQConnection</var> component must be used:
</p>
<code>
{$mode objfpc}{$h+}
uses sqldb, pqconnection;
Var
C : TSQLConnection;
T : TSQLTransaction;
Q : TSQLQuery;
begin
// Create a connection.
C:=TPQConnection.Create(Nil);
</code>
<p>
The rest of the code remains identical.
</p>
<p>
The above code used an SQL SELECT statement and the <var>Open</var> method to fetch data from the database.
Almost the same method applies when trying to execute other kinds of queries, such as DDL queries:
</p>
<code>
{$mode objfpc}{$h+}
uses sqldb, ibconnection;
Var
C : TSQLConnection;
T : TSQLTransaction;
Q : TSQLQuery;
begin
C:=TIBConnection.Create(Nil);
try
C.UserName:='MyUSER';
C.Password:='Secret';
C.DatabaseName:='/home/firebird/events.fb';
T:=TSQLTransaction.Create(C);
T.Database:=C;
C.Connected:=True;
Q:=TSQLQuery.Create(C);
Q.Database:=C;
Q.Transaction:=T;
// Set the SQL statement. SQL is a tstrings instance.
With Q.SQL do
begin
Add('CREATE TABLE USERS ( ');
Add(' U_NAME VARCHAR(50), ');
Add(' U_PASSWORD VARCHAR(50) ');
Add(' ) ');
end;
// And now execute the query using ExecSQL
// There is no result, so Open cannot be used.
Q.ExecSQL;
// Commit the transaction.
T.Commit;
finally
C.Free;
end;
end.
</code>
<p>
As can be seen from the above example, the setup is the same as in the case
of fetching data. Note that <link id="TSQLQuery"/> can only execute 1 SQL statement
during ExecSQL.
If many SQL statements must be executed, <link id="TSQLScript"/> must be used.
</p>
<p>
There is much more to <var>TSQLQuery</var> than explained here: it can use
parameters (see <link id="UsingParams"/>) and it can automatically update
the data that you edit in it (see <link id="UpdateSQLs"/>).
</p>
</descr>
<seealso>
<link id="TSQLConnection"/>
<link id="TSQLTransaction"/>
<link id="TSQLQuery"/>
<link id="TSQLConnector"/>
<link id="TSQLScript"/>
<link id="UsingParams"/>
<link id="UpdateSQLs"/>
</seealso>
</topic>
<!-- enumeration type Visibility: default -->
<element name="TSchemaType">
<short>Schema type to retrieve</short>
<descr>
<var>TSchemaType</var> describes which schema information to retrieve in the
<link id="TCustomSQLQuery.SetSchemaInfo"/> call. Depending on its value,
the result set of the dataset will have different fields, describing the
requested schema data. The result data will always have the same structure.
</descr>
<seealso>
<link id="RetrievingSchemaInformation"/>
<link id="TCustomSQLQuery.SetSchemaInfo"/>
</seealso>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stNoSchema">
<short>No schema</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stTables">
<short>User Tables in database</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stSysTables">
<short>System tables in database</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stProcedures">
<short>Stored procedures in database</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stColumns">
<short>Columns in a table</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stProcedureParams">
<short>Parameters for a stored procedure</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stIndexes">
<short>Indexes for a table</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stPackages">
<short>Packages (for databases that support them)</short>
</element>
<!-- enumeration type Visibility: default -->
<element name="TConnOption">
<short>Connection options</short>
<descr>
This type describes some of the option that a particular connection type
supports.
</descr>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnOption.sqSupportParams">
<short>The connection type has native support for parameters.</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnOption.sqEscapeSlash">
<short>Escapes in string literals are done with backslash characters.</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnOption.sqEscapeRepeat">
<short>Escapes in string literals are done by repeating the character.</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnOption.sqQuoteFieldnames">
<short>Field names should be quoted in the SQL statements</short>
</element>
<!-- set type Visibility: default -->
<element name="TConnOptions">
<short>Set of <var>TConnOption</var></short>
<descr>
<var>TConnOptions</var> describes the full set of options defined by a
database.
</descr>
<seealso>
<link id="TConnOption"/>
</seealso>
</element>
<element name="TConnInfoType">
<short>Connection information to be retrieved</short>
</element>
<element name="citAll">
<short>All information, separated by commas.</short>
</element>
<element name="citServerType">
<short>Server type</short>
</element>
<element name="citServerVersion">
<short>Server version as a numeric value</short>
</element>
<element name="citServerVersionString">
<short>Server version as a string.</short>
</element>
<element name="citClientName">
<short>Client library name</short>
</element>
<element name="citClientVersion">
<short>Client library version</short>
</element>
<!-- alias type Visibility: default -->
<element name="TRowsCount">
<short>A type to contain a result row count.</short>
</element>
<!-- object Visibility: default -->
<element name="TSQLConnection">
<short>An abstract class representing a connection to a SQL Database</short>
<descr>
<p>
<var>TSQLConnection </var> is an abstract class for making a connection to a SQL
Database. This class will never be instantiated directly, for each database
type a descendent class specific for this database type must be created.
</p>
<p>
Most of common properties to SQL databases are implemented in this class.
</p>
</descr>
<seealso>
<link id="TSQLQuery"/>
<link id="TSQLTransaction"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TSQLTransaction">
<short>Transaction in which a <var>TSQLQuery</var> is handled</short>
<descr>
<var>TSQLTransaction</var> represents the transaction in which one or more
<link id="TSQLQuery"/> instances are doing their work. It contains the
methods for committing or doing a rollback of the results of query.
At least one <var>TSQLTransaction</var> must be used for each <link
id="TSQLConnection"/> used in an application.
</descr>
<seealso>
<link id="TSQLQuery"/>
<link id="TSQLConnection"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TCustomSQLQuery">
<short>Custom Class to handle SQL commands (with or without result set)</short>
<descr>
<p>
<var>TCustomSQLQuery</var> encapsulates a SQL statement: it implements
all the necessary <link id="#fcl.db.TDataset"/> functionality to be
able to handle a result set. It can also be used to execute SQL statements
that do not return data, using the <link
id="TCustomSQLQuery.ExecSQL">ExecSQL</link> method.
</p>
<p>
Do not instantiate a <var>TCustomSQLQuery</var> class directly,
instead use the <link id="TSQLQuery"/> descendent.
</p>
</descr>
<seealso>
<link id="TSQLQuery"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TSQLQuery">
<short>Class to handle SQL commands (with or without result set)</short>
<descr>
<p>
<var>TSQLQuery</var> exposes the properties and some methods introduced in
<link id="TCustomSQLQuery"/>. It encapsulates a single SQL statement: it implements
all the necessary <link id="#fcl.db.TDataset"/> functionality to be
able to handle a result set. It can also be used to execute a single SQL
statement that does not return data, using the <link id="TCustomSQLQuery.ExecSQL"/> method.
</p>
<p>
Typically, the <link id="TSQLQuery.Database"/> property must be set once, the <link
id="TSQLQuery.Transaction"/> property as well. Then the <link id="TSQLQuery.SQL"/> property can
be set. Depending on the kind of SQL statement, the <link
id="#fcl.db.TDataset.Open">Open</link> method can be used to retrieve
data, or the <var>ExecSQL</var> method can be used to execute the SQL
statement (this can be used for DDL statements, or update statements).
</p>
</descr>
<seealso>
<link id="TSQLTransaction"/>
<link id="TSQLConnection"/>
<link id="TCustomSQLQuery.ExecSQL"/>
<link id="TSQLQuery.SQL"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TSQLScript">
<short>Component to execute various SQL statements</short>
<descr>
<var>TSQLScript</var> is a component that can be used to execute many SQL
statements using a <link id="TSQLQuery"/> component.
The SQL statements are specified in a script <link id="TSQLScript.Script"/> separated
by a terminator character (typically a semicolon (;)).
</descr>
<seealso>
<link id="TSQLTransaction"/>
<link id="TSQLConnection"/>
<link id="TCustomSQLQuery.ExecSQL"/>
<link id="TSQLQuery.SQL"/>
</seealso>
</element>
<!-- enumeration type Visibility: default -->
<element name="TStatementType">
<short>Type describing the kind of SQL statement</short>
<descr>
<var>TStatementType</var> describes the kind of SQL statement that was
enteredin the <var>SQL</var> property of a <link id="TSQLQuery"/> component.
</descr>
<seealso/>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stNone">
<short>The statement type could not be detected.</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stSelect">
<short>The statement is a SQL SELECT statement</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stInsert">
<short>The statement is a SQL INSERT statement</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stUpdate">
<short>The statement is a SQL UPDATE statement</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stDelete">
<short>The statement is a SQL DELETE statement</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stDDL">
<short>The statement is a SQL DDL (Data Definition Language) statement</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stGetSegment">
<short>The statement is a SQL get segment statement</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stPutSegment">
<short>The statement is a SQL put segment statement</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stExecProcedure">
<short>The statement executes a stored procedure</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stStartTrans">
<short>The statement starts a transaction</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stCommit">
<short>The statement commits a transaction</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stRollback">
<short>The statement rolls back a transaction</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stSelectForUpd">
<short>The statement selects data for update</short>
</element>
<!-- object Visibility: default -->
<element name="TSQLHandle">
<short>Internal object representing a database internal handle</short>
<descr>
<p>
<var>TSQLHandle</var> is an abstract internal object representing a database
client handle. It is used by the various connections to implement the
connection-specific functionality, and usually represents a low-level handle.
It is used by the <link id="TSQLQuery"/> component to communicate with the
<link id="TSQLConnection"/> descendent.
</p>
<p>
This object must not be used directly.
</p>
</descr>
<seealso>
<link id="TSQLQuery"/>
<link id="TSQLCursor"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TSQLCursor">
<short>Internal object representing a database result set</short>
<descr>
<p>
<var>TSQLCursor</var> is an abstract internal object representing a result
set returned by a single SQL select statement (<link id="TSQLHandle"/>).
statement. It is used by the <link id="TSQLQuery"/> component to handle
result sets returned by SQL statements.
</p>
<p>
This object must not be used directly.
</p>
</descr>
<seealso>
<link id="TSQLQuery"/>
<link id="TSQLHandle"/>
</seealso>
</element>
<!-- variable Visibility: public -->
<element name="TSQLCursor.FPrepared">
<short>Was the statement prepared</short>
</element>
<!-- variable Visibility: public -->
<element name="TSQLCursor.FInitFieldDef">
<short>Have the field definitions been initialized.</short>
</element>
<!-- variable Visibility: public -->
<element name="TSQLCursor.FStatementType">
<short>Statement type in the SQL property.</short>
</element>
<!-- constant Visibility: default -->
<element name="StatementTokens">
<short>Array of tokens used to determine the statement type.</short>
<descr>
<var>StatementTokens</var> contains an array of string tokens that are used
to detect the type of statement, usually the first SQL keyword of the token.
The presence of this token in the SQL statement determines the kind of
token.
</descr>
<seealso>
<link id="TStatementType"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TServerIndexDefs">
<short>SQLDB specific descendant of the <link id="#fcl.db.TIndexDefs">TIndexDefs</link></short>
class.
<descr>
<var>TServerIndexDefs</var> is a simple descendent of <link
id="#fcl.db.TIndexDefs">TIndexDefs</link> that implements the necessary
methods to update the list of definitions using the <link
id="TSQLConnection"/>. It should not be used directly.
</descr>
<seealso>
<link id="TSQLConnection"/>"
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TServerIndexDefs.Create">
<short>Create a new instance of <var>TServerIndexDefs</var></short>
<descr>
<var>Create</var> will rais an exception if <var>ADataset</var> is not a
<link id="TCustomSQLQuery"/> descendent.
</descr>
<errors>
An <var>EDatabaseError</var> exception will be raised if <var>ADataset</var>
is not a <link id="TCustomSQLQuery"/> descendent.
</errors>
</element>
<!-- argument Visibility: default -->
<element name="TServerIndexDefs.Create.ADataSet">
<short>Dataset for which the index definition collection is created.</short>
</element>
<!-- procedure Visibility: public -->
<element name="TServerIndexDefs.Update">
<short>Updates the list of indexes</short>
<descr>
<var>Update</var> updates the list of indexes, it uses the <link
id="TSQLConnection"/> methods for this.
</descr>
</element>
<!-- property Visibility: public -->
<element name="TSQLConnection.Handle">
<short>Low level handle used by the connection.</short>
<descr>
<var>Handle</var> represents the low-level handle that the TSQLCOnnection
component has received from the client library of the database. Under normal
circumstances, this property must not be used.
</descr>
</element>
<!-- destructor Visibility: public -->
<element name="TSQLConnection.Destroy">
<short>Destroys the instance of the connection.</short>
<descr>
<var>Destroy</var> removes the connection from memory.
When a connection is removed, all datasets are closed, and all transactions too.
</descr>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.StartTransaction">
<short>Start the Transaction associated with this Connection</short>
<descr>
<p>
<var>StartTransaction</var> is a convenience method which starts the default
transaction (<link id="TSQLConnection.Transaction">Transaction</link>). It is equivalent to
</p>
<code>
Connection.Transaction.StartTransaction
</code>
</descr>
<errors>
If no transaction is assigned, an exception will be raised.
</errors>
<seealso>
<link id="TSQLConnection.EndTransaction">EndTransaction</link>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.EndTransaction">
<short>End the Transaction associated with this connection</short>
<descr>
<p>
<var>StartTransaction</var> is a convenience method which ends the default
transaction (<link id="TSQLConnection.Transaction"/>). It is equivalent to
</p>
<code>
Connection.Transaction.EndTransaction
</code>
</descr>
<errors>
If no transaction is assigned, an exception will be raised.
</errors>
<seealso>
<link id="TSQLConnection.StartTransaction">StartTransaction</link>
</seealso>
</element>
<!-- property Visibility: public -->
<element name="TSQLConnection.ConnOptions">
<short>The set of Connection options being used in the Connection</short>
<descr>
<var>ConnOptions</var> is the set of options used by this connection component.
It is normally the same value for all connections of the same type
</descr>
<seealso>
<link id="TConnOption"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.ExecuteDirect">
<short>Execute a piece of SQL code directly, using a Transaction if specified</short>
<descr>
<p>
<var>ExecuteDirect</var> executes an SQL statement directly. If
<var>ATransaction</var> is <var>Nil</var> then the default transaction is
used, otherwise the specified transaction is used.
</p>
<p>
<var>ExecuteDirect</var> does not offer support for parameters, so only
statements that do not need parsing and parameters substitution can be handled.
If parameter substitution is required, use a <link id="TSQLQuery"/>
component and its <link id="TCustomSQLQuery.ExecSQL">ExecSQL</link> method.
</p>
</descr>
<errors>
If no transaction is assigned, and no transaction is passed, an exception
will be raised.
</errors>
<seealso>
<link id="TSQLQuery"/>
<link id="TCustomSQLQuery.ExecSQL">ExecSQL</link>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TSQLConnection.ExecuteDirect.SQL">
<short>SQL statement to be executed</short>
</element>
<!-- argument Visibility: default -->
<element name="TSQLConnection.ExecuteDirect.ATransaction">
<short>Transaction to be used. The default transaction will be used if none is passed</short>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.GetTableNames">
<short>Get a list of the tables in the specified database</short>
<descr>
<p>
<var>GetTableNames</var> will return the names of the tables in the
database in <var>List</var>. If <var>SystemTables</var> is <var>True</var>
then only the names of system tables will be returned.
</p>
<p>
<var>List</var> is cleared before adding the names.
</p>
<remark>
Note that the list may depend on the access rights of the user.
</remark>
</descr>
<seealso>
<link id="TSQLConnection.GetProcedureNames"/>
<link id="TSQLConnection.GetFieldNames"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TSQLConnection.GetTableNames.List">
<short>String list in which table names will be returned.</short>
</element>
<!-- argument Visibility: default -->
<element name="TSQLConnection.GetTableNames.SystemTables">
<short>If <var>True</var> then system table names will also be returned</short>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.GetProcedureNames">
<short>Gets a list of Stored Procedures in the Database</short>
<descr>
<p>
<var>GetProcedureNames</var> will return the names of the stored procedures in the
database in <var>List</var>.
</p>
<p>
<var>List</var> is cleared before adding the names.
</p>
</descr>
<seealso>
<link id="TSQLConnection.GetTableNames"/>
<link id="TSQLConnection.GetFieldNames"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TSQLConnection.GetProcedureNames.List">
<short>String list in which table names will be returned.</short>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.GetFieldNames">
<short>Gets a list of the field names in the specified table</short>
<descr>
<p>
<var>GetFieldNames</var> will return the names of the fields in
<var>TableName</var> in <var>list</var>
</p>
<p>
<var>List</var> is cleared before adding the names.
</p>
</descr>
<errors>
If a non-existing tablename is passed, no error will be raised.
</errors>
<seealso>
<link id="TSQLConnection.GetTableNames"/>
<link id="TSQLConnection.GetProcedureNames"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TSQLConnection.GetFieldNames.TableName">
<short>Name of the table for to retrieve the field names.</short>
</element>
<!-- argument Visibility: default -->
<element name="TSQLConnection.GetFieldNames.List">
<short>Stringlist in which to return the field names.</short>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.CreateDB">
<short>Create a new Database on the server</short>
<descr>
<var>CreateDB</var> will create a new database on the server. Whether or not
this functionality is present depends on the type of the connection. The name
for the new database is taken from the <link id="TSQLConnection.DatabaseName"/> property,
the user credentials are taken from the <link id="TSQLConnection.UserName"/>
and <link id="TSQLConnection.Password"/> properties.
</descr>
<errors>
If the connection type does not support creating a database, then an
<var>EDatabaseError</var> exception is raised. Other exceptions may be
raised if the operation fails, e.g. when the user does not have the
necessary access rights.
</errors>
<seealso>
<link id="TSQLConnection.DropDB"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.DropDB">
<short>Procedure to drop or remove a Database</short>
<descr>
<var>DropDB</var> does the opposite of <link id="TSQLConnection.CreateDB">CreateDB</link>.
It removes the database from the server.
The database must be connected before this command may be used. Whether or not
this functionality is present depends on the type of the connection.
</descr>
<errors>
If the connection type does not support creating a database, then an
<var>EDatabaseError</var> exception is raised. Other exceptions may be
raised if the operation fails, e.g. when the user does not have the
necessary access rights.
</errors>
<seealso>
<link id="TSQLConnection.CreateDB"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.Password">
<short>Password used when authenticating on the database server</short>
<descr>
<p>
<var>Password</var> is used when authenticating the user specified in
<link id="TSQLConnection.username">UserName</link> when connecting to the database server
</p>
<p>
This property must be set prior to activating the connection. Changing it
while the connection is active has no effect.
</p>
</descr>
<seealso>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.HostName"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.Transaction">
<short>Default transaction to be used for this connection</short>
<descr>
<var>Transaction</var> should be set to a <link id="TSQLTransaction"/>
instance. It is set as the default transaction when a query is connected
to the database, and is used in several metadata operations such as <link
id="TSQLConnection.GetTableNames"/>
</descr>
<seealso>
<link id="TSQLTransaction"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.UserName">
<short>The username for authentication on the database server</short>
<descr>
<p>
<var>UserName</var> is used to to authenticate on the database server when
the connection to the database is established.
</p>
<p>
This property must be set prior to activating the connection. Changing it
while the connection is active has no effect.
</p>
</descr>
<seealso>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.HostName"/>
<link id="TSQLConnection.Role"/>
<link id="TSQLConnection.Charset"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.CharSet">
<short>The character set to be used in this database</short>
<descr>
<p>
<var>Charset</var> can be used to tell the user in which character set the
data will be sent to the server, and in which character set the results
should be sent to the client. Some connection types will ignore this
property, and the data will be sent to the client in the encoding used on
the server.
</p>
<p>
This property must be set prior to activating the connection. Changing it
while the connection is active has no effect.
</p>
<remark>
SQLDB will not do anything with this setting except pass it on to the server
if a specific connection type supports it. It does not perform any
conversions by itself based on the value of this setting.
</remark>
</descr>
<seealso>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.HostName"/>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.Role"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.HostName">
<short>The name of the host computer where the database resides</short>
<descr>
<p>
<var>HostName</var> is the the name of the host computer where the
database server is listening for connection. An empty value means the local
machine is used.
</p>
<p>
This property must be set prior to activating the connection. Changing it
while the connection is active has no effect.
</p>
</descr>
<seealso>
<link id="TSQLConnection.Role"/>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.DatabaseName"/>
<link id="TSQLConnection.Charset"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.Connected">
<short>Is a connection to the server active or not</short>
<descr>
<p>
<var>Connected</var> indicates whether a connection to the server is active
or not. No queries to this server can be activated as long as the value is
<var>False</var>
</p>
<p>Setting the property to <var>True</var> will attempt a connection to the
database <link id="TSQLConnection.DatabaseName">DatabaseName</link> on host
<link id="TSQLConnection.HostName">HostName</link> using the credentials
specified in <link id="TSQLConnection.UserName">UserName</link> and
<link id="TSQLConnection.Password">Password</link>. If the connection or
authentication fails, an exception is raised. This has the same effect as
calling <link id="#fcl.db.TCustomConnection.Open">Open</link>.
</p>
<p>
Setting the property to <var>False</var> will close the connection to the
database. All datasets connected to the database will be closed, all
transactions will be closed as well. This has the same effect as
calling <link id="Close"/>
</p>
</descr>
<seealso>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.DatabaseName"/>
<link id="TSQLConnection.Role"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.Role">
<short>Role in which the user is connecting to the database</short>
<descr>
<p>
<var>Role</var> is used to specify the user's role when connecting to the
database user. Not all connection types support roles, for those that do
not, this property is ignored.
</p>
<p>
This property must be set prior to activating the connection. Changing it
while the connection is active has no effect.
</p>
</descr>
<seealso>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.DatabaseName"/>
<link id="TSQLConnection.Hostname"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.DatabaseName">
<short>The name of the database to which connection is required.</short>
<descr>
<p>
<var>DatabaseName</var> is the name of the database to which a connection
must be made. Some servers need a complete path to a file, others need a
symbolic name (an alias): the interpretation of this name depends on the
connection type.
</p>
<p>
This property must be set prior to activating the connection. Changing it
while the connection is active has no effect.
</p>
</descr>
<seealso>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.Charset"/>
<link id="TSQLConnection.Hostname"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.KeepConnection">
<short>Attempt to keep the connection open once it is established.</short>
<descr>
<var>KeepConnection</var> can be used to attempt to keep the connection open
once it is established. This property is currently not implemented.
</descr>
<seealso/>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.LoginPrompt">
<short>Should SQLDB prompt for user credentials when a connection is activated.</short>
<descr>
<var>LoginPrompt</var> can be set to <var>True</var> to force the system to
get a username/password pair from the user. How these data are fetched from
the used depends on the <link id="TSQLConnection.OnLogin">OnLogin</link> event handler.
The <link id="TSQLConnection.UserName">UserName</link> and
<link id="TSQLConnection.Password">Password</link> properties are ignored in
this case.
</descr>
<seealso>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.OnLogin">OnLogin</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.Params">
<short>Extra connection parameters</short>
<descr>
<var>Params</var> can be used to specify extra parameters to use when
establishing a connection to the database. Which parameters can be specified
depends on the connection type.
</descr>
<seealso>
<link id="TSQLConnection.Password"/>
<link id="TSQLConnection.UserName"/>
<link id="TSQLConnection.Hostname"/>
<link id="TSQLConnection.DatabaseName"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.OnLogin">
<short>Event handler for login process</short>
<descr>
<var>OnLogin</var> will be used when <link id="TSQLConnection.LoginPrompt">loginPrompt</link> is
<var>True</var>. It will be called, and can be used to present a user with a
dialog in which the username and password can be asked.
</descr>
<seealso>
<link id="TSQLConnection.LoginPrompt"/>
</seealso>
</element>
<!-- enumeration type Visibility: default -->
<element name="TCommitRollbackAction">
<short>Transaction actions (unused)</short>
<descr>
<var>TCommitRollbackAction</var> is currently unused in SQLDB.
</descr>
<seealso>
<link id="TSQLTransaction.Action"/>
</seealso>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCommitRollbackAction.caNone">
<short>Do nothing</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCommitRollbackAction.caCommit">
<short>Commit transaction</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCommitRollbackAction.caCommitRetaining">
<short>Commit transaction, retaining transaction context</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCommitRollbackAction.caRollback">
<short>Rollback transaction</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TCommitRollbackAction.caRollbackRetaining">
<short>Rollback transaction, retaining transaction context</short>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLTransaction.Commit">
<short>Commit the transaction, end transaction context.</short>
<descr>
<p>
<var>Commit</var> commits an active transaction. The changes will be
irreversably written to the database.
</p>
<p>After this, the transaction is deactivated and must be reactivated with the <link
id="TSQLTransaction.StartTransaction">StartTransaction</link> method.
To commit data while retaining an active transaction, execute <link
id="TSQLTransaction.CommitRetaining">CommitRetaining</link> instead.
</p>
</descr>
<errors>
Executing <var>Commit</var> when no transaction is active will result in an
exception. A transaction must be started by calling <link id="TSQLTransaction.StartTransaction">StartTransaction</link>.
If the database backend reports an error, an exception is raised as well.
</errors>
<seealso>
<link id="TSQLTransaction.StartTransaction">StartTransaction</link>
<link id="TSQLTransaction.CommitRetaining">CommitRetaining</link>
<link id="TSQLTransaction.Rollback">Rollback</link>
<link id="TSQLTransaction.RollbackRetaining">RollbackRetaining</link>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLTransaction.CommitRetaining">
<short>Commit the transaction, retain transaction context.</short>
<descr>
<p>
<var>CommitRetaining</var> commits an active transaction. The changes will be
irreversably written to the database.
</p>
<p>After this, the transaction is still active.
To commit data and deactivate the transaction, execute <link
id="TSQLTransaction.Commit">Commit</link> instead.
</p>
</descr>
<errors>
Executing <var>CommitRetaining</var> when no transaction is active will result in an
exception.
A transaction must be started by calling <link id="TSQLTransaction.StartTransaction">StartTransaction</link>.
If the database backend reports an error, an exception is raised as well.
</errors>
<seealso>
<link id="TSQLTransaction.StartTransaction">StartTransaction</link>
<link id="TSQLTransaction.Commit">Retaining</link>
<link id="TSQLTransaction.Rollback">Rollback</link>
<link id="TSQLTransaction.RollbackRetaining">RollbackRetaining</link>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLTransaction.Rollback">
<short>Roll back all changes made in the current transaction.</short>
<descr>
<p>
<var>Rollback</var> undoes all changes in the databack since the start of
the transaction. It can only be executed in an active transaction.
</p>
<p>After this, the transaction is no longer active.
To undo changes but keep an active transaction, execute
<link id="TSQLTransaction.RollbackRetaining">RollbackRetaining</link> instead.
</p>
<remark>
Changes posted in datasets that are coupled to this transaction will not be undone
in memory: these datasets must be reloaded from the database (using <var>Close</var> and
<var>Open</var> to reload the data as it is in the database.
</remark>
</descr>
<errors>
Executing <var>Rollback</var> when no transaction is active will
result in an exception.
A transaction must be started by calling <link
id="TSQLTransaction.StartTransaction">StartTransaction</link>.
If the database backend reports an error, an exception is raised as well.
</errors>
<seealso>
<link id="TSQLTransaction.StartTransaction">StartTransaction</link>
<link id="TSQLTransaction.CommitRetaining">CommitRetaining</link>
<link id="TSQLTransaction.Commit">Commit</link>
<link id="TSQLTransaction.RollbackRetaining">RollbackRetaining</link>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLTransaction.RollbackRetaining">
<short>Roll back changes made in the transaction, keep transaction context.</short>
<descr>
<p>
<var>RollbackRetaining</var> undoes all changes in the databack since the start of
the transaction. It can only be executed in an active transaction.
</p>
<p>After this, the transaction is kept in an active state.
To undo changes and close the transaction, execute
<link id="TSQLTransaction.Rollback">Rollback</link> instead.
</p>
<remark>
Changes posted in datasets that are coupled to this transaction will not be undone
in memory: these datasets must be reloaded from the database (using <var>Close</var> and
<var>Open</var> to reload the data as it is in the database.
</remark>
</descr>
<errors>
Executing <var>RollbackRetaining</var> when no transaction is active will
result in an exception.
A transaction must be started by calling <link
id="TSQLTransaction.StartTransaction">StartTransaction</link>.
If the database backend reports an error, an exception is raised as well.
</errors>
<seealso>
<link id="TSQLTransaction.StartTransaction">StartTransaction</link>
<link id="TSQLTransaction.Commit">Commit</link>
<link id="TSQLTransaction.Rollback">Rollback</link>
<link id="TSQLTransaction.CommitRetaining">CommitRetaining</link>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLTransaction.StartTransaction">
<short>Start a new transaction</short>
<descr>
<p>
<var>StartTransaction</var> starts a new transaction context.
All changes written to the database must be confirmed with a <link
id="TSQLTransaction.Commit">Commit</link> or can be undone with a <link
id="TSQLTransaction.Rollback">Rollback</link> call.
</p>
<p>
Calling <var>StartTransaction</var> is equivalent to setting
<var>Active</var> to <var>True</var>.
</p>
</descr>
<errors>
If <var>StartTransaction</var> is called while the transaction is still
active, an exception will be raised.
</errors>
<seealso>
<link id="TSQLTransaction.StartTransaction">StartTransaction</link>
<link id="TSQLTransaction.Commit">Commit</link>
<link id="TSQLTransaction.Rollback">Rollback</link>
<link id="TSQLTransaction.CommitRetaining">CommitRetaining</link>
<link id="TSQLTransaction.EndTransaction">EndTransaction</link>
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TSQLTransaction.Create">
<short>Create a new transaction</short>
<descr>
<var>Create</var> creates a new <var>TSQLTransaction</var> instance, but
does not yet start a transaction context.
</descr>
</element>
<!-- argument Visibility: default -->
<element name="TSQLTransaction.Create.AOwner">
<short>Owner of the transaction component.</short>
</element>
<!-- destructor Visibility: public -->
<element name="TSQLTransaction.Destroy">
<short>Destroy transaction component</short>
<descr>
<var>Destroy</var> will close all datasets connected to it, prior to
removing the object from memory.
</descr>
</element>
<!-- property Visibility: public -->
<element name="TSQLTransaction.Handle">
<short>Low-level transaction handle</short>
<descr>
<var>Handle</var> is the low-level transaction handle object.
It must not be used in application code. The actual type of this object
depends on the type of <link id="TSQLConnection"/> descendent.
</descr>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLTransaction.EndTransaction">
<short>End the transaction</short>
<descr>
<var>EndTransaction</var> is equivalent to <link id="TSQLTransaction.RollBack">RollBack</link>.
</descr>
<seealso>
<link id="TSQLTransaction.RollBack">RollBack</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLTransaction.Action">
<short>Currently unused in SQLDB</short>
<descr>
<var>Action</var> is currently unused in SQLDB.
</descr>
</element>
<!-- property Visibility: published -->
<element name="TSQLTransaction.Database">
<short>Database for which this component is handling connections</short>
<descr>
<var>Database</var> should be set to the particular <link id="TSQLConnection"/>
instance this transaction is handling transactions in.
All datasets connected to this transaction component must have the same value
for their <link id="TSQLQuery.Database">Database</link> property.
</descr>
<seealso>
<link id="TSQLQuery.Database"/>
<link id="TSQLConnection"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLTransaction.Params">
<short>Transaction parameters</short>
<descr>
<var>Params</var> can be used to set connection-specific parameters in the
form of <var>Key=Value</var> pairs. The contents of this property therefor
depends on the type of connection.
</descr>
<seealso>
<link id="TSQLConnection"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TCustomSQLQuery.Prepare">
<short>Prepare a query for execution.</short>
<descr>
<p>
<var>Prepare</var> will prepare the SQL for execution. It will open the
database connection if it was not yet open, and will start a transaction if
none was started yet. It will then determine the statement type.
Finally, it will pass the statement on to the database engine if it supports
preparing of queries.
</p>
<p>
Strictly speaking, it is not necessary to call prepare, the component will
prepare the statement whenever it is necessary. If a query will be executed
repeatedly, it is good practice to prepare it once before starting to execute it.
This will speed up execution, since resources must be allocated only once.
</p>
</descr>
<errors>
If the SQL server cannot prepare the statement, an exception will be raised.
</errors>
<seealso>
<link id="TSQLQuery.StatementType"/>
<link id="TCustomSQLQuery.UnPrepare"/>
<link id="TCustomSQLQuery.ExecSQL"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TCustomSQLQuery.UnPrepare">
<short>Unprepare a prepared query</short>
<descr>
<p>
<var>Unprepare</var> will unprepare a prepared query. This means that server
resources for this statement are deallocated. After a query was unprepared,
any <var>ExecSQL</var> or <var>Open</var> command will prepare the SQL
statement again.
</p>
<p>
Several actions will unprepare the statement: Setting the <link
id="TSQLQuery.SQL"/> property, setting the <var>Transaction</var> property
or setting the <var>Database</var> property will automaticall call
<var>UnPrepare</var>. Closing the dataset will also unprepare the query.
</p>
</descr>
<errors>
If the SQL server cannot unprepare the statement, an exception may be raised.
</errors>
<seealso>
<link id="TSQLQuery.StatementType"/>
<link id="TCustomSQLQuery.Prepare"/>
<link id="TCustomSQLQuery.ExecSQL"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TCustomSQLQuery.ExecSQL">
<short>Execute a SQL statement that does not return a result set</short>
<descr>
<p>
<var>ExecSQL</var> will execute the statement in <link id="TSQLQuery.SQL"/>, preparing the statement if necessary.
It cannot be used to get results from the database (such as returned by a <var>SELECT</var> statement):
for this, the <link id="#fcl.db.TDataset.Open">Open</link> method must be used.
</p>
<p>
The SQL property should be a single SQL command. To execute multiple SQL
statements, use the <link id="TSQLScript"/> component instead.
</p>
<p>
If the statement is a <var>DML</var> statement, the number of
deleted/updated/inserted rows can be determined using <link
id="TCustomSQLQuery.RowsAffected"/>.
</p>
<p>
The <var>Database</var> and <var>Transaction</var> properties must be
assigned before calling <var>ExecSQL</var>. Executing an empty SQL statement
is also an error.
</p>
</descr>
<errors>
If the server reports an error, an exception will be raised.
</errors>
<seealso>
<link id="TCustomSQLQuery.RowsAffected"/>
<link id="#fcl.db.TDataset.Open">TDataset.Open</link>
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TCustomSQLQuery.Create">
<short>Create a new instance of <var>TCustomSQLQuery</var>.</short>
<descr>
<var>Create</var> allocates a new instance on the heap and will
allocate all resources for the SQL statement. After this it calls
the inherited constructor.
</descr>
<errors>
If not enough memory is available, an exception will be raised.
</errors>
<seealso>
<link id="TCustomSQLQuery.Destroy"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TCustomSQLQuery.Create.AOwner">
<short>Owner for the new <var>TCustomSQLQuery</var> instance.</short>
</element>
<!-- destructor Visibility: public -->
<element name="TCustomSQLQuery.Destroy">
<short>Destroy instance of <var>TCustomSQLQuery</var></short>
<descr>
<var>Destroy</var> cleans up the instance, closing the dataset and freeing
all allocated resources.
</descr>
<seealso>
<link id="TCustomSQLQuery.Create"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TCustomSQLQuery.SetSchemaInfo">
<short>SetSchemaInfo prepares the dataset to retrieve schema info.</short>
<descr>
<p>
<var>SetSchemaInfo</var> will prepare the dataset to retrieve schema
information from the connection, and represents the schema info as a dataset.
</p>
<p>
<var>SetSchemaInfo</var> is used internally to prepare a query to retrieve
schema information from a connection. It will store the 3 passed parameters,
which are then used in the ParseSQL and Prepare stages to optimize the
allocated resources. setting the schema type to anything other than
<var>stNoSchema</var> will also set (or mimic) the SQL statement as soon
as the query is prepared. For connection types that support this, the
SQL statement is then set to whatever statement the database connection
supports to retrieve schema information.
</p>
<p>
This is used internally by <link id="TSQLConnection.GetTableNames"/> and
<link id="TSQLConnection.GetProcedureNames"/> to get the necessary
schema information from the database.
</p>
</descr>
<seealso>
<link id="TSQLConnection.GetTableNames"/>
<link id="TSQLConnection.GetProcedureNames"/>
<link id="RetrievingSchemaInformation"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TCustomSQLQuery.SetSchemaInfo.SchemaType">
<short>Schema to use</short>
</element>
<!-- argument Visibility: default -->
<element name="TCustomSQLQuery.SetSchemaInfo.SchemaObjectName">
<short>Object name for which to search. May be empty to retrieve all objects</short>
</element>
<!-- argument Visibility: default -->
<element name="TCustomSQLQuery.SetSchemaInfo.SchemaPattern">
<short>Currently unused</short>
</element>
<!-- property Visibility: public -->
<element name="TCustomSQLQuery.Prepared">
<short>Is the query prepared ?</short>
<descr>
<var>Prepared</var> is true if <link id="TCustomSQLQuery.Prepare">Prepare</link> was called for this
query, and an <link id="TCustomSQLQuery.UnPrepare">UnPrepare</link> was not
done after that (take care: several actions call <var>UnPrepare</var>
implicitly). Initially, <var>Prepared</var> will be <var>False</var>.
Calling <var>Prepare</var> if the query was already prepared has no effect.
</descr>
<seealso>
<link id="TCustomSQLQuery.Prepare"/>
<link id="TCustomSQLQuery.UnPrepare"/>
</seealso>
</element>
<!-- function Visibility: public -->
<element name="TCustomSQLQuery.RowsAffected">
<short>Return the number of rows (records) affected by the last DML/DDL statement</short>
<descr>
<var>RowsAffected</var> returns the number of rows affected by the last
statement executed using <link id="TCustomSQLQuery.ExecSQL">ExecSQL</link>.
</descr>
<errors>
If the connection or database type does not support returning this number, -1 is returned.
If the query is not connected to a database, -1 is returned.
</errors>
<seealso>
<link id="TCustomSQLQuery.ExecSQL"/>
<link id="TSQLConnection"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TCustomSQLQuery.RowsAffected.Result">
<short>The number of affected rows or -1 if not supported</short>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.Active" link="#fcl.db.tdataset.active"/>
<element name="TSQLQuery.AutoCalcFields" link="#fcl.db.tdataset.autocalcfields"/>
<element name="TSQLQuery.Filter" link="#fcl.db.tdataset.filter"/>
<element name="TSQLQuery.Filtered" link="#fcl.db.tdataset.filtered"/>
<element name="TSQLQuery.AfterCancel" link="#fcl.db.tdataset.AfterCancel"/>
<element name="TSQLQuery.AfterClose" link="#fcl.db.tdataset.AfterClose"/>
<element name="TSQLQuery.AfterDelete" link="#fcl.db.tdataset.AfterDelete"/>
<element name="TSQLQuery.AfterEdit" link="#fcl.db.tdataset.AfterEdit"/>
<element name="TSQLQuery.AfterInsert" link="#fcl.db.tdataset.AfterInsert"/>
<element name="TSQLQuery.AfterOpen" link="#fcl.db.tdataset.AfterOpen"/>
<element name="TSQLQuery.AfterPost" link="#fcl.db.tdataset.AfterPost"/>
<element name="TSQLQuery.AfterScroll" link="#fcl.db.tdataset.AfterScroll"/>
<element name="TSQLQuery.BeforeCancel" link="#fcl.db.tdataset.BeforeCancel"/>
<element name="TSQLQuery.BeforeClose" link="#fcl.db.tdataset.BeforeClose"/>
<element name="TSQLQuery.BeforeDelete" link="#fcl.db.tdataset.BeforeDelete"/>
<element name="TSQLQuery.BeforeEdit" link="#fcl.db.tdataset.BeforeEdit"/>
<element name="TSQLQuery.BeforeInsert" link="#fcl.db.tdataset.BeforeInsert"/>
<element name="TSQLQuery.BeforeOpen" link="#fcl.db.tdataset.BeforeOpen"/>
<element name="TSQLQuery.BeforePost" link="#fcl.db.tdataset.BeforePost"/>
<element name="TSQLQuery.BeforeScroll" link="#fcl.db.tdataset.BeforeScroll"/>
<element name="TSQLQuery.OnCalcFields" link="#fcl.db.tdataset.OnCalcFields"/>
<element name="TSQLQuery.OnDeleteError" link="#fcl.db.tdataset.OnDeleteError"/>
<element name="TSQLQuery.OnEditError" link="#fcl.db.tdataset.OnEditError"/>
<element name="TSQLQuery.OnFilterRecord" link="#fcl.db.tdataset.OnFilterRecord"/>
<element name="TSQLQuery.OnNewRecord" link="#fcl.db.tdataset.OnNewRecord"/>
<element name="TSQLQuery.OnPostError" link="#fcl.db.tdataset.OnPostError"/>
<element name="TSQLQuery.Database">
<short>The <var>TSQLConnection</var> instance on which to execute SQL Statements</short>
<descr>
<p>
<var>Database</var> is the SQL connection (of type <link id="TSQLConnection"/>)
on which SQL statements will be executed, and from which result sets will be retrieved.
This property must be set before any form of SQL command can be executed, just like the
<link id="TSQLQuery.Transaction">Transaction</link> property must be set.
</p>
<p>
Multiple <var>TSQLQuery</var> instances can be connected to a database at the same time.
</p>
</descr>
<seealso>
<link id="TSQLQuery.Transaction"/>
<link id="TSQLConnection"/>
<link id="TSQLTransaction"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.Transaction">
<short>Transaction in which to execute SQL statements</short>
<descr>
<p>
<var>Transaction</var> must be set to a SQL transaction (of type <link id="TSQLTransaction"/>)
component. All SQL statements (<var>SQL</var> / <var>InsertSQL</var> / <var>updateSQL</var> /
<var>DeleteSQL</var>) etc.) will be executed in the context of this transaction.
</p>
<p>
The transaction must be connected to the same database instance as the query itself.
</p>
<p>
Multiple <var>TSQLQuery</var> instances can be connected to a transaction at the same time.
If the transaction is rolled back, all changes done by all <var>TSQLQuery</var> instances
will be rolled back.
</p>
</descr>
<seealso>
<link id="TSQLQuery.Database"/>
<link id="TSQLConnection"/>
<link id="TSQLTransaction"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.ReadOnly" link="#fcl.db.tdataset.readonly"/>
<!-- property Visibility: published -->
<element name="TSQLQuery.SQL">
<short>The SQL statement to execute</short>
<descr>
<p><var>SQL</var> is the SQL statement that will be executed when <link
id="TCustomSQLQuery.ExecSQL">ExecSQL</link> is called,
or <link id="#fcl.db.Tdataset.Open">Open</link> is called. It should contain
a valid SQL statement for the connection to which the <link id="TSQLQuery"/>
component is connected. SQLDB will not attempt to modify the SQL statement
so it is accepted by the SQL engine.
</p>
<p>Setting or modifying the SQL statement will call <link
id="TCustomSQLQuery.UnPrepare">UnPrepare</link>
</p>
<p>
If <link id="TSQLQuery.ParseSQL">ParseSQL</link> is <var>True</var>,
the SQL statement will be parsed and the <link
id="TSQLQuery.Params">Params</link> property will be updated with the
names of the parameters found in the SQL statement.
</p>
<p>
See also <printshort id="#fcl.sqldb.UsingParams"/>
</p>
</descr>
<seealso>
<link id="TSQLQuery.ParseSQL"/>
<link id="TSQLQuery.Params"/>
<link id="TCustomSQLQuery.ExecSQL"/>
<link id="#fcl.db.Tdataset.Open">TDataset.Open</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.UpdateSQL">
<short>Statement to be used when updating an existing row in the database</short>
<descr>
<p>
<var>UpdateSQL</var> can be used to specify an SQL <var>UPDATE</var>
statement, which is used when an existing record was modified in the dataset,
and the changes must be written to the database. <var>TSQLQuery</var> can generate
an update statement by itself for many cases, but in case it fails, the
statement to be used for the update can be specified here.
</p>
<p>
The SQL statement should be parametrized according to the conventions
for specifying parameters. Note that old field values can be specified
as <var>:OLD_FIELDNAME</var>
</p>
</descr>
<seealso>
<link id="TSQLQuery.SQL"/>
<link id="TSQLQuery.InsertSQL"/>
<link id="TSQLQuery.DeleteSQL"/>
<link id="TSQLQuery.UpdateMode"/>
<link id="UsingParams"/>
<link id="UpdateSQLS"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.InsertSQL">
<short>Statement to be used when inserting a new row in the database</short>
<descr>
<p>
<var>InsertSQL</var> can be used to specify an SQL <var>INSERT</var>
statement, which is used when a new record was appended to the dataset,
and the changes must be written to the database. <var>TSQLQuery</var>
can generate an insert statement by itself for many cases, but in case
it fails, the statement to be used for the insert can be specified here.
</p>
<p>
The SQL statement should be parametrized according to the conventions
for specifying parameters. Note that old field values can be specified
as <var>:OLD_FIELDNAME</var>
</p>
</descr>
<seealso>
<link id="TSQLQuery.SQL"/>
<link id="TSQLQuery.UpdateSQL"/>
<link id="TSQLQuery.DeleteSQL"/>
<link id="TSQLQuery.UpdateMode"/>
<link id="UsingParams"/>
<link id="UpdateSQLS"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.DeleteSQL">
<short>Statement to be used when inserting a new row in the database</short>
<descr>
<p>
<var>DeleteSQL</var> can be used to specify an SQL <var>DELETE</var>
statement, which is used when an existing record was deleted from the dataset,
and the changes must be written to the database. <var>TSQLQuery</var>
can generate a delete statement by itself for many cases, but in case
it fails, the statement to be used for the insert can be specified here.
</p>
<p>
The SQL statement should be parametrized according to the conventions
for specifying parameters. Note that old field values can be specified
as <var>:OLD_FIELDNAME</var>
</p>
</descr>
<seealso>
<link id="TSQLQuery.SQL"/>
<link id="TSQLQuery.UpdateSQL"/>
<link id="TSQLQuery.DeleteSQL"/>
<link id="TSQLQuery.UpdateMode"/>
<link id="UsingParams"/>
<link id="UpdateSQLS"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.IndexDefs" link="#fcl.bufdataset.TCustomBufDataset.IndexDefs">
<short>List of local index Definitions</short>
<descr>
</descr>
<seealso>
<link id="TCustomBufDataset.IndexDefs"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.Params">
<short>Parameters detected in the SQL statement.</short>
<descr>
<p>
<var>Params</var> contains the parameters used in the SQL statement. This
collection is only updated when <link id="TSQLQuery.ParseSQL">ParseSQL</link>
is <var>True</var>. For each named parameter in the <link id="TSQLQuery.SQL">SQL</link>
property, a named item will appear in the collection, and the collection
will be used to retrieve values from.
</p>
<p>
When <link id="#fcl.db.TDataset.open">Open</link> or
<link id="TCustomSQLQuery.ExecSQL">ExecSQL</link> is called,
and the <link id="TSQLQuery.Datasource">Datasource</link> property is not
<var>Nil</var>,
then for each parameter for which no value was explicitly set (its <link id="#fcl.db.TParam.Bound">Bound</link>
property is <var>False</var>), the value
will be retrieved from the dataset connected to the datasource.
</p>
<p>
For each parameter, a field with the same name will be searched,
and its value and type will be copied to the (unbound) parameter.
The parameter remains unbound.
</p>
<p>
The Update, delete and insert SQL statements are not scanned for parameters.
</p>
</descr>
<seealso>
<link id="TSQLQuery.SQL"/>
<link id="TSQLQuery.ParseSQL"/>
<link id="#fcl.db.TParam.Bound">TParam.Bound</link>
<link id="UsingParams"/>
<link id="UpdateSQLS"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.UpdateMode">
<short>How to create update SQL statements.</short>
<descr>
<p>
<var>UpdateMode</var> determines how the <var>WHERE</var> clause of the
<link id="TSQLQuery.UpdateSQL">UpdateSQL</link> and
<link id="TSQLQuery.DeleteSQL">DeleteSQL</link> statements are
auto-generated.
</p>
<dl>
<dt>upWhereAll</dt>
<dd><printshort id="#fcl.db.TUpdateMode.upWhereAll"/></dd>
<dt>upWhereChanged</dt>
<dd><printshort id="#fcl.db.TUpdateMode.upWhereChanged"/></dd>
<dt>upWhereKeyOnly</dt>
<dd><printshort id="#fcl.db.TUpdateMode.upWhereKeyOnly"/></dd>
</dl>
</descr>
<seealso>
<link id="TSQLQuery.UpdateSQL"/>
<link id="TSQLQuery.InsertSQL"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.UsePrimaryKeyAsKey">
<short>Should primary key fields be marked <var>pfInKey</var></short>
<descr>
<p>
<var>UsePrimaryKeyAsKey</var> can be set to <var>True</var> to let
<var>TSQLQuery</var> fetch all server indexes and if there is a primary key,
update the <link id="#fcl.db.TField.ProviderFlags">ProviderFlags</link> of the
fields in the primary key with <link id="#fcl.db.TProviderFlag">pfInKey</link>.
</p>
<p>
The effect of this is that when <link id="TSQLQuery.UpdateMode">UpdateMode</link>
equals <var>upWhereKeyOnly</var>, then only the fields that are part of the primary key
of the table will be used in the update statements. For more information,
see <link id="UpdateSQLs"/>.
</p>
</descr>
<seealso>
<link id="TSQLQuery.UpdateMode"/>
<link id="TCustomBufDataset.Unidirectional"/>
<link id="#fcl.db.TField.ProviderFlags">TField.ProviderFlags</link>
<link id="#fcl.db.TProviderFlag">pfInKey</link>
<link id="UpdateSQLs"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.ParseSQL">
<short>Should the SQL statement be parsed or not</short>
<descr>
<p>
<var>ParseSQL</var> can be set to <var>False</var> to prevent <var>TSQLQuery</var>
from parsing the <link id="TSQLQuery.SQL">SQL</link> property and attempting
to detect the statement type or updating the <link id="TSQLQuery.Params">Params</link>
or <link id="TSQLQuery.StatementType">StatementType</link> properties.
</p>
<p>
This can be used when SQLDB has problems parsing the SQL statement, or when
the SQL statement contains parameters that are part of a DDL statement such
as a <var>CREATE PROCEDURE</var> statement to create a stored procedure.
</p>
<p>
Note that in this case the statement will be passed as-is to the SQL engine,
no parameter values will be passed on.
</p>
</descr>
<seealso>
<link id="TSQLQuery.SQL"/>
<link id="TSQLQuery.Params"/>
</seealso>
</element>
<element name="TSQLQuery.StatementType">
<short>SQL statement type</short>
<descr>
<p>
<var>StatementType</var> is determined during the <link
id="TCustomSQLQuery.Prepare">Prepare</link> call when
<link id="TSQLQuery.ParseSQL">ParseSQL</link> is set to <var>True</var>.
It gives an indication of the type of SQL statement that is being executed.
</p>
</descr>
<seealso>
<link id="TSQLQuery.SQL"/>
<link id="TSQLQuery.ParseSQL"/>
<link id="TSQLQuery.Params"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.DataSource">
<short>Source for parameter values for unbound parameters</short>
<descr>
<p>
<var>Datasource</var> can be set to a dataset which will be used to retrieve
values for the parameters if they were not explicitly specified.
</p>
<p>
When <link id="#fcl.db.TDataset.open">Open</link> or
<link id="TCustomSQLQuery.ExecSQL">ExecSQL</link> is called,
and the <var>Datasource</var> property is not <var>Nil</var>
then for each parameter for which no value was explicitly set
(its <link id="#fcl.db.TParam.Bound">Bound</link>
property is <var>False</var>), the value
will be retrieved from the dataset connected to the datasource.
</p>
<p>
For each parameter, a field with the same name will be searched,
and its value and type will be copied to the (unbound) parameter.
The parameter remains unbound.
</p>
</descr>
<seealso>
<link id="TSQLQuery.Params">Params</link>
<link id="TCustomSQLQuery.ExecSQL">ExecSQL</link>
<link id="UsingParams"/>
<link id="#fcl.db.TParam.Bound">TParam.Bound</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.ServerFilter">
<short>Append server-side filter to SQL statement</short>
<descr>
<p>
<var>ServerFilter</var> can be set to a valid <var>WHERE</var> clause
(without the <var>WHERE</var> keyword). It
will be appended to the <var>select</var> statement in <link
id="TSQLQuery.SQL">SQL</link>, when <link id="TSQLQuery.ServerFiltered">ServerFiltered</link>
is set to <var>True</var>. if <link id="TSQLQuery.ServerFiltered">ServerFiltered</link>
is set to <var>False</var>, <var>ServerFilter</var> is ignored.
</p>
<p>
If the dataset is active and <link id="TSQLQuery.ServerFiltered">ServerFiltered</link> is set to
true, then changing this property will re-fetch the data from the server.
</p>
<p>
This property cannot be used when <link id="TSQLQuery.ParseSQL">ParseSQL</link> is <var>False</var>, because the
statement must be parsed in order to know where the <var>WHERE</var> clause must be
inserted: the <var>TSQLQuery</var> class will intelligently insert the
clause in an SQL select statement.
</p>
</descr>
<errors>
Setting this property when <link id="TSQLQuery.ParseSQL">ParseSQL</link> is <var>False</var>
will result in an exception.
</errors>
<seealso>
<link id="TSQLQuery.ServerFiltered">ServerFiltered</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.ServerFiltered">
<short>Should server-side filter be applied</short>
<descr>
<var>ServerFiltered</var> can be set to <var>True</var> to apply <link
id="TSQLQuery.ServerFilter">ServerFilter</link>.
A change in the value for this property will re-fetch the query results if the dataset is active.
</descr>
<errors>
Setting this property to <var>True</var> when <link id="TSQLQuery.ParseSQL">ParseSQL</link> is <var>False</var>
will result in an exception.
</errors>
<seealso>
<link id="TSQLQuery.ParseSQL">ParseSQL</link>
<link id="TSQLQuery.ServerFilter">ServerFilter</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.ServerIndexDefs">
<short>List of indexes on the primary table of the query</short>
<descr>
<var>ServerIndexDefs</var> will be filled - during the <var>Prepare</var> call
- with the list of indexes defined
on the primary table in the query if
<link id="TSQLQuery.UsePrimaryKeyAsKey">UsePrimaryKeyAsKey</link> is <var>True</var>.
If a primary key is found, then the fields in it will be marked
</descr>
<seealso>
<link id="TSQLQuery.UsePrimaryKeyAsKey">UsePrimaryKeyAsKey</link>
<link id="TCustomSQLQuery.Prepare">Prepare</link>
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TSQLScript.Create">
<short>Create a new <var>TSQLScript</var> instance.</short>
<descr>
<var>Create</var> instantiates a <link id="TSQLQuery"/> instance which
will be used to execute the queries, and then calls the inherited
constructor.
</descr>
<seealso>
<link id="TSQLScript.Destroy"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TSQLScript.Create.AOwner">
<short>Owner for the new instance.</short>
</element>
<!-- destructor Visibility: public -->
<element name="TSQLScript.Destroy">
<short>Remove the <var>TSQLScript</var> instance from memory.</short>
<descr>
<var>Destroy</var> frees the <link id="TSQLQuery"/> instance that was
created during the <var>Create</var> constructor from memory and then calls
the inherited destructor.
</descr>
<seealso>
<link id="TSQLScript.Create"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLScript.ExecuteScript">
<short>Convenience function, simply calls <var>Execute</var></short>
<descr>
<var>ExecuteScript</var> is a convenience function, it simply calls
<var>Execute</var>. The statements in the script will be executed one by
one.
</descr>
</element>
<!-- property Visibility: public -->
<element name="TSQLScript.Script">
<short>The script to execute</short>
<descr>
<p>
<var>Script</var> contains the list of SQL statements to be executed.
The statements should be separated by the character specified in the
<link id="TSQLScript.Terminator">Terminator</link> property. Each of the statement will
be executed on the database specified in <link id="TSQLScript.DataBase">Database</link>.
using the equivalent of the <link id="TCustomSQLQuery.ExecSQL"/> statement.
The statements should not return result sets, but other than that all kind
of statements are allowed.
</p>
<p>
Comments will be conserved and passed on in the statements to be executed,
depending on the value of the <link id="TSQLScript.CommentsinSQL"/> property.
If that property is <var>False</var>, comments will be stripped prior to executing the
SQL statements.
</p>
</descr>
<seealso>
<link id="TSQLScript.CommentsinSQL"/>
<link id="TSQLScript.Terminator"/>
<link id="TSQLScript.DataBase"/>
</seealso>
</element>
<!-- property Visibility: public -->
<element name="TSQLScript.DataBase">
<short>Database on which to execute the script</short>
<descr>
<var>Database</var> should be set to the <link id="TSQLConnection"/> descendent.
All SQL statements in the <link id="TSQLScript.Script">Script</link>
property will be executed on this database.
</descr>
<seealso>
<link id="TSQLConnection"/>
<link id="TSQLScript.Transaction"/>
<link id="TSQLScript.Script"/>
</seealso>
</element>
<!-- property Visibility: public -->
<element name="TSQLScript.Transaction">
<short>Transaction to use in the script</short>
<descr>
<var>Transaction</var> is the transaction instance to use when executing
statements. If the SQL script contains any <var>COMMIT</var>
statements, they will be handled using the <link
id="TSQLTRansaction.CommitRetaining"/> method.
</descr>
<seealso>
<link id="TSQLTransaction"/>
<link id="TSQLTransaction.CommitRetaining"/>
<link id="TSQLScript.Database"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TSQLConnector">
<short>Universal connection component</short>
<descr>
<p>
<var>TSQLConnector</var> implements a general connection type.
When switching database backends, the normal procedure is to replace one instance
of <link id="TSQLConnection"/> descendent with another, and connect all
instances of <link id="TSQLQuery"/> and <link id="TSQLTransaction"/> to the
new connection.
</p>
<p>
Using <var>TSQLConnector</var> avoids this: the type of connection can be set
using the <link id="TSQLConnector.ConnectorType">ConnectorType</link>
property, which is a string property. The <var>TSQLConnector</var> class
will (in the background) create the correct <link id="TSQLConnection"/>
descendent to handle all actual operations on the database.
</p>
<p>
In all other respects, <var>TSQLConnector</var> acts like a regular
<var>TSQLConnection</var> instance. Since no access to the actually used
<var>TSQLConnection</var> descendent is available, connection-specific calls
are not available.
</p>
</descr>
<seealso>
<link id="TSQLConnector.ConnectorType"/>
<link id="UniversalConnectors"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnector.ConnectorType">
<short>Name of the connection type to use</short>
<descr>
<var>ConnectorType</var> should be set to one of the availabe connector
types in the application. The list of possible connector types can be
retrieved using <link id="GetConnectionList"/> call. The
<var>ConnectorType</var> property can only be set when the connection is not
active.
</descr>
<errors>
Attempting to change the <var>ConnectorType</var> property while the
connection is active will result in an exception.
</errors>
<seealso>
<link id="GetConnectionList"/>
</seealso>
</element>
<!-- "class of" type Visibility: default -->
<element name="TSQLConnectionClass">
<short>Class of <var>TSQLConnection</var> type</short>
<descr>
<var>TSQLConnectionClass</var> is used when registering a new connection
type for use in the universal connector <link id="TSQLConnector.ConnectorType"/>
</descr>
<seealso>
<link id="TSQLConnector.ConnectorType"/>
<link id="TSQLConnector"/>
<link id="RegisterConnection"/>
<link id="TConnectionDef.ConnectionClass"/>
</seealso>
</element>
<!-- object Visibility: default -->
<element name="TConnectionDef">
<short>Connection type definition class</short>
<descr>
<var>TConnectionDef</var> is an abstract class. When registering a new
connection type for use in the universal connector, a descendent of this
class must be made and registered using <link id="RegisterConnection"/>.
A descendent class should override at least the <link id="TConnectionDef.TypeName"/>
and <link id="TConnectionDef.ConnectionClass"/> methods to return the
specific name and connection class to use.
</descr>
<seealso>
<link id="TConnectionDef.TypeName"/>
<link id="TConnectionDef.ConnectionClass"/>
<link id="RegisterConnection"/>
</seealso>
</element>
<!-- function Visibility: default -->
<element name="TConnectionDef.TypeName">
<short>Name of the connection type</short>
<descr>
<p>
<var>TypeName</var> is overridden by descendent classes to return the unique
name for this connection type. It is what the <link id="TSQLConnector.ConnectorType"/>
property should be set to select this connection type for the universal
connection, and is the name that the <link id="GetConnectionDef"/> call will
use when looking for a connection type. It must be overidden by descendents
of <var>TConnectionDef</var>.
</p>
<p>
This name is also returned in the list returned by <link
id="GetConnectionList"/>
</p>
<p>
This name can be an arbitrary name, no restrictions on the allowed characters exist.
</p>
</descr>
<seealso>
<link id="TSQLConnector.ConnectorType"/>
<link id="GetConnectionDef"/>
<link id="GetConnectionList"/>
<link id="TConnectionDef.ConnectionClass"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TConnectionDef.TypeName.Result">
<short>Unique name for the connection type</short>
</element>
<!-- function Visibility: default -->
<element name="TConnectionDef.ConnectionClass">
<short>Class to instantiate when this connection is requested</short>
<descr>
<p>
<var>ConnectionClass</var> should return the connection class to use when a
connection of this type is reqested. It must be overidden by descendents
of <var>TConnectionDef</var>.
</p>
<p>
It may not be <var>Nil</var>.
</p>
</descr>
<seealso>
<link id="TConnectionDef.TypeName"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TConnectionDef.ConnectionClass.Result">
<short>The <var>TSQLConnectionClass</var> for this connection type.</short>
</element>
<!-- function Visibility: default -->
<element name="TConnectionDef.Description">
<short>A descriptive text for this connection type</short>
<descr>
<var>Description</var> should return a descriptive text for this connection
type. It is used for display purposes only, so ideally it should be a
one-liner. It can be used to provide more
information about the particulars of the connection type.
</descr>
<seealso>
<link id="TConnectionDef.TypeName"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TConnectionDef.Description.Result">
<short>A description of the connection type.</short>
</element>
<!-- procedure Visibility: default -->
<element name="TConnectionDef.ApplyParams">
<short>Apply parameters to an instance of <var>TSQLConnection</var></short>
<descr>
<p>
<var>ApplyParams</var> must be overridden to apply any params specified in
the <var>Params</var> argument to the <link id="TSQLConnection"/> descendent
in <var>AConnection</var>. It can be used to convert <var>Name=Value</var>
pairs to properties of the actual connection instance.
</p>
<p>
When called, <var>AConnection</var> is guaranteed to be of the same type as
returned by <link id="TConnectionDef.ConnectionClass"/>.
<var>Params</var> contains the contents of the <link id="TSQLConnection.Params"/>
property of the connector.
</p>
</descr>
<seealso>
<link id="TSQLConnection.Params"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TConnectionDef.ApplyParams.Params">
<short>Parameters to apply in <var>Name=Value</var> form</short>
</element>
<!-- argument Visibility: default -->
<element name="TConnectionDef.ApplyParams.AConnection">
<short>Connection instance to which to apply the parameters</short>
</element>
<!-- "class of" type Visibility: default -->
<element name="TConnectionDefClass">
<short>Class of TConnectionDef</short>
<descr>
<var>TConnectionDefClass</var> is used in the <link
id="RegisterConnection"/> call to register a new <link id="TConnectionDef"/>
instance.
</descr>
<seealso>
<link id="RegisterConnection"/>
<link id="TConnectionDef"/>
<link id="UnregisterConnection"/>
</seealso>
</element>
<!-- procedure Visibility: default -->
<element name="RegisterConnection">
<short>Register a new connection type for use in the universal connector</short>
<descr>
<p>
<var>RegisterConnection</var> must be called with a class pointer to a <link
id="TConnectionDef"/> descendent to register the connection type described
in the <link id="TConnectionDef"/> descendent. The connection type is
registered with the name as returned by <link id="TConnectionDef.TypeName"/>.
</p>
<p>
The various connection types distributed by Free Pascal automatically call
<var>RegisterConnection</var> from the <var>initialization</var> section of their unit,
so simply including the unit with a particular connection type is enough to
register it.
</p>
<p>
Connection types registered with this call can be unregistered with
<link id="UnRegisterConnection"/>.
</p>
</descr>
<errors>
if <var>Def</var> is <var>Nil</var>, access violations will occur.
</errors>
<seealso>
<link id="TConnectionDef"/>
<link id="UnRegisterConnection"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="RegisterConnection.Def">
<short>The connection type definition to register.</short>
</element>
<!-- procedure Visibility: default -->
<element name="UnRegisterConnection">
<short>Unregister a registered connection type</short>
<descr>
<var>UnRegisterConnection</var> will unregister the connection <var>Def</var>.
If a connection with <var>ConnectionName</var> or with name as returned by
the <link id="TConnectionDef.TypeName">TypeName</link> method from <var>Def</var>
was previously registered, it will be removed from the list of registered connection types.
</descr>
<errors>
if <var>Def</var> is <var>Nil</var>, access violations will occur.
</errors>
<seealso>
<link id="TConnectionDef"/>
<link id="RegisterConnection"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="UnRegisterConnection.Def">
<short>The connection type definition to unregister.</short>
</element>
<!-- argument Visibility: default -->
<element name="UnRegisterConnection.ConnectionName">
<short>The name of the connection type definition to unregister.</short>
</element>
<!-- function Visibility: default -->
<element name="GetConnectionDef">
<short>Search for a connection definition by name</short>
<descr>
<p>
<var>GetConnectionDef</var> will search in the list of connection type
definitions, and will return the one definition with the name that
matches <var>ConnectorName</var>. The search is case insensitive.
</p>
<p>
If no definition is found, <var>Nil</var> is returned.
</p>
</descr>
<seealso>
<link id="RegisterConnection"/>
<link id="TConnectionDef"/>
<link id="TConnectionDef.TypeName"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="GetConnectionDef.Result">
<short>The connection type definition, <var>Nil</var> if not found.</short>
</element>
<!-- argument Visibility: default -->
<element name="GetConnectionDef.ConnectorName">
<short>The name of the connection type to search</short>
</element>
<!-- procedure Visibility: default -->
<element name="GetConnectionList">
<short>Return a list of connection definition names.</short>
<descr>
<var>GetConnectionList</var> clears <var>List</var> and fills it with the
list of currently known connection type names, as registered with <link
id="RegisterConnection"/>. The names are the names as returned by
<link id="TConnectionDef.TypeName"/>
</descr>
<seealso>
<link id="RegisterConnection"/>
<link id="TConnectionDef.TypeName"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="GetConnectionList.List">
<short>List to fill with connection names. Will be cleared</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnInfoType.citAll">
<short>All connection information</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnInfoType.citServerType">
<short>Server type description</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnInfoType.citServerVersion">
<short>Server version as an integer number</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnInfoType.citServerVersionString">
<short>Server version as a string</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnInfoType.citClientName">
<short>Client library name</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TConnInfoType.citClientVersion">
<short>Client library version</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TStatementType.stUnknown">
<short>Unknown (other) information</short>
</element>
<!-- enumeration type Visibility: default -->
<element name="TDBEventType">
<short>Type of database event</short>
<descr>
<var>TDBEventType</var> describes the type of a database event message as generated
by <link id="TSQLConnection"/> through the <link id="TSQLConnection.OnLog"/>
event.
</descr>
<seealso>
<link id="TSQLConnection"/>
<link id="TDBLogNotifyEvent"/>
<link id="TSQLConnection.OnLog"/>
</seealso>
</element>
<!-- enumeration value Visibility: default -->
<element name="TDBEventType.detCustom">
<short>Custom event message</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TDBEventType.detPrepare">
<short>SQL prepare message</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TDBEventType.detExecute">
<short>SQLExecute message</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TDBEventType.detFetch">
<short>Fetch data message</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TDBEventType.detCommit">
<short>Transaction Commit message</short>
</element>
<!-- enumeration value Visibility: default -->
<element name="TDBEventType.detRollBack">
<short>Transaction rollback message</short>
</element>
<!-- set type Visibility: default -->
<element name="TDBEventTypes">
<short>Set of database event types</short>
<descr>
<var>TDBEventTypes</var> is a set of <link id="TDBEventType"/> values, which
is used to filter the set of event messages that should be sent. The
<link id="TSQLConnection.LogEvents"/> property determines which events a
particular connection will send.
</descr>
<seealso>
<link id="TSQLConnection.LogEvents"/>
<link id="TDBLogNotifyEvent"/>
<link id="GlobalDBLogHook"/>
</seealso>
</element>
<!-- procedure type Visibility: default -->
<element name="TDBLogNotifyEvent">
<short>Event handler prototype for handling events</short>
<descr>
<var>TDBLogNotifyEvent</var> is the prototype for the
<link id="TSQLConnection.OnLog"/> event handler and for the global <link id="GlobalDBLogHook"/> event handling hook.
<var>Sender</var> will contain the <link id="TSQLConnection"/> instance that
caused the event, <var>EventType</var> will contain the event type, and
<var>Msg</var> will contain the actual message: the content depends on the
type of the message.
</descr>
<seealso>
<link id="TSQLConnection.OnLog"/>
<link id="GlobalDBLogHook"/>
</seealso>
</element>
<!-- argument Visibility: default -->
<element name="TDBLogNotifyEvent.Sender">
<short><var>TSQLConnection</var> instance that sent the event.</short>
</element>
<!-- argument Visibility: default -->
<element name="TDBLogNotifyEvent.EventType">
<short>Event type</short>
</element>
<!-- argument Visibility: default -->
<element name="TDBLogNotifyEvent.Msg">
<short>Event message. Actual content depends on the type of message.</short>
</element>
<!-- variable Visibility: public -->
<element name="TSQLCursor.FSelectable">
<short>Selectable query or not</short>
<descr>
<var>FSelectable</var> exists for internal use. It should not be used by
applications.
</descr>
</element>
<!-- variable Visibility: public -->
<element name="TSQLCursor.FSchemaType">
<short>Schema type requested</short>
<descr>
<var>FSchemaType</var> exists for internal use. It should not be used by
applications.
</descr>
</element>
<!-- array type Visibility: default -->
<element name="TQuoteChars">
<short>Type to describe quote characters.</short>
<descr>
<var>TQuoteChars</var> is an array of characters that describes the used delimiters
for string values.
</descr>
<seealso>
<link id="SingleQuotes"/>
<link id="DoubleQuotes"/>
</seealso>
</element>
<!-- constant Visibility: default -->
<element name="SingleQuotes">
<short>Single quote delimiters</short>
<descr>
<var>SingleQuotes</var> is the set of delimiters used when using single
quotes for string literals.
</descr>
<seealso>
<link id="DoubleQuotes"/>
<link id="TQuoteChars"/>
</seealso>
</element>
<!-- constant Visibility: default -->
<element name="DoubleQuotes">
<short>Double quote delimiters</short>
<descr>
<var>DoubleQuotes</var> is the set of delimiters used when using double
quotes for string literals.
</descr>
<seealso>
<link id="SingleQuotes"/>
<link id="TQuoteChars"/>
</seealso>
</element>
<!-- constant Visibility: default -->
<element name="LogAllEvents">
<short>Constant that can be used to select all events.</short>
<descr>
<var>LogAllEvents</var> is a constant that contains the full set of
available event types. It can be used to set <link id="TSQLConnection.LogEvents"/>.
</descr>
<seealso>
<link id="TSQLConnection.LogEvents"/>
<link id="TDBLogNotifyEvent"/>
<link id="GlobalDBLogHook"/>
</seealso>
</element>
<!-- property Visibility: public -->
<element name="TSQLConnection.FieldNameQuoteChars">
<short>Characters used to quote field names.</short>
<descr>
<var>FieldNameQuoteChars</var> can be set to specify the characters that
should be used to delimit field names in SQL statements generated by SQLDB.
It is normally initialized correctly by the
<link id="TSQLConnection"/> descendent to the default for that particular
connection type.
</descr>
<seealso>
<link id="TSQLConnection"/>
</seealso>
</element>
<!-- constructor Visibility: public -->
<element name="TSQLConnection.Create">
<short>Create a new instance of <var>TSQLConnection</var></short>
<descr>
<var>Create</var> initialized a new instance of <link id="TSQLconnection"/>.
After calling the inherited constructor, it will initialize the <link
id="TSQLConnection.FieldNameQuoteChars">FieldNameQuoteChars</link> property
and some other fields for internal use.
</descr>
<seealso>
<link id="TSQLConnection.FieldNameQuoteChars">FieldNameQuoteChars</link>
</seealso>
</element>
<!-- argument Visibility: public -->
<element name="TSQLConnection.Create.AOwner">
<short>Owner for the new <var>TSQLConnection</var>instance</short>
</element>
<!-- function Visibility: public -->
<element name="TSQLConnection.GetConnectionInfo">
<short>Return some information about the connection</short>
<descr>
<var>GetConnectionInfo</var> can be used to return some information about
the connection. Which information is returned depends on the <var>InfoType</var>
parameter. The information is returned as a string. If <var>citAll</var> is
passed, then the result will be a comma-separated list of values, each of
the values enclosed in double quotes.
</descr>
<seealso>
<link id="TConnInfoType"/>
</seealso>
</element>
<!-- function result Visibility: public -->
<element name="TSQLConnection.GetConnectionInfo.Result">
<short>Requested information as a string value.</short>
</element>
<!-- argument Visibility: public -->
<element name="TSQLConnection.GetConnectionInfo.InfoType">
<short>Connection information to be returned.</short>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.OnLog">
<short>Event handler for logging events</short>
<descr>
<p>
<var>TSQLConnection</var> can send events for all the actions that it
performs: executing SQL statements, committ and rollback of transactions
etc. This event handler must be set to react on these events: they can for
example be written to a log file. Only events specified in the <link
id="TSQLConnection.LogEvents">LogEvents</link> property will be logged.
</p>
<p>
The events received by this event handler are specific for this connection.
To receive events from all active connections in the application, set the
global <link id="GlobalDBLogHook"/> event handler.
</p>
</descr>
<seealso>
<link id="GlobalDBLogHook"/>
<link id="TSQLConnection.LogEvents"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLConnection.LogEvents">
<short>Filter for events to log</short>
<descr>
<var>LogEvents</var> can be used to filter the events which should be sent
to the <link id="TSQLConnection.OnLog">OnLog</link> and <link id="GlobalDBLogHook"/> event handlers.
Only event types that are listed in this property will be sent.
</descr>
<seealso>
<link id="GlobalDBLogHook"/>
<link id="TSQLConnection.OnLog"/>
</seealso>
</element>
<!-- argument Visibility: public -->
<element name="TCustomSQLQuery.SetSchemaInfo.ASchemaType">
<short>Schema type to use</short>
</element>
<!-- argument Visibility: public -->
<element name="TCustomSQLQuery.SetSchemaInfo.ASchemaObjectName">
<short>Name of Object for which to return schema information. </short>
</element>
<!-- argument Visibility: public -->
<element name="TCustomSQLQuery.SetSchemaInfo.ASchemaPattern">
<short>Pattern for schema information</short>
</element>
<!-- function Visibility: public -->
<element name="TCustomSQLQuery.ParamByName">
<short>Return parameter by name</short>
<descr>
<p>
<var>ParamByName</var> is a shortcut for <link
id="#fcl.db.TParams.ParamByName">Params.ParamByName</link>. The 2 following
pieces of code are completely equivalent:
</p>
<code>
Qry.ParamByName('id').AsInteger:=123;
</code>
<p>
and
</p>
<code>
Qry.Params.ParamByName('id').AsInteger:=123;
</code>
</descr>
<seealso>
<link id="#fcl.db.TParams.ParamByName">Params.ParamByName</link>
<link id="TSQLQuery.Params"/>
</seealso>
</element>
<!-- function result Visibility: public -->
<element name="TCustomSQLQuery.ParamByName.Result">
<short>Resulting <var>TParam</var> instance.</short>
</element>
<!-- argument Visibility: public -->
<element name="TCustomSQLQuery.ParamByName.AParamName">
<short>Name of parameter to look for. Case insensitive.</short>
</element>
<!-- property Visibility: public -->
<element name="TSQLQuery.SchemaType">
<short>Schema type</short>
<descr>
<var>SchemaType</var> is the schema type set by <link
id="TCustomSQLQuery.SetSchemaInfo"/>. It determines what kind of schema
information will be returned by the <var>TSQLQuery</var> instance.
</descr>
<seealso>
<link id="TCustomSQLQuery.SetSchemaInfo"/>
<link id="RetrievingSchemaInformation"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.MaxIndexesCount">
<short>Maximum allowed number of indexes.</short>
<descr>
<p>
<var>MaxIndexesCount</var> determines the number of index entries that the
dataset will reserve for indexes. No more indexes than indicated here can be
used. The property must be set before the dataset is opened. The minimum
value for this property is 1. The default value is 2.
</p>
<p>
If an index is added and the current index count equals
<var>MaxIndexesCount</var>, an exception will be raised.
</p>
</descr>
<errors>
Attempting to set this property while the dataset is active will raise an
exception.
</errors>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.FieldDefs" link="#fcl.db.tdataset.fielddefs">
<short>List of field definitions.</short>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLScript.Execute">
<short>Execute the script.</short>
<descr>
<p>
<var>Execute</var> will execute the statements specified in <link
id="TSQLScript.Script">Script</link> one by one, till the last statement is
processed or an exception is raised.
</p>
<p>
If an error occurs during execution, normally an exception is raised.
If the <link id="TSQLScript.OnException"/> event handler is set, it may
stop the event handler.
</p>
</descr>
<errors>
Handle errors using <link id="TSQLScript.OnException"/>.
</errors>
<seealso>
<link id="TSQLScript.Script">Script</link>
<link id="TSQLScript.OnException"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.OnDirective">
<short>Event handler if a directive is encountered</short>
<descr>
<var>OnDirective</var> is called when a directive is encountered. When
parsing the script, the script engine checks the first word of the statement.
If it matches one of the words in <link id="TSQLScript.Directives">Directives</link> property then
the <var>OnDirective</var> event handler is
called with the name of the directive and the rest of the statement as
parameters. This can be used to handle all kind of pre-processing actions
such as <var>Set term \^ ;</var>
</descr>
<seealso>
<link id="TSQLScript.Directives">Directives</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.Directives">
<short>List of directives</short>
<descr>
<var>Directives</var> is a stringlist with words that should be recognized as directives.
They will be handled using the <link id="TSQLScript.OnDirective">OnDirective</link>
event handler. The list should contain one word per line, no spaces allowed.
</descr>
<seealso>
<link id="TSQLScript.OnDirective">OnDirective</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.Defines">
<short>Defined macros</short>
<descr>
<var>Defines</var> contains the list of defined macros for use with the
<link id="TSQLScript.UseDefines"/> property. Each line should contain a
macro name. The names of the macros are case insensitive. The
<var>#DEFINE</var> and <var>#UNDEFINE</var> directives will add or remove
macro names from this list.
</descr>
<seealso>
<link id="TSQLScript.UseDefines"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.Terminator">
<short>Terminator character.</short>
<descr>
<var>Terminator</var> is the character used by <var>TSQLScript</var> to
delimit SQL statements. By default it equals the semicolon (;), which is the
customary SQL command terminating character.
By itself <var>TSQLScript</var> does not recognize complex
statements such as <var>Create Procedure</var> which can contain terminator
characters such as ";". Instead, <var>TSQLScript</var> will scan the script
for the <var>Terminator</var> character. Using directives such as <var>SET TERM</var>
the terminator character may be changed in the script.
</descr>
<seealso>
<link id="TSQLScript.OnDirective">OnDirective</link>
<link id="TSQLScript.Directives">Directives</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.CommentsinSQL">
<short>Should comments be passed to the SQL engine ?</short>
<descr>
<p>
<var>CommentsInSQL</var> can be set to <var>True</var> to let
<var>TSQLScript</var> preserve any comments it finds in the script.
The comments will be passed to the SQLConnection as part of the commands.
If the property is set to <var>False</var> the comments are discarded.
</p>
<p>
By default, <var>TSQLScript</var> discards comments.
</p>
</descr>
<seealso>
<link id="TSQLScript.Script"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.UseSetTerm">
<short>Should the SET TERM directive be recognized</short>
<descr>
<p>
<var>UseSetTerm</var> can be set to <var>True</var> to let
<var>TSQLScript</var> automatically handle the <var>SET TERM</var> directive
and set the <link id="TSQLSCript.Terminator"/> character based on the value
specified in the <var>SET TERM</var> directive. This means that the
following directive:
</p>
<code>
SET TERM ^ ;
</code>
<p>
will set the terminator to the caret character. Conversely, the
</p>
<code>
SET TERM ; ^
</code>
<p>
will then switch the terminator character back to the commonly used
semicolon (;).
</p>
</descr>
<seealso>
<link id="TSQLSCript.Terminator"/>
<link id="TSQLSCript.Script"/>
<link id="TSQLSCript.Directives"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.UseCommit">
<short>Control automatic handling of the <var>COMMIT</var> command.</short>
<descr>
<p>
<var>UseCommit</var> can be set to <var>True</var> to let <var>TSQLScript</var>
automatically handle the commit command as a directive. If it is set,
the <var>COMMIT</var> command is registered as a directive, and
the <link id="TSQLScript.Transaction"/> will be commited and restarted
at once whenever the <var>COMMIT</var> directive appears in the script.
</p>
<p>
If this property is set to <var>False</var> then the commit command will be
passed on to the SQL engine like any other SQL command in the script.
</p>
</descr>
<seealso>
<link id="TSQLScript.Transaction"/>
<link id="TSQLScript.Directives"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.UseDefines">
<short>Automatically handle pre-processor defines</short>
<descr>
<p>
<var>UseDefines</var> will automatically register the following
pre-processing directives:
</p>
<code>
#IFDEF
#IFNDEF
#ELSE
#ENDIF
#DEFINE
#UNDEF
#UNDEFINE
</code>
<p>
Additionally, these directives will be automatically handled by the
<var>TSQLScript</var> component. This can be used to add conditional execution
of the SQL script: they are treated as the conditional compilation
statements found in the C macro preprocessor or the FPC conditional
compilation features. The initial list of defined macros can be specified in
the <link id="TSQLScript.Defines">Defines</link> property, where one define
per line can be specified.
</p>
<p>
In the following example, the correct statement to create a sequence is
selected based on the presence of the macro <var>FIREBIRD</var> in the list
of defines:
</p>
<code>
#IFDEF FIREBIRD
CREATE GENERATOR GEN_MYID;
#ELSE
CREATE SEQUENCE GEN_MYID;
#ENDIF
</code>
</descr>
<seealso>
<link id="TSQLScript.Script"/>
<link id="TSQLScript.Defines"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLScript.OnException">
<short>Exception handling event</short>
<descr>
<var>OnException</var> can be set to handle an exception during the
execution of a statement or directive when the script is executed.
The exception is passed to the handler in the <var>TheException</var>
parameter. On return, the value of the <var>Continue</var> parameter is
checked: if it is set to <var>True</var>, then the exception is ignored. If
it is set to <var>False</var> (the default), then the exception is
re-raised, and script execution will stop.
</descr>
<seealso>
<link id="TSQLScript.Execute"/>
</seealso>
</element>
<!-- function type Visibility: default -->
<element name="TLibraryLoadFunction">
<short>Library loading function prototype</short>
<descr>
<var>TLibraryLoadFunction</var> is the function prototype for dynamically
loading a library when the universal connection component is used. It
receives the name of the library to load (<var>S</var>), and should return
<var>True</var> if the library was succesfully loaded. It is used in the
connection definition.
</descr>
<seealso>
<link id="TConnectionDef"/>
<link id="TConnectionDef.DefaultLibraryName"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TLibraryLoadFunction.Result">
<short><var>True</var> if the library was succesfully loaded</short>
</element>
<!-- argument Visibility: default -->
<element name="TLibraryLoadFunction.S">
<short>Name of the library to load.</short>
</element>
<!-- procedure type Visibility: default -->
<element name="TLibraryUnLoadFunction">
<short>Library unloading function prototype</short>
<descr>
<var>TLibraryUnLoadFunction</var> is the function prototype for dynamically
unloading a library when the universal connection component is used. It has
no parameters, and should simply unload the library loaded with <link
id="TLibraryLoadFunction"/>
</descr>
<seealso>
<link id="TLibraryLoadFunction"/>
<link id="TConnectionDef"/>
<link id="TConnectionDef.DefaultLibraryName"/>
</seealso>
</element>
<!-- class function Visibility: default -->
<element name="TConnectionDef.DefaultLibraryName">
<short>Default library name</short>
<descr>
<var>DefaultLibraryName</var> should be set to the default library name for
the connection. This can be used to let SQLDB automatically load the library
needed when a connection of this type is requested.
</descr>
<seealso>
<link id="TLibraryLoadFunction"/>
<link id="TConnectionDef"/>
<link id="TLibraryUnLoadFunction"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TConnectionDef.DefaultLibraryName.Result">
<short>Name of the library to load</short>
</element>
<!-- class function Visibility: default -->
<element name="TConnectionDef.LoadFunction">
<short>Return a function to call when the client library must be loaded</short>
<descr>
<var>LoadFunction</var> must return the function that will be called when the client
library for this connection type must be loaded. This method must be
overridden by descendent classes to return a function that will correctly
load the client library when a connection of this type is used.
</descr>
<seealso>
<link id="TLibraryLoadFunction"/>
<link id="TConnectionDef.UnLoadFunction"/>
<link id="TConnectionDef.DefaultLibraryName"/>
<link id="TConnectionDef.LoadedLibraryName"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TConnectionDef.LoadFunction.Result">
<short>The function to call when the client library must be loaded </short>
</element>
<!-- class function Visibility: default -->
<element name="TConnectionDef.UnLoadFunction">
<short>Return a function to call when the client library must be unloaded</short>
<descr>
<var>UnLoadFunction</var> must return the function that will be called when
the client library for this connection type must be unloaded. This method must be
overridden by descendent classes to return a function that will correctly
unload the client library when a connection of this type is no longer used.
</descr>
<seealso>
<link id="TLibraryUnLoadFunction"/>
<link id="TConnectionDef.LoadFunction"/>
<link id="TConnectionDef.DefaultLibraryName"/>
<link id="TConnectionDef.LoadedLibraryName"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TConnectionDef.UnLoadFunction.Result">
<short>The function to call when the client library must be unloaded</short>
</element>
<!-- class function Visibility: default -->
<element name="TConnectionDef.LoadedLibraryName">
<short>Currently loaded library.</short>
<descr>
<var>LoadedLibraryName</var> must be overridden by descendents to return the
filename of the currenly loaded client library for this connection type.
If no library is loaded, an empty string must be returned.
</descr>
<seealso>
<link id="TLibraryLoadFunction"/>
<link id="TLibraryUnLoadFunction"/>
<link id="TConnectionDef.LoadFunction"/>
<link id="TConnectionDef.UnLoadFunction"/>
<link id="TConnectionDef.DefaultLibraryName"/>
</seealso>
</element>
<!-- function result Visibility: default -->
<element name="TConnectionDef.LoadedLibraryName.Result">
<short>Name of the currently loaded library</short>
</element>
<!-- variable Visibility: default -->
<element name="GlobalDBLogHook">
<short>Global logging hook</short>
<descr>
<var>GlobalDBLogHook</var> can be set in addition to local <link
id="TSQLConnection.Onlog"/> event handlers. All connections will report
events through this global event handler in addition to their
<var>OnLog</var> event handlers. The global log event handler can be set
only once, so when setting the handler, it is important to set up chaining:
saving the previous value, and calling the old handler (if it was set) in
the new handler.
</descr>
<seealso>
<link id="TSQLConnection.Onlog"/>
</seealso>
</element>
<!-- constant Visibility: default -->
<element name="DefaultSQLFormatSettings">
<short>Default settings to be used in SQL </short>
<descr>
<var>DefaultSQLFormatSettings</var> contains the default settings used when
formatting date/time and other special values in Update SQL statements generated by
the various <link id="TSQLConnection"/> descendents.
</descr>
<seealso>
</seealso>
</element>
<!-- enumeration value Visibility: default -->
<element name="TSchemaType.stSchemata">
<short>List of schemas in database(s)</short>
</element>
<!-- record type Visibility: default -->
<element name="TSQLStatementInfo">
<short>Record to describe a SQL statement</short>
<descr>
<p>
<var>TSQLStatementInfo</var> is a record used to describe an SQL statement.
It is used internally by the <link id="TSQLStatement"/> and <link
id="TSQLQuery"/> objects to analyse SQL statements.
</p>
<p>
It is used to be able to modify the SQL statement (for additional filtering)
or to determine the table to update when applying dataset updates to the
database.
</p>
</descr>
<seealso>
<link id="TSQLStatement"/>
<link id="TSQLQuery"/>
</seealso>
</element>
<!-- variable Visibility: default -->
<element name="TSQLStatementInfo.StatementType">
<short>Type of SQL statement</short>
</element>
<!-- variable Visibility: default -->
<element name="TSQLStatementInfo.TableName">
<short>Tablename to be used in updates</short>
</element>
<!-- variable Visibility: default -->
<element name="TSQLStatementInfo.Updateable">
<short>Updateable SQL result set ?</short>
</element>
<!-- variable Visibility: default -->
<element name="TSQLStatementInfo.WhereStartPos">
<short>Where clause start position</short>
</element>
<!-- variable Visibility: default -->
<element name="TSQLStatementInfo.WhereStopPos">
<short>Where clause end position</short>
</element>
<!--
********************************************************************
#fcl.sqldb.TCustomSQLStatement
********************************************************************
-->
<!-- class Visibility: default -->
<element name="TCustomSQLStatement">
<short>Object to execute SQL statements without result set.</short>
<descr>
<p>
<var>TCustomSQLStatement</var> is a light-weight object that can be used to
execute SQL statements on a database. It does not support result sets, and
has none of the methods that a <link id="TDataset"/> component has. It can
be used to execute SQL statements on a database that update data, execute
stored procedures and DDL statements etc.
</p>
<p>
The <var>TCustomSQLStatement</var> is equivalent to <link id="TSQLQuery"/>
in that it supports transactions (in the <link
id="TSQLConnection.Transaction">Transaction</link> property)
and parameters (in the <link id="TSQLConnection.Params">Params</link> property) and as such is a more
versatile tool than executing queries using <link id="TSQLConnection.ExecuteDirect"/>.
</p>
<p>
To use a <var>TCustomSQLStatement</var> is simple and similar to the use of
<link id="TSQLQuery"/>: set the <link
id="TSQLStatement.Database">Database</link> property to an existing connection component, and set the
<link id="TSQLStatement.Transaction">Transaction</link> property. After setting the <link
id="TSQLStatement.SQL">SQL</link>
property and filling <link id="TSQLStatement.Params">Params</link>, the SQL statement can be executed
with the <link id="Execute"/> method.
</p>
<p>
<var>TCustomSQLStatement</var> is a parent class. Many of the properties are
only made public (or published) in the <link id="TSQLStatement"/> class, which
should be instantiated instead of the <var>TCustomSQLStatement</var> class.
</p>
</descr>
<seealso>
<link id="TSQLStatement"/>
<link id="TDataset"/>
<link id="TSQLQuery"/>
<link id="TSQLStatement.Transaction"/>
<link id="TSQLStatement.Params"/>
<link id="Execute"/>
<link id="TSQLStatement.Database"/>
<link id="TSQLConnection.ExecuteDirect"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TSQLConnection.GetSchemaNames">
<short>Get database schema names</short>
<descr>
<var>GetSchemaNames</var> returns a list of schemas defined in the database.
</descr>
<seealso>
<link id="TSQLConnection.GetTableNames"/>
<link id="TSQLConnection.GetProcedureNames"/>
<link id="TSQLConnection.GetFieldNames"/>
</seealso>
</element>
<!-- argument Visibility: public -->
<element name="TSQLConnection.GetSchemaNames.List">
<short>On return, filled with schema names, one per line</short>
</element>
<!-- constructor Visibility: public -->
<element name="TCustomSQLStatement.Create">
<short>Create a new instance of <var>TCustomSQLStatement</var></short>
<descr>
<var>Create</var> initializes a new instance of
<var>TCustomSQLStatement</var> and sets the <link
id="TSQLStatement.SQL">SQL</link>
<link id="TSQLStatement.Params">Params</link>, <link
id="TSQLStatement.ParamCheck">ParamCheck</link> and
<link id="TSQLStatement.ParseSQL">ParseSQL</link> to
their initial values.
</descr>
<seealso>
<link id="TSQLStatement.SQL"/>
<link id="TSQLStatement.Params"/>
<link id="TSQLStatement.ParamCheck"/>
<link id="TSQLStatement.ParseSQL"/>
<link id="Destroy"/>
</seealso>
</element>
<!-- argument Visibility: public -->
<element name="TCustomSQLStatement.Create.AOwner">
<short>Owner of the new <var>TCustomSQLStatement</var> instance.</short>
</element>
<!-- destructor Visibility: public -->
<element name="TCustomSQLStatement.Destroy">
<short>Destroy a <var>TCustomSQLStatement</var> instance.</short>
<descr>
<var>Destroy</var> disconnects the <var>TCustomSQLStatement</var> instance
from the transaction and database, and then frees the memory taken by the
instance and its properties.
</descr>
<seealso>
<link id="TSQLStatement.Database"/>
<link id="TSQLStatement.Transaction"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TCustomSQLStatement.Prepare">
<short>Prepare the statement for execution</short>
<descr>
<var>Prepare</var> prepares the SQL statement for execution. It is called
automatically if <link id="Execute"/> is called and the statement was not yet
prepared. Depending on the database engine, it will also allocate the necessary
resources on the database server.
</descr>
<errors>
An exception is raised if there is no <link id="TSQLStatement.SQL">SQL</link> statement set or the
<link id="TSQLStatement.Database">Database</link> or <link id="TSQLStatement.Transaction">Transaction</link> properties are empty.
</errors>
<seealso>
<link id="TSQLStatement.SQL"/>
<link id="TSQLStatement.Database"/>
<link id="TSQLStatement.Transaction"/>
<link id="Execute"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TCustomSQLStatement.Execute">
<short>Execute the SQL statement.</short>
<descr>
<var>Execute</var> executes the <link id="SQL"/> statement on the database.
If necessary, it will first open the connection and start a transaction,
followed by a call to <var>Prepare</var>.
</descr>
<errors>
<p>
An exception is raised if there is no <link id="TSQLStatement.SQL">SQL</link> statement set or the
<link id="TSQLStatement.Database">Database</link> or <link id="TSQLStatement.Transaction">Transaction</link> properties are empty.
</p>
<p>
If an error occurs at the database level (the SQL failed to execute
properly) then an exception is raised as well.
</p>
</errors>
<seealso>
<link id="TSQLStatement.SQL"/>
<link id="TSQLStatement.Database"/>
<link id="TSQLStatement.Transaction"/>
</seealso>
</element>
<!-- procedure Visibility: public -->
<element name="TCustomSQLStatement.Unprepare">
<short>Unprepare a previously prepared statement</short>
<descr>
<var>Unprepare</var> unprepares a prepared SQL statement. It is called
automatically when the SQL statement is changed. Depending on the database
engine, it will also de-allocate any allocated resources on the database server.
if the statement is not in a prepared state, nothing happens.
</descr>
<errors>
If an error occurs at the database level (the unprepare operation failed to execute
properly) then an exception is raised.
</errors>
<seealso>
<link id="TSQLStatement.SQL"/>
<link id="TSQLStatement.Database"/>
<link id="TSQLStatement.Transaction"/>
<link id="Prepare"/>
</seealso>
</element>
<!-- function Visibility: public -->
<element name="TCustomSQLStatement.ParamByName">
<short>Find a parameter by name</short>
<descr>
<var>ParamByName</var> finds the parameter <var>AParamName</var> in the
<link id="TSQLStatement.Params">Params</link> property.
</descr>
<errors>
If no parameter with the given name is found, an exception is raised.
</errors>
<seealso>
<link id="TSQLStatement.Params"/>
<link id="TParams.ParamByname"/>
</seealso>
</element>
<!-- function result Visibility: public -->
<element name="TCustomSQLStatement.ParamByName.Result">
<short>The parameter with name <var>AParamName</var></short>
</element>
<!-- argument Visibility: public -->
<element name="TCustomSQLStatement.ParamByName.AParamName">
<short>Parameter to search for.</short>
</element>
<!-- function Visibility: public -->
<element name="TCustomSQLStatement.RowsAffected">
<short>Number of rows affected by the SQL statement.</short>
<descr>
<var>RowsAffected</var> is set to the number of affected rows after <link id="Execute"/> was called.
Not all databases may support this.
</descr>
<seealso>
<link id="Execute"/>
</seealso>
</element>
<!-- function result Visibility: public -->
<element name="TCustomSQLStatement.RowsAffected.Result">
<short>The number of affected rows by the last executed SQL command.</short>
</element>
<!-- property Visibility: public -->
<element name="TCustomSQLStatement.Prepared">
<short>Is the statement prepared or not</short>
<descr>
<var>Prepared</var> equals <var>True</var> if <link id="Prepare"/> was
called (implicitly or explictly), it returns <var>False</var> if not.
It can be set to <var>True</var> or <var>False</var> to call <link
id="Prepare"/> or <link id="UnPrepare"/>, respectively.
</descr>
<seealso>
<link id="Prepare"/>
<link id="UnPrepare"/>
</seealso>
</element>
<!--
********************************************************************
#fcl.sqldb.TSQLStatement
********************************************************************
-->
<!-- class Visibility: default -->
<element name="TSQLStatement">
<short>Class to execute non-select SQL statements.</short>
<descr>
<var>TSQLStatement</var> is a descendent of <link id="TCustomSQLStatement"/>
which simply publishes the protected properties of that component.
</descr>
<seealso>
<link id="TCustomSQLStatement"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLStatement.Database">
<short>Database instance to execute statement on.</short>
<descr>
<var>Database</var> must be set to an instance of a <link id="TSQLConnection"/>
descendent. It must be set, together with <link id="Transaction"/> in order to be able to call <link
id="TCustomSQLStatement.Prepare">Prepare</link> or <link
id="TCustomSQLStatement.Execute">Execute</link>.
</descr>
<seealso>
<link id="Transaction"/>
<link id="TCustomSQLStatement.Prepare">Prepare</link>
<link id="TCustomSQLStatement.Execute">Execute</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLStatement.DataSource">
<short>Datasource to copy parameter values from</short>
<descr>
<var>Datasource</var> can be set to a <link id="#fcl.db.TDatasource"/> instance.
When <link id="TCustomSQLStatement.Execute">Execute</link> is called, any
unbound parameters remain empty, but if <var>DataSource</var> is set, the
value of these parameters will be searched in the fields of the associated
dataset. If a field with a name equal to the parameter is found, the value
of that field is copied to the parameter. No such field exists, an exception
is raised.
</descr>
<seealso>
<link id="#fcl.db.TDatasource"/>
<link id="TCustomSQLStatement.Execute">Execute</link>
<link id="#fcl.db.TParam.Bound"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLStatement.ParamCheck">
<short>Should SQL be checked for parameters</short>
<descr>
<p>
<var>ParamCheck</var> must be set to <var>False</var> to disable the
parameter check. The default value <var>True</var> indicates that the SQL
statement should be checked for parameter names (in the form
<var>:ParamName</var>), and corresponding <link
id="#fcl.db.TParam">TParam</link> instances should be added to the <link
id="Params">Params</link> property.
</p>
<p>
When executing some DDL statements, e.g. a "create procedure" SQL
statement can contain parameters. These parameters should not be converted
to <var>TParam</var> instances.
</p>
</descr>
<seealso>
<link id="#fcl.db.TParam">TParam</link>
<link id="Params"/>
<link id="TSQLQuery.ParamCheck"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLStatement.Params">
<short>List of parameters.</short>
<descr>
<var>Params</var> contains an item for each of the parameters in the <link id="SQL"/>
statement (in the form <var>:ParamName</var>). The collection is filled
automatically if the <link id="ParamCheck"/> property is <var>True</var>.
</descr>
<seealso>
<link id="SQL"/>
<link id="ParamCheck"/>
<link id="ParseSQL"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLStatement.ParseSQL">
<short>Parse the SQL statement</short>
<descr>
<var>ParseSQL</var> can be set to <var>False</var> to disable parsing of the
<link id="SQL"/> property when it is set. The default behaviour
(<var>ParseSQL=True</var>) is to parse the statement
and detect what kind of SQL statement it is.
</descr>
<seealso>
<link id="SQL"/>
<link id="ParamCheck"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLStatement.SQL">
<short>The SQL statement to execute</short>
<descr>
<p>
<var>SQL</var> must be set to the SQL statement to execute. It must not be a
statement that returns a result set. This is the statement that will be
passed on to the database engine when <link id="TCustomSQLStatement.Prepare">Prepare</link> is called.
</p>
<p>
If <link id="ParamCheck"/> equals <var>True</var> (the default), the SQL statement can contain
parameter names where literal values can occur, in the form <var>:ParamName</var>.
Keywords or table names cannot be specified as parameters.
If the underlying database engine supports it, the parameter support of
the database will be used to transfer the values from the <link id="Params"/> collection. If not, it will be emulated.
The <var>Params</var> collection is automatically populated when the SQL statement is set.
</p>
<p>
Some databases support executing multiple SQL statements in 1 call.
Therefor, no attempt is done to ensure that <var>SQL</var> contains a single
SQL statement. However, error reporting and the <link
id="TCustomSQLStatement.RowsAffected">RowsAffected</link> function may be
wrong in such a case.
</p>
</descr>
<seealso>
<link id="ParseSQL"/>
<link id="CheckParams"/>
<link id="Params"/>
<link id="TCustomSQLStatement.Prepare">Prepare</link>
<link id="TCustomSQLStatement.RowsAffected">RowsAffected</link>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLStatement.Transaction">
<short>The transaction in which the SQL statement should be executed.</short>
<descr>
<var>Transaction</var> should be set to a transaction connected to the
instance of the database set in the <link id="Database"/> property. This
must be set before <link id="TCustomSQLStatement.Prepare">Prepare</link> is
called.
</descr>
<seealso>
<link id="Database"/>
<link id="TCustomSQLStatement.Prepare">Prepare</link>
<link id="TSQLTransaction"/>
</seealso>
</element>
<!-- property Visibility: published -->
<element name="TSQLQuery.ParamCheck">
<short>Should the SQL statement be checked for parameters</short>
<descr>
<p>
<var>ParamCheck</var> must be set to <var>False</var> to disable the
parameter check. The default value <var>True</var> indicates that the SQL
statement should be checked for parameter names (in the form
<var>:ParamName</var>), and corresponding <link
id="#fcl.db.TParam">TParam</link> instances should be added to the <link
id="Params">Params</link> property.
</p>
<p>
When executing some DDL statements, e.g. a "create procedure" SQL
statement can contain parameters. These parameters should not be converted
to <var>TParam</var> instances.
</p>
</descr>
<seealso>
<link id="#fcl.db.TParam">TParam</link>
<link id="Params"/>
<link id="TSQLStatement.ParamCheck"/>
</seealso>
</element>
</module>
<!-- sqldb -->
</package>
</fpdoc-descriptions>
|