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
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.11 $ -->
<reference id="ref.fbsql">
<title>FrontBase関数</title>
<titleabbrev>FrontBase</titleabbrev>
<partintro>
<simpara>
このモジュールの関数により FrontBaseデータベースサーバにアクセスす
ることが可能になります。これらの関数を使用するには、オプション
<option role="configure">--with-fbsql</option> を付けてPHPをコンパ
イルする必要があります。このオプションをfbsqlへのパスを指定せずに
使用した場合、PHPはfbsqlクライアントライブラリをそのプラットフォー
ムのデフォルトのインストール位置で探します。FrontBaseを標準以外の
場所にインストールしているユーザは、必ず次のようにfbsqlへのパスを
指定する必要があります。
<option role="configure">--with-fbsql=/path/to/fbsql</option>
これにより、PHPは、間違いなくFrontBaseによりインストールされたクラ
イアントライブラリを探すことができるようになります。
</simpara>
<simpara>
FrontBase に関する詳細については、<ulink
url="&url.fbsql;">&url.fbsql;</ulink> で入手可能です。
</simpara>
<simpara>
FrontBase に関するドキュメントは、<ulink
url="&url.fbsql.docs;">&url.fbsql.docs;</ulink> から入手可能です。
</simpara>
<simpara>
Frontbase のサポートは、PHP 4.0.6 で追加されました。
</simpara>
</partintro>
<refentry id="function.fbsql-affected-rows">
<refnamediv>
<refname>fbsql_affected_rows</refname>
<refpurpose>
直近のFrontBase処理により作用を受けたレコードの数を得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>fbsql_affected_rows</methodname>
<methodparam choice="opt"><type>int</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_affected_rows</function> は、
<parameter>link_identifier</parameter>が指す接続において
直近のINSERT, UPDATE, DELETEクエリで作用されたレコードの数を返し
ます。リンクIDが指定されない場合、
<function>fbsql_connect</function>により直近にオープンされた接続
が使用されます。
</para>
<note>
<para>
トランザクションを使用している場合、コミットの後ではなくINSERT,
UPDATE, DELETEクエリの後で
<function>fbsql_affected_rows</function>をコールする必要がありま
す。
</para>
</note>
<para>
直近のクエリがWHERE句のあるDELETEクエリの場合、全てのレコードは、
テーブルから削除されますが、この関数はゼロを返します。
</para>
<note>
<para>
UPDATEを使用する場合、FrontBaseは、新しい値が古い値と同じ場合に
はカラムを更新しません。このため、
<function>fbsql_affected_rows</function>は、実際にはマッチした行
の数と一致しない可能性があり、クエリにより実際に変更された行の数
だけとなります。
</para>
</note>
<para>
直近のクエリが失敗した場合、この関数は-1を返します。
</para>
<para>
<function>fbsql_num_rows</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-autocommit">
<refnamediv>
<refname>fbsql_autocommit</refname>
<refpurpose>autocommitを有効または無効にする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_autocommit</methodname>
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>
OnOff
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_autocommit</function>は、カレントのautocommitステー
タスを返します。オプションのOnOffパラメータが指定された場合、オー
トコミットステータスは変更されます。
OnOffを&true;に設定すると、エラーがない場合には、各命令は自動的に
コミットされます。
OnOffが &false; に設定された場合、ユーザは、
<function>fbsql_commit</function>または
<function>fbsql_rollback</function>のどちらかによりユーザはコミッ
トまたはロールバックを行う必要があります。
</para>
<para>
<function>fbsql_commit</function>および
<function>fbsql_rollback</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-change-user">
<refnamediv>
<refname>fbsql_change_user</refname>
<refpurpose>
アクティブな接続にログインしているユーザを変更する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_change_user</methodname>
<methodparam><type>string</type><parameter>user</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>
database
</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_change_user</function>は、カレントのアクティブ接
続またはオプションのパラメータ
<parameter>link_identifier</parameter>で指定した接続のログインユー
ザを変更します。<parameter>database</parameter>が指定された場合、
ユーザ変更後のデフォルトまたはカレントのデータベースとなります。
新規ユーザ及びパスワード認証が失敗した場合、カレントの接続ユーザ
はアクティブなままとなります。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-close">
<refnamediv>
<refname>fbsql_close</refname>
<refpurpose>FrontBase接続を閉じる</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>boolean</type><methodname>fbsql_close</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
成功時に&true;、エラー時に&false;を返します。
</para>
<para>
<function>fbsql_close</function>は、指定したリンクIDに関連する
FrontBaseサーバへの接続を閉じます。
<parameter>link_identifier</parameter>が指定されない場合、直近に
オープンされたリンクが使用されます。
</para>
<para>
持続的でないオープンされたリンクは、スクリプト実行終了時に自動的
にクローズされるため、<function>fbsql_close</function>は実際には
不用です。
</para>
<example>
<title><function>fbsql_close</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_connect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
print ("Connected successfully");
fbsql_close ($link);
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_connect</function>,
<function>fbsql_pconnect</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-commit">
<refnamediv>
<refname>fbsql_commit</refname>
<refpurpose>データベースへのトランザクションをコミットする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_commit</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
成功時に&true;、失敗時に&false;を返します。
</para>
<para>
<function>fbsql_commit</function>は、ディスクへのinsert、update、
deleteを全て書き込み、トランザクションによりホールドされた全ての
行及びテーブルのロックをアンロックします。このコマンドは、
autocommitがfalseに設定されている場合のみ必要です。
</para>
<para>
<function>fbsql_autocommit</function>及び
<function>fbsql_rollback</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-connect">
<refnamediv>
<refname>fbsql_connect</refname>
<refpurpose>FrontBaseサーバへの接続をオープンする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_connect</methodname>
<methodparam choice="opt"><type>string</type><parameter>
hostname
</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>
username
</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>
password
</parameter></methodparam>
</methodsynopsis>
<para>
成功時に正のFrontBaseリンクIDは、失敗時にエラーメッセージを返しま
す。
</para>
<para>
<function>fbsql_connect</function>は、FrontBaseサーバへの接続を確
立します。オプションのパラメータを省略した場合には以下のデフォル
ト値が仮定されます。: <parameter>hostname</parameter> = '&null;',
<parameter>username</parameter> = '_SYSTEM',
<parameter>password</parameter> = 空のパスワード
</para>
<para>
同じ引数で<function>fbsql_connect</function>への2番目のコールが行
われた場合、新規のリンクは確立されず、替わりに既にオープンされて
いるリンクIDが返されます。
</para>
<para>
<function>fbsql_close</function>をコールすることにより事前に明示
的にクローズされていない限り、サーバへのリンクはスクリプト実行終
了時にクローズされます。
</para>
<example>
<title><function>fbsql_connect</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_connect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
print ("Connected successfully");
fbsql_close ($link);
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_pconnect</function>および
<function>fbsql_close</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-create-db">
<refnamediv>
<refname>fbsql_create_db</refname>
<refpurpose>FrontBaseデータベースを作成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_create_db</methodname>
<methodparam><type>string</type><parameter>database name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_create_db</function>は、指定したリンクIDが指すサー
バ上に新規にデータベースを作成します。
</para>
<example>
<title><function>fbsql_create_db</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_pconnect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
if (fbsql_create_db ("my_db")) {
print("Database created successfully\n");
} else {
printf("Error creating database: %s\n", fbsql_error ());
}
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_drop_db</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-create-blob">
<refnamediv>
<refname>fbsql_create_blob</refname>
<refpurpose>BLOBを生成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_create_blob</methodname>
<methodparam><type>string</type><parameter>blob_data</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: 新規に生成されたblobへのリソースハンドル
</para>
<para>
<function>fbsql_create_blob</function>は、blob_dataからblobを生成
します。返されたリソースハンドルは、データベース中にblobを保存す
るinsert及びupdateコマンドで使用されます。
</para>
<example>
<title><function>fbsql_create_blob</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_pconnect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
$filename = "blobfile.bin";
$fp = fopen($filename, "rb");
$blobdata = fread($fp, filesize($filename));
fclose($fp);
$blobHandle = fbsql_create_blob($blobdata, $link);
$sql = "INSERT INTO BLOB_TABLE (BLOB_COLUMN) VALUES ($blobHandle);";
$rs = fbsql_query($sql, $link);
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_create_clob</function>,
<function>fbsql_read_blob</function>,
<function>fbsql_read_clob</function>,
<function>fbsql_set_lob_mode</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-create-clob">
<refnamediv>
<refname>fbsql_create_clob</refname>
<refpurpose>CLOBを生成する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_create_clob</methodname>
<methodparam><type>string</type><parameter>clob_data</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: 新規に生成されたCLOBへのリソースハンドル
</para>
<para>
<function>fbsql_create_clob</function>は、clob_dataからclobを生成
します。返されたリソースハンドルは、データベースにclob保存する
insert及びupdateコマンドで使用されます。
</para>
<example>
<title><function>fbsql_create_clob</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_pconnect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
$filename = "clob_file.txt";
$fp = fopen($filename, "rb");
$clobdata = fread($fp, filesize($filename));
fclose($fp);
$clobHandle = fbsql_create_clob($clobdata, $link);
$sql = "INSERT INTO CLOB_TABLE (CLOB_COLUMN) VALUES ($clobHandle);";
$rs = fbsql_query($sql, $link);
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_create_blob</function>,
<function>fbsql_read_blob</function>,
<function>fbsql_read_clob</function>,
<function>fbsql_set_lob_mode</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-database-password">
<refnamediv>
<refname>fbsql_database_password</refname>
<refpurpose>
FrontBaseデータベースのパスワードを設定または取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_database_password</methodname>
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>
database_password
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: リンクIDにより表されるデータベースのデータベースパスワード
</para>
<para>
<function>fbsql_database_password</function>は、カレントのデータ
ベースパスワードを設定または取得します。二番目のオプションのパラ
メータが指定された場合、指定したリンクIDが指すサーバのパスワード
のデータベースパスワードを設定します。リンクIDが指定されない場合、
直近にオープンされたリンクが仮定されます。リンクがオープンされて
いない場合、この関数は、<function>fbsql_connect</function>がコー
ルされた場合と同様にリンクを確立し、使用します。
</para>
<para>
<function>fbsql_connect</function>および
<function>fbsql_pconnect</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-data-seek">
<refnamediv>
<refname>fbsql_data_seek</refname>
<refpurpose>内部結果ポインタを移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_data_seek</methodname>
<methodparam><type>resource</type><parameter>result_identifier</parameter></methodparam>
<methodparam><type>int</type><parameter>row_number</parameter></methodparam>
</methodsynopsis>
<para>
返り値: 成功時に&true;、失敗時に&false;。
</para>
<para>
<function>fbsql_data_seek</function>は、指定した結果IDが指す
FrontBase結果の内部行ポインタを指定した行番号に移動します。
これ以降、<function>fbsql_fetch_row</function>をコールすると、そ
の行が返されます。
</para>
<para>
<parameter>row_number</parameter>は、0から始まります。
</para>
<example>
<title><function>fbsql_data_seek</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_pconnect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
fbsql_select_db ("samp_db")
or die ("Could not select database");
$query = "SELECT last_name, first_name FROM friends;";
$result = fbsql_query ($query)
or die ("Query failed");
# fetch rows in reverse order
for ($i = fbsql_num_rows ($result) - 1; $i >=0; $i--) {
if (!fbsql_data_seek ($result, $i)) {
printf ("Cannot seek to row %d\n", $i);
continue;
}
if(!($row = fbsql_fetch_object ($result)))
continue;
printf("%s %s<BR>\n", $row->last_name, $row->first_name);
}
fbsql_free_result ($result);
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<refentry id="function.fbsql-db-query">
<refnamediv>
<refname>fbsql_db_query</refname>
<refpurpose>FrontBaseクエリを送信する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_db_query</methodname>
<methodparam><type>string</type><parameter>database</parameter></methodparam>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: クエリ結果への正のFrontBase結果ID、またはエラー時には&false;。
</para>
<para>
<function>fbsql_db_query</function>は、データベースを選択し、そこ
でクエリを実行します。オプションのリンクIDが省略された場合、この
関数は、FrontBaseサーバへのリンクをオープンしようとし、
<function>fbsql_connect</function>が引数無しでコールされた時と同
様にリンクを作成します。
</para>
<para>
<function>fbsql_connect</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-db-status">
<refnamediv>
<refname>fbsql_db_status</refname>
<refpurpose>指定したデータベースのステータスを取得する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>fbsql_db_status</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: カレントステータスを表す整数値
</para>
<para>
<function>fbsql_db_status</function>は、
<parameter>database_name</parameter>で指定したデータベースのカレ
ントステータスを取得します。
<parameter>link_identifier</parameter>が省略された場合、デフォル
トのlink_identifierが使用されます。
</para>
<para>
返り値は、次の定数の1つとします。
<itemizedlist>
<listitem>
<simpara>
&false; - hostが無効なexecハンドラ。このエラーは、
link_identifierがポート番号を用いてデータベースへ直接接続する
場合に発生します。FBExecはサーバで利用可能ですが、接続は行われ
ていません。
</simpara>
</listitem>
<listitem>
<simpara>
FBSQL_UNKNOWN - 未知のステータスです。
</simpara>
</listitem>
<listitem>
<simpara>
FBSQL_STOPPED - データベースは実行されていません。データベース
を開始するには、<function>fbsql_start_db</function>を使用して
下さい。
</simpara>
</listitem>
<listitem>
<simpara>
FBSQL_STARTING - データベースは起動中です。
</simpara>
</listitem>
<listitem>
<simpara>
FBSQL_RUNNING - データベースは実行中で、SQL処理を実行可能です。
</simpara>
</listitem>
<listitem>
<simpara>
FBSQL_STOPPING - データベースは停止中です。
</simpara>
</listitem>
<listitem>
<simpara>
FBSQL_NOEXEC - FBExecはサーバで実行されておらず、データベース
のステータスを取得することはできません。
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<function>fbsql_start_db</function>および
<function>fbsql_stop_db</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-drop-db">
<refnamediv>
<refname>fbsql_drop_db</refname>
<refpurpose>FrontBaseデータベースを破棄(削除)する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_drop_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: 成功時に&true;、失敗時に&false;。
</para>
<para>
<function>fbsql_drop_db</function>は、指定したリンクIDが指すサー
バからデータベース全体を破棄(削除)します。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-errno">
<refnamediv>
<refname>fbsql_errno</refname>
<refpurpose>
前のFrontBase演算からエラーメッセージの数値的な値を返します。
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>fbsql_errno</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
Returns the error number from the last fbsql function, or
<literal>0</literal> (zero) if no error occurred.
</para>
<para>
Errors coming back from the fbsql database backend dont
issue warnings. Instead, use <function>fbsql_errno</function> to
retrieve the error code. Note that this function only returns the
error code from the most recently executed fbsql function (not
including <function>fbsql_error</function> and
<function>fbsql_errno</function>), so if you want to use it,
make sure you check the value before calling another fbsql
function.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect("marliesle");
echo fbsql_errno().": ".fbsql_error()."<BR>";
fbsql_select_db("nonexistentdb");
echo fbsql_errno().": ".fbsql_error()."<BR>";
$conn = fbsql_query("SELECT * FROM nonexistenttable;");
echo fbsql_errno().": ".fbsql_error()."<BR>";
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
<function>fbsql_error</function>,
<function>fbsql_warnings</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-error">
<refnamediv>
<refname>fbsql_error</refname>
<refpurpose>
前のFrontBase操作からエラーメッセージのテキストを返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_error</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
Returns the error text from the last fbsql function, or
<literal>''</literal> (the empty string) if no error occurred.
</para>
<para>
Errors coming back from the fbsql database backend dont
issue warnings. Instead, use <function>fbsql_error</function> to
retrieve the error text. Note that this function only returns the
error text from the most recently executed fbsql function (not
including <function>fbsql_error</function> and
<function>fbsql_errno</function>), so if you want to use it, make
sure you check the value before calling another fbsql function.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect("marliesle");
echo fbsql_errno().": ".fbsql_error()."<BR>";
fbsql_select_db("nonexistentdb");
echo fbsql_errno().": ".fbsql_error()."<BR>";
$conn = fbsql_query("SELECT * FROM nonexistenttable;");
echo fbsql_errno().": ".fbsql_error()."<BR>";
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
See also: <function>fbsql_errno</function>,
<function>fbsql_warnings</function>
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-fetch-array">
<refnamediv>
<refname>fbsql_fetch_array</refname>
<refpurpose>
連想配列、数値配列、または両方として結果レコードを取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>fbsql_fetch_array</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>
result_type
</parameter></methodparam>
</methodsynopsis>
<para>
Returns an array that corresponds to the fetched row, or &false;
if there are no more rows.</para>
<para>
<function>fbsql_fetch_array</function> is an extended version of
<function>fbsql_fetch_row</function>. In addition to storing the
data in the numeric indices of the result array, it also stores
the data in associative indices, using the field names as keys.
</para>
<para>
If two or more columns of the result have the same field names,
the last column will take precedence. To access the other column(s)
of the same name, you must the numeric index of the column or
make an alias for the column.
<informalexample>
<programlisting>
<![CDATA[
select t1.f1 as foo t2.f1 as bar from t1, t2
]]>
</programlisting>
</informalexample>
</para>
<para>
An important thing to note is that using
<function>fbsql_fetch_array</function> is NOT significantly
slower than using <function>fbsql_fetch_row</function>, while it
provides a significant added value.
</para>
<para>
The optional second argument <parameter>result_type</parameter>
in <function>fbsql_fetch_array</function> is a constant and can
take the following values: FBSQL_ASSOC, FBSQL_NUM, and
FBSQL_BOTH.
</para>
<para>
詳細については、
<function>fbsql_fetch_row</function>および
<function>fbsql_fetch_assoc</function>も参照下さい。
</para>
<example>
<title><function>fbsql_fetch_array</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect ($host, $user, $password);
$result = fbsql_db_query ("database","select user_id, fullname from table");
while ($row = fbsql_fetch_array ($result)) {
echo "user_id: ".$row["user_id"]."<br>\n";
echo "user_id: ".$row[0]."<br>\n";
echo "fullname: ".$row["fullname"]."<br>\n";
echo "fullname: ".$row[1]."<br>\n";
}
fbsql_free_result ($result);
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<refentry id="function.fbsql-fetch-assoc">
<refnamediv>
<refname>fbsql_fetch_assoc</refname>
<refpurpose>
連想配列として結果レコードを取得する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>fbsql_fetch_assoc</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns an associative array that corresponds to the fetched row,
or &false; if there are no more rows.</para>
<para>
<function>fbsql_fetch_assoc</function> is equivalent to calling
<function>fbsql_fetch_array</function> with FBSQL_ASSOC for the
optional second parameter. It only returns an associative array.
This is the way <function>fbsql_fetch_array</function> originally
worked. If you need the numeric indices as well as the
associative, use <function>fbsql_fetch_array</function>.
</para>
<para>
If two or more columns of the result have the same field names,
the last column will take precedence. To access the other column(s)
of the same name, you must use <function>fbsql_fetch_array</function> and
have it return the numeric indices as well.
</para>
<para>
An important thing to note is that using
<function>fbsql_fetch_assoc</function> is NOT significantly
slower than using <function>fbsql_fetch_row</function>, while it
provides a significant added value.
</para>
<para>
詳細については、<function>fbsql_fetch_row</function>および
<function>fbsql_fetch_array</function>も参照下さい。
</para>
<example>
<title><function>fbsql_fetch_assoc</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect ($host, $user, $password);
$result = fbsql_db_query ("database","select * from table");
while ($row = fbsql_fetch_assoc ($result)) {
echo $row["user_id"];
echo $row["fullname"];
}
fbsql_free_result ($result);
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<refentry id="function.fbsql-fetch-field">
<refnamediv>
<refname>fbsql_fetch_field</refname>
<refpurpose>
結果からカラム情報を得て、オブジェクトとして返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>fbsql_fetch_field</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>
field_offset
</parameter></methodparam>
</methodsynopsis>
<para>
Returns an object containing field information.
</para>
<para>
<function>fbsql_fetch_field</function> can be used in order to
obtain information about fields in a certain query result. If
the field offset isn't specified, the next field that wasn't yet
retrieved by <function>fbsql_fetch_field</function> is retrieved.
</para>
<para>
The properties of the object are:
<itemizedlist>
<listitem>
<simpara>
name - column name
</simpara>
</listitem>
<listitem>
<simpara>
table - name of the table the column belongs to
</simpara>
</listitem>
<listitem>
<simpara>
max_length - maximum length of the column
</simpara>
</listitem>
<listitem>
<simpara>
not_null - 1 if the column cannot be &null;
</simpara>
</listitem>
<listitem>
<simpara>
type - the type of the column
</simpara>
</listitem>
</itemizedlist>
</para>
<example>
<title><function>fbsql_fetch_field</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect ($host, $user, $password)
or die ("Could not connect");
$result = fbsql_db_query ("database", "select * from table")
or die ("Query failed");
# get column metadata
$i = 0;
while ($i < fbsql_num_fields ($result)) {
echo "Information for column $i:<BR>\n";
$meta = fbsql_fetch_field ($result);
if (!$meta) {
echo "No information available<BR>\n";
}
echo "<PRE>
max_length: $meta->max_length
name: $meta->name
not_null: $meta->not_null
table: $meta->table
type: $meta->type
</PRE>";
$i++;
}
fbsql_free_result ($result);
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_field_seek</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-fetch-lengths">
<refnamediv>
<refname>fbsql_fetch_lengths</refname>
<refpurpose>
結果の各出力の長さを得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>fbsql_fetch_lengths</methodname>
<methodparam choice="opt"><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns: An array that corresponds to the lengths of each field
in the last row fetched by <function>fbsql_fetch_row</function>,
or &false; on error.
</para>
<para>
<function>fbsql_fetch_lengths</function> stores the lengths of
each result column in the last row returned by
<function>fbsql_fetch_row</function>,
<function>fbsql_fetch_array</function>, and
<function>fbsql_fetch_object</function> in an array, starting at
offset 0.
</para>
<para>
See also: <function>fbsql_fetch_row</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-fetch-object">
<refnamediv>
<refname>fbsql_fetch_object</refname>
<refpurpose>オブジェクトとして結果レコードを取得する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>fbsql_fetch_object</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>
result_type
</parameter></methodparam>
</methodsynopsis>
<para>
Returns an object with properties that correspond to the fetched
row, or &false; if there are no more rows.
</para>
<para>
<function>fbsql_fetch_object</function> is similar to
<function>fbsql_fetch_array</function>, with one difference - an
object is returned, instead of an array. Indirectly, that means
that you can only access the data by the field names, and not by
their offsets (numbers are illegal property names).
</para>
<para>
The optional argument <parameter>result_type</parameter> is a
constant and can take the following values: FBSQL_ASSOC,
FBSQL_NUM, and FBSQL_BOTH.
</para>
<para>
Speed-wise, the function is identical to
<function>fbsql_fetch_array</function>, and almost as quick as
<function>fbsql_fetch_row</function> (the difference is
insignificant).
<example>
<title><function>fbsql_fetch_object</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect ($host, $user, $password);
$result = fbsql_db_query ("database", "select * from table");
while ($row = fbsql_fetch_object ($result)) {
echo $row->user_id;
echo $row->fullname;
}
fbsql_free_result ($result);
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>fbsql_fetch_array</function>および
<function>fbsql_fetch_row</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-fetch-row">
<refnamediv>
<refname>fbsql_fetch_row</refname>
<refpurpose>数値配列として結果レコードを得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>fbsql_fetch_row</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
Returns: An array that corresponds to the fetched row, or &false;
if there are no more rows.
</para>
<para>
<function>fbsql_fetch_row</function> fetches one row of data from
the result associated with the specified result identifier. The
row is returned as an array. Each result column is stored in an
array offset, starting at offset 0.
</para>
<para>
Subsequent call to <function>fbsql_fetch_row</function> would
return the next row in the result set, or &false; if there are no
more rows.
</para>
<para>
See also: <function>fbsql_fetch_array</function>,
<function>fbsql_fetch_object</function>,
<function>fbsql_data_seek</function>,
<function>fbsql_fetch_lengths</function>, and
<function>fbsql_result</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-field-flags">
<refnamediv>
<refname>fbsql_field_flags</refname>
<refpurpose>
クエリ結果において指定したフィールドに関するフラグを得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_field_flags</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_field_flags</function> returns the field flags of
the specified field. The flags are reported as a single word
per flag separated by a single space, so that you can split the
returned value using <function>explode</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-field-name">
<refnamediv>
<refname>fbsql_field_name</refname>
<refpurpose>
結果の指定したフィールドの名前を得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_field_name</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_index</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_field_name</function> returns the name of the
specified field index. <parameter>result</parameter> must be a
valid result identifier and <parameter>field_index</parameter> is
the numerical offset of the field.
</para>
<note>
<para>
<parameter>field_index</parameter> starts at 0.
</para>
<para>
e.g. The index of the third field would actually be 2, the index
of the fourth field would be 3 and so on.
</para>
</note>
<para>
<example>
<title><function>fbsql_field_name</function>の例</title>
<programlisting role="php">
<![CDATA[
// The users table consists of three fields:
// user_id
// username
// password.
$res = fbsql_db_query("users", "select * from users", $link);
echo fbsql_field_name($res, 0) . "\n";
echo fbsql_field_name($res, 2);
]]>
</programlisting>
</example>
</para>
<para>
上の例の出力は以下のようになります。
<informalexample>
<programlisting>
<![CDATA[
user_id
password
]]>
</programlisting>
</informalexample>
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-field-len">
<refnamediv>
<refname>fbsql_field_len</refname>
<refpurpose>
指定したフィールドの長さを返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>fbsql_field_len</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_field_len</function> returns the length of the
specified field.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-field-seek">
<refnamediv>
<refname>fbsql_field_seek</refname>
<refpurpose>
指定したフィールドオフセットに結果ポインタを設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_field_seek</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
Seeks to the specified field offset. If the next call to
<function>fbsql_fetch_field</function> doesn't include a field
offset, the field offset specified in
<function>fbsql_field_seek</function> will be returned.
</para>
<para>
See also: <function>fbsql_fetch_field</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-field-table">
<refnamediv>
<refname>fbsql_field_table</refname>
<refpurpose>
指定したフィールドがあるテーブルの名前を得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_field_table</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
Returns the name of the table that the specifed field is
in.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-field-type">
<refnamediv>
<refname>fbsql_field_type</refname>
<refpurpose>
結果の中で指定したフィールドの型を得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_field_type</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>field_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_field_type</function> is similar to the
<function>fbsql_field_name</function> function. The arguments are
identical, but the field type is returned instead. The field type
will be one of "int", "real", "string", "blob", and others as
detailed in the <ulink url="&url.fbsql.docs;">FrontBase
documentation</ulink>.
<example>
<title><function>fbsql_field_type</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect ("localhost", "_SYSTEM", "");
fbsql_select_db ("wisconsin");
$result = fbsql_query ("SELECT * FROM onek;");
$fields = fbsql_num_fields ($result);
$rows = fbsql_num_rows ($result);
$i = 0;
$table = fbsql_field_table ($result, $i);
echo "Your '".$table."' table has ".$fields." fields and ".$rows." records <BR>";
echo "The table has the following fields <BR>";
while ($i < $fields) {
$type = fbsql_field_type ($result, $i);
$name = fbsql_field_name ($result, $i);
$len = fbsql_field_len ($result, $i);
$flags = fbsql_field_flags ($result, $i);
echo $type." ".$name." ".$len." ".$flags."<BR>";
$i++;
}
fbsql_close();
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-free-result">
<refnamediv>
<refname>fbsql_free_result</refname>
<refpurpose>結果メモリを開放する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_free_result</methodname>
<methodparam><type>int</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_free_result</function> will free all memory
associated with the result identifier <parameter>result</parameter>.
</para>
<para>
<function>fbsql_free_result</function> only needs to be called if
you are concerned about how much memory is being used for queries
that return large result sets. All associated result memory is
automatically freed at the end of the script's execution.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-insert-id">
<refnamediv>
<refname>fbsql_insert_id</refname>
<refpurpose>
直近のINSERT処理により生成されたIDを得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>fbsql_insert_id</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_insert_id</function> returns the ID generated for
an column defined as DEFAULT UNIQUE by the previous INSERT query using the
given <parameter>link_identifier</parameter>. If
<parameter>link_identifier</parameter> isn't specified, the last
opened link is assumed.
</para>
<para>
<function>fbsql_insert_id</function> returns 0 if the previous
query does not generate an DEFAULT UNIQUE value. If you need to
save the value for later, be sure to call fbsql_insert_id()
immediately after the query that generates the value.
</para>
<note>
<para>
The value of the FrontBase SQL function
<literal>LAST_INSERT_ID()</literal> always contains the most
recently generated DEFAULT UNIQUE value, and is not reset
between queries.
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.fbsql-list-dbs">
<refnamediv>
<refname>fbsql_list_dbs</refname>
<refpurpose>
FrontBaseサーバで利用可能なデータベースの一覧を得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_list_dbs</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_list_dbs</function> will return a result pointer
containing the databases available from the current fbsql
daemon. Use the <function>fbsql_tablename</function> function to
traverse this result pointer.
</para>
<para>
<example>
<title><function>fbsql_list_dbs</function>の例</title>
<programlisting role="php">
<![CDATA[
$link = fbsql_connect('localhost', 'myname', 'secret');
$db_list = fbsql_list_dbs($link);
while ($row = fbsql_fetch_object($db_list)) {
echo $row->Database . "\n";
}
]]>
</programlisting>
</example>
</para>
<para>
上の例の出力は以下のようになります。
<informalexample>
<programlisting>
<![CDATA[
database1
database2
database3
...
]]>
</programlisting>
</informalexample>
</para>
<note>
<para>
上記のコードは、<function>fbsql_fetch_row</function>または他の類
似の関数でも簡単に同じことが可能です。
</para>
</note>
</refsect1>
</refentry>
<refentry id="function.fbsql-list-fields">
<refnamediv>
<refname>fbsql_list_fields</refname>
<refpurpose>FrontBase結果フィールドの一覧を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_list_fields</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam><type>string</type><parameter>table_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_list_fields</function> retrieves information
about the given tablename. Arguments are the database name and
the table name. A result pointer is returned which can be used
with <function>fbsql_field_flags</function>,
<function>fbsql_field_len</function>,
<function>fbsql_field_name</function>, and
<function>fbsql_field_type</function>.
</para>
<para>
A result identifier is a positive integer. The function returns
-1 if a error occurs. A string describing the error will be
placed in <literal>$phperrmsg</literal>, and unless the function
was called as <literal>@fbsql()</literal> then this error string
will also be printed out.
</para>
<para>
<example>
<title><function>fbsql_list_fields</function>の例</title>
<programlisting role="php">
<![CDATA[
$link = fbsql_connect('localhost', 'myname', 'secret');
$fields = fbsql_list_fields("database1", "table1", $link);
$columns = fbsql_num_fields($fields);
for ($i = 0; $i < $columns; $i++) {
echo fbsql_field_name($fields, $i) . "\n";;
}
]]>
</programlisting>
</example>
</para>
<para>
上の例の出力は以下のようになります。
<informalexample>
<programlisting>
<![CDATA[
field1
field2
field3
...
]]>
</programlisting>
</informalexample>
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-list-tables">
<refnamediv>
<refname>fbsql_list_tables</refname>
<refpurpose>FrontBaseデータベースのテーブル一覧を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_list_tables</methodname>
<methodparam><type>string</type><parameter>database</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_list_tables</function> takes a database name and
returns a result pointer much like the
<function>fbsql_db_query</function> function. The
<function>fbsql_tablename</function> function should be used to
extract the actual table names from the result pointer.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-next-result">
<refnamediv>
<refname>fbsql_next_result</refname>
<refpurpose>内部結果ポインタを次の結果に移動する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_next_result</methodname>
<methodparam><type>int</type><parameter>result_id</parameter></methodparam>
</methodsynopsis>
<para>
When sending more than one SQL statement to the server or executing a stored procedure
with multiple results will cause the server to return multiple result sets.
This function will test for additional results available form the server. if an
additional result set exists it will free the existing result set and prepare to
fetch the wors from the new result set.
The function will return &true; if an additional result set was
available or &false; othervise.
</para>
<example>
<title><function>fbsql_next_result</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_connect ("localhost", "_SYSTEM", "secret");
fbsql_select_db("MyDB", $link);
$SQL = "Select * from table1; select * from table2;";
$rs = fbsql_query($SQL, $link);
do {
while ($row = fbsql_fetch_row($rs)) {
}
} while (fbsql_next_result($rs));
fbsql_free_result($rs);
fbsql_close ($link);
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<refentry id="function.fbsql-num-fields">
<refnamediv>
<refname>fbsql_num_fields</refname>
<refpurpose>結果のフィールド数を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>fbsql_num_fields</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_num_fields</function> returns the number of
fields in a result set.
</para>
<para>
See also:
<function>fbsql_db_query</function>,
<function>fbsql_query</function>,
<function>fbsql_fetch_field</function>,
<function>fbsql_num_rows</function>.</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-num-rows">
<refnamediv>
<refname>fbsql_num_rows</refname>
<refpurpose>結果のレコード数を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>fbsql_num_rows</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_num_rows</function> returns the number of rows in
a result set. This command is only valid for SELECT statements.
To retrieve the number of rows returned from a INSERT, UPDATE or
DELETE query, use <function>fbsql_affected_rows</function>.
<example>
<title><function>fbsql_num_rows</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_connect("localhost", "username", "password");
fbsql_select_db("database", $link);
$result = fbsql_query("SELECT * FROM table1;", $link);
$num_rows = fbsql_num_rows($result);
echo "$num_rows Rows\n";
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>fbsql_affected_rows</function>,
<function>fbsql_connect</function>,
<function>fbsql_select_db</function>,
<function>fbsql_query</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-pconnect">
<refnamediv>
<refname>fbsql_pconnect</refname>
<refpurpose>
FrontBaseサーバへの持続的接続をオープンする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_pconnect</methodname>
<methodparam choice="opt"><type>string</type><parameter>hostname</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<para>
Returns: A positive FrontBase persistent link identifier on success,
or &false; on error.
</para>
<para>
<function>fbsql_pconnect</function> establishes a connection
to a FrontBase server. The following defaults are assumed for
missing optional parameters: <parameter>host</parameter> =
'localhost', <parameter>username</parameter> = "_SYSTEM"
and <parameter>password</parameter> = empty password.
</para>
<para>
<function>fbsql_pconnect</function> acts very much like
<function>fbsql_connect</function> with two major differences.
</para>
<para>
To set Frontbase server port number, use <function>fbsql_select_db</function>.
</para>
<para>
First, when connecting, the function would first try to find a
(persistent) link that's already open with the same host,
username and password. If one is found, an identifier for it
will be returned instead of opening a new connection.
</para>
<para>
Second, the connection to the SQL server will not be closed when
the execution of the script ends. Instead, the link will remain
open for future use.
</para>
<para>
This type of links is therefore called 'persistent'.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-query">
<refnamediv>
<refname>fbsql_query</refname>
<refpurpose>FrontBaseクエリを送信する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_query</function> sends a query to the currently
active database on the server that's associated with the
specified link identifier. If
<parameter>link_identifier</parameter> isn't specified, the last
opened link is assumed. If no link is open, the function tries
to establish a link as if <function>fbsql_connect</function> was
called with no arguments, and use it.
</para>
<note>
<para>
The query string shall always end with a semicolon.
</para>
</note>
<para>
<function>fbsql_query</function> returns &true; (non-zero) or &false;
to indicate whether or not the query succeeded. A return value
of &true; means that the query was legal and could be executed by
the server. It does not indicate anything about the number of
rows affected or returned. It is perfectly possible for a query
to succeed but affect no rows or return no rows.
</para>
<para>
The following query is syntactically invalid, so
<function>fbsql_query</function> fails and returns &false;:
<example>
<title><function>fbsql_query</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$result = fbsql_query ("SELECT * WHERE 1=1")
or die ("Invalid query");
?>
]]>
</programlisting>
</example>
</para>
<para>
The following query is semantically invalid if
<literal>my_col</literal> is not a column in the table
<literal>my_tbl</literal>, so <function>fbsql_query</function>
fails and returns &false;:
<example>
<title><function>fbsql_query</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$result = fbsql_query ("SELECT my_col FROM my_tbl")
or die ("Invalid query");
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>fbsql_query</function> will also fail and return &false;
if you don't have permission to access the table(s) referenced by
the query.
</para>
<para>
Assuming the query succeeds, you can call
<function>fbsql_num_rows</function> to find out how many rows
were returned for a SELECT statment or
<function>fbsql_affected_rows</function> to find out how many
rows were affected by a DELETE, INSERT, REPLACE, or UPDATE
statement.
</para>
<para>
For SELECT statements, <function>fbsql_query</function> returns a
new result identifier that you can pass to
<function>fbsql_result</function>. When you are done with the
result set, you can free the resources associated with it by
calling <function>fbsql_free_result</function>. Although, the
memory will automatically be freed at the end of the script's
execution.
</para>
<para>
See also: <function>fbsql_affected_rows</function>,
<function>fbsql_db_query</function>,
<function>fbsql_free_result</function>,
<function>fbsql_result</function>,
<function>fbsql_select_db</function>, and
<function>fbsql_connect</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-read-blob">
<refnamediv>
<refname>fbsql_read_blob</refname>
<refpurpose>データベースからBLOBを読み込む</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_read_blob</methodname>
<methodparam><type>string</type><parameter>blob_handle</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: blob_handleで指定したBLOBを含む文字列。
</para>
<para>
<function>fbsql_read_blob</function> reads BLOB data from the
database. If a select statement contains BLOB and/or BLOB
columns FrontBase will return the data directly when data is
fetched. This default behavior can be changed with
<function>fbsql_set_lob_mode</function> so the fetch functions
will return handles to BLOB and CLOB data. If a handle is
fetched a user must call <function>fbsql_read_blob</function> to
get the actual BLOB data from the database.
</para>
<example>
<title><function>fbsql_read_blob</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_pconnect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
$sql = "SELECT BLOB_COLUMN FROM BLOB_TABLE;";
$rs = fbsql_query($sql, $link);
$row_data = fbsql_fetch_row($rs);
// $row_data[0] will now contain the blob data for teh first row
fbsql_free_result($rs);
$rs = fbsql_query($sql, $link);
fbsql_set_lob_mode($rs, FBSQL_LOB_HANDLE);
$row_data = fbsql_fetch_row($rs);
// $row_data[0] will now contain a handle to the BLOB data in the first row
$blob_data = fbsql_read_blob($row_data[0]);
fbsql_free_result($rs);
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_create_blob</function>,
<function>fbsql_read_blob</function>,
<function>fbsql_read_clob</function>,
<function>fbsql_set_lob_mode</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-read-clob">
<refnamediv>
<refname>fbsql_read_clob</refname>
<refpurpose>データベースからCLOBを読み込む</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_read_clob</methodname>
<methodparam><type>string</type><parameter>clob_handle</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
返り値: clob_handleにより指定したCLOBを含む文字列。
</para>
<para>
<function>fbsql_read_clob</function> reads CLOB data from the
database. If a select statement contains BLOB and/or CLOB
columns FrontBase will return the data directly when data is
fetched. This default behavior can be changed with
<function>fbsql_set_lob_mode</function> so the fetch functions
will return handles to BLOB and CLOB data. If a handle is
fetched a user must call <function>fbsql_read_clob</function> to
get the actual CLOB data from the database.
</para>
<example>
<title><function>fbsql_read_clob</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = fbsql_pconnect ("localhost", "_SYSTEM", "secret")
or die ("Could not connect");
$sql = "SELECT CLOB_COLUMN FROM CLOB_TABLE;";
$rs = fbsql_query($sql, $link);
$row_data = fbsql_fetch_row($rs);
// $row_data[0] will now contain the clob data for teh first row
fbsql_free_result($rs);
$rs = fbsql_query($sql, $link);
fbsql_set_lob_mode($rs, FBSQL_LOB_HANDLE);
$row_data = fbsql_fetch_row($rs);
// $row_data[0] will now contain a handle to the CLOB data in the first row
$clob_data = fbsql_read_clob($row_data[0]);
fbsql_free_result($rs);
?>
]]>
</programlisting>
</example>
<para>
<function>fbsql_create_blob</function>,
<function>fbsql_read_blob</function>,
<function>fbsql_read_clob</function>,
<function>fbsql_set_lob_mode</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-result">
<refnamediv>
<refname>fbsql_result</refname>
<refpurpose>結果データを得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>mixed</type><methodname>fbsql_result</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>row</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter>
field
</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_result</function> returns the contents of one
cell from a FrontBase result set. The field argument can be the
field's offset, or the field's name, or the field's table dot
field's name (tabledname.fieldname). If the column name has been
aliased ('select foo as bar from...'), use the alias instead of
the column name.
</para>
<para>
When working on large result sets, you should consider using one
of the functions that fetch an entire row (specified below). As
these functions return the contents of multiple cells in one
function call, they're MUCH quicker than
<function>fbsql_result</function>. Also, note that specifying a
numeric offset for the field argument is much quicker than
specifying a fieldname or tablename.fieldname argument.
</para>
<para>
Calls to <function>fbsql_result</function> should not be mixed
with calls to other functions that deal with the result set.
</para>
<para>
推奨される高性能な代替関数:
<function>fbsql_fetch_row</function>,
<function>fbsql_fetch_array</function>,
<function>fbsql_fetch_object</function>
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-rollback">
<refnamediv>
<refname>fbsql_rollback</refname>
<refpurpose>データベースへのトランザクションをロールバックする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_rollback</methodname>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
Returns: &true; on success, &false; on failure.
</para>
<para>
<function>fbsql_rollback</function> ends the current transaction by
rolling back all statements issued since last commit.
This command is only needed if autocommit is set to false.
</para>
<para> See also:
<function>fbsql_autocommit</function> and
<function>fbsql_commit</function>
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-set-lob-mode">
<refnamediv>
<refname>fbsql_set_lob_mode</refname>
<refpurpose>
FrontBase結果セットのLOB取得モードを設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_set_lob_mode</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
</methodsynopsis>
<para>
返り値: 成功時に&true; on success、エラー時に&false;。
</para>
<para>
<function>fbsql_set_lob_mode</function> sets the mode for
retrieving LOB data from the database. When BLOB and CLOB data is
stored in FrontBase it can be stored direct or indirect. Direct
stored LOB data will always be fetched no matter the setting of
the lob mode. If the LOB data is less than 512 bytes it will
always be stored directly.
<itemizedlist>
<listitem>
<simpara>
FBSQL_LOB_DIRECT - LOB data is retrieved directly. When data
is fetched from the database with
<function>fbsql_fetch_row</function>, and other fetch
functions, all CLOB and BLOB columns will be returned as
ordinary columns. This is the default value on a new
FrontBase result.
</simpara>
</listitem>
<listitem>
<simpara>
FBSQL_LOB_HANDLE - LOB data is retrieved as handles to the
data. When data is fetched from the database with
<function>fbsql_fetch_row </function>, and other fetch
functions, LOB data will be returned as a handle to the data
if the data is stored indirect or the data if it is stored
direct. If a handle is returned it will be a 27 byte string
formatted as "@'000000000000000000000000'".
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<function>fbsql_create_blob</function>,
<function>fbsql_create_clob</function>,
<function>fbsql_read_blob</function>,
<function>fbsql_read_clob</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-select-db">
<refnamediv>
<refname>fbsql_select_db</refname>
<refpurpose>FrontBaseデータベースを選択する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>fbsql_select_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
Returns: &true; on success, &false; on error.
</para>
<para>
<function>fbsql_select_db</function> sets the current active
database on the server that's associated with the specified link
identifier. If no link identifier is specified, the last opened
link is assumed. If no link is open, the function will try to
establish a link as if <function>fbsql_connect</function> was
called, and use it.
</para>
<para>
The client contacts FBExec to obtain the port number to use for
the connection to the database. if the database name is a number
the system will use that as a port number and it will not ask
FBExec for the port number.
The FrontBase server can be stared as
FRontBase -FBExec=No -port=<port number> <database name>.
</para>
<para>
Every subsequent call to <function>fbsql_query</function> will be
made on the active database.
</para>
<para> See also:
<function>fbsql_connect</function>,
<function>fbsql_pconnect</function>, and
<function>fbsql_query</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-start-db">
<refnamediv>
<refname>fbsql_start_db</refname>
<refpurpose>
ローカルまたはリモートサーバのデータベースを開始する
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_start_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
Returns: &true; on success, &false; on failure.
</para>
<para>
<function>fbsql_start_db</function>
</para>
<para>
See also: <function>fbsql_db_status</function> and
<function>fbsql_stop_db</function>.
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-stop-db">
<refnamediv>
<refname>fbsql_stop_db</refname>
<refpurpose>
ローカルまたはリモートサーバのデータベースを停止する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_stop_db</methodname>
<methodparam><type>string</type><parameter>database_name</parameter></methodparam>
<methodparam choice="opt"><type>resource</type><parameter>
link_identifier
</parameter></methodparam>
</methodsynopsis>
<para>
Returns: &true; on success, &false; on failure.
</para>
<para>
<function>fbsql_stop_db</function>
</para>
<para>
<function>fbsql_db_status</function>および
<function>fbsql_start_db</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-tablename">
<refnamediv>
<refname>fbsql_tablename</refname>
<refpurpose>フィールドのテーブル名を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_tablename</methodname>
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
<methodparam><type>int</type><parameter>i</parameter></methodparam>
</methodsynopsis>
<para>
<function>fbsql_tablename</function> takes a result pointer
returned by the <function>fbsql_list_tables</function> function
as well as an integer index and returns the name of a table. The
<function>fbsql_num_rows</function> function may be used to
determine the number of tables in the result pointer.
<example>
<title><function>fbsql_tablename</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
fbsql_connect ("localhost", "_SYSTEM", "");
$result = fbsql_list_tables ("wisconsin");
$i = 0;
while ($i < fbsql_num_rows ($result)) {
$tb_names[$i] = fbsql_tablename ($result, $i);
echo $tb_names[$i] . "<BR>";
$i++;
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<refentry id="function.fbsql-warnings">
<refnamediv>
<refname>fbsql_warnings</refname>
<refpurpose>FrontBase警告を有効または無効にする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>fbsql_warnings</methodname>
<methodparam choice="opt"><type>bool</type><parameter>
OnOff
</parameter></methodparam>
</methodsynopsis>
<para>
警告をオンにした場合は、&true;、そうでない 場合は
&false;を返します。
</para>
<para>
<function>fbsql_warnings</function> は、FrontBaseの警告を有効または
無効にします。
</para>
</refsect1>
</refentry>
<refentry id='function.fbsql-database'>
<refnamediv>
<refname>fbsql_database</refname>
<refpurpose>
No description given yet
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_database</methodname>
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>database</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.fbsql-get-autostart-info'>
<refnamediv>
<refname>fbsql_get_autostart_info</refname>
<refpurpose>
No description given yet
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>fbsql_get_autostart_info</methodname>
<methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.fbsql-hostname'>
<refnamediv>
<refname>fbsql_hostname</refname>
<refpurpose>
No description given yet
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_hostname</methodname>
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>host_name</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.fbsql-password'>
<refnamediv>
<refname>fbsql_password</refname>
<refpurpose>
No description given yet
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_password</methodname>
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>password</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.fbsql-set-transaction'>
<refnamediv>
<refname>fbsql_set_transaction</refname>
<refpurpose>
トランザクションのロックとアイソレーションを設定する
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>fbsql_set_transaction</methodname>
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam><type>int</type><parameter>Locking</parameter></methodparam>
<methodparam><type>int</type><parameter>Isolation</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
<refentry id='function.fbsql-username'>
<refnamediv>
<refname>fbsql_username</refname>
<refpurpose>
No description given yet
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>fbsql_username</methodname>
<methodparam><type>resource</type><parameter>link_identifier</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>username</parameter></methodparam>
</methodsynopsis>
<para>
&warn.undocumented.func;
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
|