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
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.10 $ -->
<reference id="ref.ingres">
<title>Ingres II 関数</title>
<titleabbrev>Ingres II</titleabbrev>
<partintro>
&warn.experimental;
<simpara>
これらの関数により、Ingres II データベースサーバにアクセスできるよ
うになります。
</simpara>
<simpara>
これらの関数を利用可能とするには、オプション
<option role="configure">--with-ingres</option> を付けて Ingres サ
ポートを有効にしてPHPをコンパイルする必要があります。コンパイルに
は、Ingres II に含まれる Open API ライブラリとヘッダが必要です。
環境変数 II_SYSTEM が正確に設定されていない場合、Ingres がインストー
ルされたディレクトリを指定するために
<option role="configure">--with-ingres=DIR</option> を使用する必要
があるかもしれません。
</simpara>
<simpara>
この拡張モジュールを Apache で使用する際に Apache が起動せず、
"PHP Fatal error: Unable to start
ingres_ii module in Unknown on line 0" というエラーが発生する場合、
環境変数 II_SYSTEM が正確に設定されているかどうかを確認して下さい。
"export II_SYSTEM="/home/ingres/II" を Apache を開始するスクリプト
に追加して下さい。この後、httpd を起動すれば、うまくいくはずです。
</simpara>
<note>
<para>
他のデータベースサーバにアクセスするために既にPHP 拡張モジュール
を使用している場合、Ingres は同一のコネクションについて複数のクエ
リやトランザクションの並列実行ができない、つまり、この拡張モジュー
ルにおいて結果およびトランザクションのハンドルを得ることができない
ことに注意する必要があります。クエリの結果は、別のクエリを送信す
る前に処理する必要があり、トランザクションは別のトランザクション
をオープンする前にコミットまたはロールバックする必要があります。
(これは、最初のクエリを送信する際に自動的に行われます)
</para>
</note>
</partintro>
<refentry id="function.ingres-connect">
<refnamediv>
<refname>ingres_connect</refname>
<refpurpose>Ingres II データベースへの接続をオープンする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>ingres_connect</methodname>
<methodparam><type>string</type><parameter>
<replaceable><optional>database</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>username</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>password</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
成功時に Ingres II リンクリソース、失敗した際に &false; を返します。
</para>
<para>
<function>ingres_connect</function> は、
<parameter>database</parameter> とこの後に続く
<parameter>[node_id::]dbname[/svr_class]</parameter> 構文により指
定された Ingres データベースへの接続をオープンします。
</para>
<para>
いくつかのパラメータが欠けている場合、
<function>ingres_connect</function> は、
<parameter>ingres.default_database</parameter>、
<parameter>ingres.default_user</parameter>、
<parameter>ingres.default_password</parameter> に関して
<filename>php.ini</filename> の値を使用します。
</para>
<para>
接続は、スクリプトの実行終了時または、このリンクについて
<function>ingres_close</function> がコールされた場合にクローズさ
れます。
</para>
<para>
他の全ての Ingres 関数は、デフォルトで直近にオープンされたリンク
を使用します。このため、複数のリンクを同時に使用したい場合には、
返された値を保存しておく必要があります。
</para>
<example>
<title><function>ingres_connect</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
$link = ingres_connect ("mydb", "user", "pass")
or die ("Could not connect");
print ("Connected successfully");
ingres_close ($link);
?>
]]>
</programlisting>
</example>
<example>
<title>
デフォルトリンクを使用する<function>ingres_connect</function>の例
</title>
<programlisting role="php">
<![CDATA[
<?php
ingres_connect ("mydb", "user", "pass")
or die ("Could not connect");
print ("Connected successfully");
ingres_close ();
?>
]]>
</programlisting>
</example>
<para>
<function>ingres_pconnect</function> および
<function>ingres_close</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-pconnect">
<refnamediv>
<refname>ingres_pconnect</refname>
<refpurpose>
Ingres II データベースへの持続的接続をオープンする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>resource</type><methodname>ingres_pconnect</methodname>
<methodparam><type>string</type><parameter>
<replaceable><optional>database</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>username</optional></replaceable>
</parameter></methodparam>
<methodparam><type>string</type><parameter>
<replaceable><optional>password</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
成功した際に Ingres II リンクリソース、失敗した際に &false; を返し
ます。
</para>
<para>
パラメータの詳細と例については、
<function>ingres_connect</function> を参照下さい。
<function>ingres_pconnect</function> と
<function>ingres_connect</function> の違いは次の2つだけです。
まず、接続時にこの関数は、まず同じパラメータ既にオープンされて
いる(持続的な)リンクを探すことです。第2に、Ingres サーバへの接続
はスクリプトの実行終了時にもクローズされないところです。代わりに、
リンクは、後で使用するためにオープンされたままとなります。
(<function>ingres_close</function> は、
<function>ingres_pconnect</function>により確立されたリンクをクロー
ズしません) このため、この型のリンクは「持続的(persistent)」であ
ると呼ばれます。
</para>
<para>
<function>ingres_connect</function> および
<function>ingres_close</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-close">
<refnamediv>
<refname>ingres_close</refname>
<refpurpose>Ingres II データベース接続を閉じる</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>ingres_close</methodname>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
成功時に&true;、失敗時に&false;を返します。
</para>
<para>
<function>ingres_close</function> は、指定したリンクが指す Ingres
サーバへの接続をクローズします。パラメータ
<parameter>link</parameter>が指定されない場合、直近にオープンされ
たリンクが使用されます。
</para>
<para>
持続的接続をクローズすることはできず、持続的でない接続はスクリプ
トの終了時に自動的にクローズされるため、
<function>ingres_close</function> は通常は不要です。
</para>
<para>
<function>ingres_connect</function> および
<function>ingres_pconnect</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-query">
<refnamediv>
<refname>ingres_query</refname>
<refpurpose>Ingres II にSQLクエリを送信する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>ingres_query</methodname>
<methodparam><type>string</type><parameter>query</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
成功時に&true;、失敗時に&false;を返します。
</para>
<para>
<function>ingres_query</function> は、指定した
<parameter>query</parameter> を Ingres サーバに送信します。このク
エリは、有効なSQLクエリである必要があります。(Ingres SQL リファレ
ンスガイドを参照下さい)
</para>
<para>
クエリは、現在オープンされているトランザクションの一部となります。
オープンされているトランザクションがない場合、
<function>ingres_query</function> は新規のトランザクションをオー
プンします。トランザクションをクローズするには、データベースへの
変更をコミットする場合に <function>ingres_commit</function> を、
これらの変更をキャンセルする場合に
<function>ingres_rollback</function> のどちらかを使用することが可
能です。スクリプト終了時に、全てのオープンされたトランザクション
は(<function>ingres_rollback</function>をコールすることにより)
ロールバックされます。新規トランザクションをオープンする前に
<function>ingres_autocommit</function> を使用することも可能です。
この場合、各SQLクエリは直ちにコミットされます。
</para>
<para>
次の型のSQLクエリは、この関数で送信できません。
<itemizedlist>
<listitem>
<simpara>close (<function>ingres_close</function>を参照)</simpara>
</listitem>
<listitem>
<simpara>commit (<function>ingres_commit</function>を参照)</simpara>
</listitem>
<listitem>
<simpara>connect (<function>ingres_connect</function>を参照)</simpara>
</listitem>
<listitem>
<simpara>disconnect (<function>ingres_close</function>を参照)</simpara>
</listitem>
<listitem><simpara>get dbevent</simpara></listitem>
<listitem><simpara>prepare to commit</simpara></listitem>
<listitem>
<simpara>
rollback (<function>ingres_rollback</function>を参照)
</simpara>
</listitem>
<listitem><simpara>savepoint</simpara></listitem>
<listitem>
<simpara>
set autocommit (<function>ingres_autocommit</function>を参照)
</simpara>
</listitem>
<listitem>
<simpara>カーソルに関係するクエリはサポートされていません</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>ingres_query</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
ingres_connect ($database, $user, $password);
ingres_query ("select * from table");
while ($row = ingres_fetch_row()) {
echo $row[1];
echo $row[2];
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>ingres_fetch_array</function>,
<function>ingres_fetch_object</function>,
<function>ingres_fetch_row</function>,
<function>ingres_commit</function>,
<function>ingres_rollback</function>,
<function>ingres_autocommit</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-num-rows">
<refnamediv>
<refname>ingres_num_rows</refname>
<refpurpose>
直近のクエリで作用されたレコードの数を取得し、返す
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>ingres_num_rows</methodname>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
delete, insert, update クエリの場合、
<function>ingres_num_rows</function> は、そのクエリにより作用され
た行(レコード)の数を返します。その他のクエリの場合、
<function>ingres_num_rows</function> はクエリ結果のレコード数を返
します。
</para>
<para>
<note>
<simpara>
この関数は、主にデータベースで修正されたレコードの数を得る際に
有用です。この関数が <function>ingres_fetch_array</function>、
<function>ingres_fetch_object</function>、
<function>ingres_fetch_row</function> を使用する前にコールされ
た場合、サーバは結果のデータを削除し、スクリプトは結果を得るこ
とができなくなります。
</simpara>
<simpara>
代わりにこれらの取得用関数のどれかをもう結果が残っていないとい
う意味で &false; を返すまでループ処理を行い、結果のデータを取得す
る必要があります。
</simpara>
</note>
</para>
<para>
<function>ingres_query</function>、
<function>ingres_fetch_array</function>、
<function>ingres_fetch_object</function>、
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-num-fields">
<refnamediv>
<refname>ingres_num_fields</refname>
<refpurpose>
直近のクエリにより返されたフィールドの数を得る
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>ingres_num_fields</methodname>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_num_fields</function> は、
<function>ingres_query</function> をコールした後で、Ingres サーバ
により返された結果のフィールド数を返します。
</para>
<para>
<function>ingres_query</function>、
<function>ingres_fetch_array</function>、
<function>ingres_fetch_object</function>、
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-field-name">
<refnamediv>
<refname>ingres_field_name</refname>
<refpurpose>クエリ結果においてフィールド名を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>ingres_field_name</methodname>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_field_name</function> は、クエリ結果の場合はフィー
ルド名、失敗した場合は &false; を返します。
</para>
<para>
<parameter>index</parameter> はフィールド番号であり、1 と
<function>ingres_num_fields</function> で指定した値の間である必要
があります。
</para>
<para>
<function>ingres_query</function>、
<function>ingres_fetch_array</function>、
<function>ingres_fetch_object</function>、
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-field-type">
<refnamediv>
<refname>ingres_field_type</refname>
<refpurpose>クエリ結果においてフィールドの型を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>string</type><methodname>ingres_field_type</methodname>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_field_type</function> はクエリ結果のフィールド型、
失敗した場合は、&false; を返します。返される型は、例えば、
"IIAPI_BYTE_TYPE", "IIAPI_CHA_TYPE", "IIAPI_DTE_TYPE",
"IIAPI_FLT_TYPE", "IIAPI_INT_TYPE", "IIAPI_VCH_TYPE" になります。
これらの型のいくつかは、フィールド長に応じて複数のSQL型をマップす
ることが可能です(<function>ingres_field_length</function>を参照
下さい)。例えば、"IIAPI_FLT_TYPE" は、float4 または float8 とする
ことが可能です。詳細な情報については、Ingres/OpenAPI User Guide
の Appendix C を参照下さい。
</para>
<para>
<parameter>index</parameter> はフィールド番号であり、1と
<function>ingres_num_fields</function> で指定した値の間である必要
があります。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_fetch_array</function>,
<function>ingres_fetch_object</function>,
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-field-nullable">
<refnamediv>
<refname>ingres_field_nullable</refname>
<refpurpose>フィールドに&null;値を設定可能かどうか調べる</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>ingres_field_nullable</methodname>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_field_nullable</function> は、フィールドに&null;が
設定可能な場合に &true;、設定できない場合に &false; を返します。
</para>
<para>
<parameter>index</parameter> はフィールド番号であり、1 と
<function>ingres_num_fields</function> で指定した値の間である必要
があります。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_fetch_array</function>,
<function>ingres_fetch_object</function>,
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-field-length">
<refnamediv>
<refname>ingres_field_length</refname>
<refpurpose>フィールド長を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>ingres_field_length</methodname>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_field_length</function> はフィールド長を返します。
フィールド長は、フィールドをサーバに保存する際に使用されるバイト
数です。詳細な情報については、Ingres/OpenAPI User Guide の
Appendix C を参照下さい。
</para>
<para>
<parameter>index</parameter> はフィールド番号であり、1 と
<function>ingres_num_fields</function> で指定した値の間である必要
があります。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_fetch_array</function>,
<function>ingres_fetch_object</function>,
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-field-precision">
<refnamediv>
<refname>ingres_field_precision</refname>
<refpurpose>フィールドの精度を得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>ingres_field_precision</methodname>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_field_precision</function> はフィールドの精度を
返します。この値は、decimal、float、SQLデータ money 型でのみ使用
されます。詳細な情報については、Ingres/OpenAPI User Guide の
Appendix C を参照下さい。
</para>
<para>
<parameter>index</parameter> はフィールド番号であり、1 と
<function>ingres_num_fields</function> で指定した値の間である必要
があります。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_fetch_array</function>,
<function>ingres_fetch_object</function>,
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-field-scale">
<refnamediv>
<refname>ingres_field_scale</refname>
<refpurpose>フィールドのスケールを得る</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>int</type><methodname>ingres_field_scale</methodname>
<methodparam><type>int</type><parameter>index</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_field_scale</function> はフィールドのスケールを
返します。この値は、SQLデータ decimal 型でのみ使用されます。詳細
な情報については、Ingres/OpenAPI User Guide の Appendix C を参照
下さい。
</para>
<para>
<parameter>index</parameter> はフィールド番号であり、1 と
<function>ingres_num_fields</function> で指定した値の間である必要
があります。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_fetch_array</function>,
<function>ingres_fetch_object</function>,
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-fetch-array">
<refnamediv>
<refname>ingres_fetch_array</refname>
<refpurpose>1行分の結果を配列に取得する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>ingres_fetch_array</methodname>
<methodparam><type>int</type><parameter>
<replaceable><optional>result_type</optional></replaceable>
</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
<function>ingres_fetch_array</function> は、取得したレコード(行)
に対応する配列を返します。レコードがもうない場合は &false; を返しま
す。
</para>
<para>
この関数は、<function>ingres_fetch_row</function> の拡張版です。
結果として返される配列の数値添字にデータを保存するだけでなく、フィー
ルド名をキーとして連想配列にもデータが保存されます。
</para>
<para>
結果において複数のカラムが同じフィールド名を有している場合、後の
カラムが優先されます。同名の他のカラムにアクセスするには、カラム
の添字番号を使用するか、カラムのエイリアスを作成する必要がありま
す。
<informalexample>
<programlisting role="php">
<![CDATA[
ingres_query(select t1.f1 as foo t2.f1 as bar from t1, t2);
$result = ingres_fetch_array();
$foo = $result["foo"];
$bar = $result["bar"];
]]>
</programlisting>
</informalexample>
</para>
<para>
<parameter>result_type</parameter> には、数値添字の場合に
INGRES_NUM、連想配列の場合にINGRES_ASSOC、両方の場合に
INGRES_BOTH(デフォルト)を指定可能です。
</para>
<para>
速度面では、この関数は<function>ingres_fetch_object</function>
と同じで、<function>ingres_fetch_row</function> とほぼ同等です(差
は僅かです)。
</para>
<para>
<example>
<title><function>ingres_fetch_array</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
ingres_connect ($database, $user, $password);
ingres_query ("select * from table");
while ($row = ingres_fetch_array()) {
echo $row["user_id"]; # 連想配列を使用する
echo $row["fullname"];
echo $row[1]; # 数値添字配列を使用する
echo $row[2];
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>ingres_query</function>,
<function>ingres_num_fields</function>,
<function>ingres_field_name</function>,
<function>ingres_fetch_object</function>,
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-fetch-row">
<refnamediv>
<refname>ingres_fetch_row</refname>
<refpurpose>1行分の結果を数値添字配列として取得する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>array</type><methodname>ingres_fetch_row</methodname>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_fetch_row</function> は取得したレコード(行)を有
する配列を返します。レコードがもうない場合は &false; を返します。各
カラムは、オフセット1から始まる配列オフセットに保存されます。
</para>
<para>
<function>ingres_fetch_row</function> を連続的にコールした場合、
結果集合の中の次のレコードが返され、もうレコードがない場合は&false;
を返します。
</para>
<para>
<example>
<title><function>ingres_fetch_row</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
ingres_connect ($database, $user, $password);
ingres_query ("select * from table");
while ($row = ingres_fetch_row()) {
echo $row[1];
echo $row[2];
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>ingres_num_fields</function>,
<function>ingres_query</function>,
<function>ingres_fetch_array</function>,
<function>ingres_fetch_object</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-fetch-object">
<refnamediv>
<refname>ingres_fetch_object</refname>
<refpurpose>1行分の結果をオブジェクトとして取得する</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>object</type><methodname>ingres_fetch_object</methodname>
<methodparam><type>int</type><parameter>
<replaceable><optional>result_type</optional></replaceable>
</parameter></methodparam>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
<para>
<function>ingres_fetch_object</function> は取得したレコード(行)を
オブジェクトとして返します。レコードがもうない場合は &false; を返し
ます。
</para>
<para>
この関数は <function>ingres_fetch_array</function> に似ていますが、
配列の代わりにオブジェクトが返されるという違いが一つあります。間
接的なアクセス、つまり、オフセットではなくフィールド名によりデー
タをアクセスすることのみが可能です(数値はプロパティ名としては使用
できません)。
</para>
<para>
オプションの引数 <parameter>result_type</parameter> は定数であり、
次の値のどれかとなります: INGRES_ASSOC, INGRES_NUM, INGRES_BOTH
</para>
<para>
速度の面では、この関数は <function>ingres_fetch_array</function>
と等価であり、<function>ingres_fetch_row</function> とほぼ同等で
す(違いは僅かです)。
</para>
<para>
<example>
<title><function>ingres_fetch_object</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
ingres_connect ($database, $user, $password);
ingres_query ("select * from table");
while ($row = ingres_fetch_object()) {
echo $row->user_id;
echo $row->fullname;
}
?>
]]>
</programlisting>
</example>
</para>
<para>
<function>ingres_query</function>,
<function>ingres_num_fields</function>,
<function>ingres_field_name</function>,
<function>ingres_fetch_array</function>,
<function>ingres_fetch_row</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-rollback">
<refnamediv>
<refname>ingres_rollback</refname>
<refpurpose>トランザクションをロールバックする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>ingres_rollback</methodname>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_rollback</function> は現在オープンされているトラ
ンザクションをロールバックし、トランザクションの間にデータベース
に行われた全ての変更をキャンセルします。
</para>
<para>
この関数は、トランザクションをクローズします。
<function>ingres_query</function> によりクエリを送信することによ
り、新規のトランザクションをオープンすることが可能です。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_commit</function>,
<function>ingres_autocommit</function> も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-commit">
<refnamediv>
<refname>ingres_commit</refname>
<refpurpose>トランザクションをコミットする</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>ingres_commit</methodname>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_commit</function> は現在オープンされているトラン
ザクションをオープンし、全ての変更をデータベースに保存します。
</para>
<para>
この関数はトランザクションをクローズします。
<function>ingres_query</function> によりクエリを送信することによ
り、新規のトランザクションをオープンすることが可能です。
</para>
<para>
トランザクションをオープンする前に
<function>ingres_autocommit</function> をコールすることにより、各
クエリの後に自動的にサーバ側でコミットを行うことも可能です。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_rollback</function>,
<function>ingres_autocommit</function>も参照下さい。
</para>
</refsect1>
</refentry>
<refentry id="function.ingres-autocommit">
<refnamediv>
<refname>ingres_autocommit</refname>
<refpurpose>autocommitをオンまたはオフに切替える</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>bool</type><methodname>ingres_autocommit</methodname>
<methodparam><type>resource</type><parameter>
<replaceable><optional>link</optional></replaceable>
</parameter></methodparam>
</methodsynopsis>
&warn.experimental.func;
<para>
<function>ingres_autocommit</function> は、サーバの "autocommit"
モードをオンまたはオフに切替えるために、トランザクションをオープ
ンする前(最初に<function>ingres_query</function>をコールする前ま
たは<function>ingres_rollback</function>または
<function>ingres_autocommit</function>をコールした直後)にコールさ
れます(スクリプトの実行開始には、autocommitモードはオフです)。
</para>
<para>
autocommit モードがオンの場合、各クエリはサーバにより自動的にコミッ
トされます。これは、<function>ingres_query</function> をコールし
た後に常に <function>ingres_commit</function> をコールすることと
等価です。
</para>
<para>
<function>ingres_query</function>,
<function>ingres_rollback</function>,
<function>ingres_commit</function>も参照下さい。
</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:
-->
|