cvs: phpdoc /ja/appendices migration4.xml /ja/functions com.xml dbx.xml fbsql.xml math.xml misc.xml oci8.xml pdf.xml var.xml xml.xml /ja/language
oop.xml /ja/pear standards.xml
| From: | Rui Hirokawa | Date: | Sun, 20 May 2001 07:43:03 +0000 |
| Subject: | cvs: phpdoc /ja/appendices migration4.xml /ja/functions com.xml dbx.xml fbsql.xml math.xml misc.xml oci8.xml pdf.xml var.xml xml.xml /ja/language oop.xml /ja/pear standards.xml |
||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969335443@lists.php.net to get a copy of this message | ||
hirokawa Sun May 20 00:43:03 2001 EDT
Modified files:
/phpdoc/ja/appendices migration4.xml
/phpdoc/ja/functions com.xml dbx.xml fbsql.xml math.xml misc.xml
oci8.xml pdf.xml var.xml xml.xml
/phpdoc/ja/language oop.xml
/phpdoc/ja/pear standards.xml
Log:
updated translation.
Index: phpdoc/ja/appendices/migration4.xml diff -u phpdoc/ja/appendices/migration4.xml:1.2 phpdoc/ja/appendices/migration4.xml:1.3 --- phpdoc/ja/appendices/migration4.xml:1.2 Tue Mar 13 14:59:45 2001 +++ phpdoc/ja/appendices/migration4.xml Sun May 20 00:43:01 2001 @@ -202,7 +202,7 @@ </section> <section> - <title>æ¨å¥¨ãããªã颿°ã¨æ¡å¼µDeprecate functions and extensions</title> + <title>æ¨å¥¨ãããªã颿°ã¨æ¡å¼µ</title> <para> Adabas ããã³ Solid ãã¼ã¿ãã¼ã¹æ¡å¼µã¯ããã¯ãæ¨å¥¨ããã¾ããã ä»å¾ã¯ãunified ODBC æ¡å¼µã代ããã«ä½¿ç¨ãã¦ä¸ããã Index: phpdoc/ja/functions/com.xml diff -u phpdoc/ja/functions/com.xml:1.5 phpdoc/ja/functions/com.xml:1.6 --- phpdoc/ja/functions/com.xml:1.5 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/com.xml Sun May 20 00:43:01 2001 @@ -1,13 +1,233 @@ <reference id="ref.com"> <title>Windowsç¨ã®COMãµãã¼ã颿°</title> <titleabbrev>COM</titleabbrev> - + <partintro> <simpara> 以ä¸ã®é¢æ°ã¯ãWindowsçã®PHPã§ã®ã¿å©ç¨å¯è½ã§ãããããã®é¢æ°ã¯ã PHP4ã§è¿½å ããã¾ããã </simpara> </partintro> + + <refentry id="class.com"> + <refnamediv> + <refname>COM</refname> + <refpurpose>COM class</refpurpose> + </refnamediv> + <refsynopsisdiv> + <synopsis>$obj = new <classname>COM</classname>("server.object")</synopsis> + </refsynopsisdiv> + <refsect1 id="class.com.class"> + <title>説æ</title> + <simpara> + COM ã¯ã©ã¹ã¯ãPHPã¹ã¯ãªããã«çµ±åããã (D)COMã³ã³ãã¼ãã³ãã®ã + ã¬ã¼ã ã¯ã¼ã¯ãæä¾ãã¾ãã + </simpara> + </refsect1> + <refsect1 id="class.com.constructor"> + <title>ã¡ã½ãã</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>COM::COM</function></funcdef> + <paramdef>string <parameter>module_name</parameter></paramdef> + <paramdef>string + <parameter><optional>server_name</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>codepage</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + COM ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ã ãã©ã¡ã¼ã¿: + <variablelist> + <varlistentry><term>module_name</term> + <listitem> + <simpara> + ãªã¯ã¨ã¹ããããã³ã³ãã¼ãã³ãã®ååã¾ãã¯ã¯ã©ã¹IDã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>server_name</term> + <listitem> + <simpara> + ã³ã³ãã¼ãã³ããåå¾ããDCOMãµã¼ãã®ååã + <literal>NULL</literal>ã®å ´åã«ã¯ã + <literal>localhost</literal>ãæå®ãããã¨ä»®å®ããã¾ãã + DCOMã使ç¨ããããã«ã¯ã<filename>php.ini</filename>ã§ + <constant>com.allow_dcom</constant> ã + <literal>TRUE</literal>ã«è¨å®ãã¦ããå¿ è¦ãããã¾ãã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>codepage</term> + <listitem> + <simpara> + PHPã®æååã®UNICODEæååã¸ã®å¤æããã³ãã®é夿ã§ä½¿ç¨ãã + ãã³ã¼ããã¼ã¸ãæå®ãã¾ãã使ç¨å¯è½ãªå¤ã¯ã + <constant>CP_ACP</constant>, <constant>CP_MACCP</constant>, + <constant>CP_OEMCP</constant>, + <constant>CP_SYMBOL</constant>, + <constant>CP_THREAD_ACP</constant>, + <constant>CP_UTF7</constant>, <constant>CP_UTF8</constant>ã§ + ãã + </simpara> + </listitem> + </varlistentry> + </variablelist> + </para> + <para> + <example id="example.com1"> + <title>COM ã®ä¾ (1)</title> + <programlisting role="php"> +// Wordãèµ·å +$word = new COM("word.application") or die("Unable to instanciate Word"); +print "Loaded Word, version {$word->Version}\n"; + +// åé¢ã«è¡¨ç¤º +$word->Visible = 1; + +// 空ã®ããã¥ã¡ã³ãããªã¼ãã³ +$word->Documents->Add(); + +// ä½ãåç´ãªä½æ¥ããã +$word->Selection->TypeText("This is a test..."); +$word->Documents[1]->SaveAs("Useless test.doc"); + +// Wordãéãã +$word->Quit(); + +// ãªãã¸ã§ã¯ããéæ¾ +$word->Release(); +$word = null; + </programlisting> + </example> + </para> + <para> + <example id="example.com2"> + <title>COM ã®ä¾ (2)</title> + <programlisting role="php"> +$conn = new COM("ADODB.Connection") or die("Cannot start ADO"); +$conn->Open("Provider=SQLOLEDB; Data Source=localhost; +Initial Catalog=database; User ID=user; Password=password"); + +$rs = $conn->Execute("SELECT * FROM sometable"); // Recordset + +$num_columns = $rs->Fields->Count(); +echo $num_columns . "\n"; + +for ($i=0; $i < $num_columns; $i++) +{ + $fld[$i] = $rs->Fields($i); +} + +$rowcount = 0; +while (!$rs->EOF) +{ + for ($i=0; $i < $num_columns; $i++) + { + echo $fld[$i]->value . "\t"; + } + echo "\n"; + $rowcount++; // è¡ã«ã¦ã³ã¿ãå¢ãã + $rs->MoveNext(); +} + +$rs->Close(); +$conn->Close(); + +$rs->Release(); +$conn->Release(); + +$rs = null; +$conn = null; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + <refentry id="class.variant"> + <refnamediv> + <refname>VARIANT</refname> + <refpurpose>VARIANT ã¯ã©ã¹</refpurpose> + </refnamediv> + <refsynopsisdiv> + <synopsis>$vVar = new <classname>VARIANT</classname>($var)</synopsis> + </refsynopsisdiv> + <refsect1 id="class.variant.class"> + <title>説æ</title> + <simpara> + VARIANTæ§é ä½ã«å¤æ°ãã©ããããããã®ç°¡åãªã³ã³ããã¯ã©ã¹ã + </simpara> + </refsect1> + <refsect1 id="class.variant.constructor"> + <title>ã¡ã½ãã</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>VARIANT::VARIANT</function></funcdef> + <paramdef>mixed + <parameter><optional>value</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>type</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>codepage</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + VARIANT ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ã ãã©ã¡ã¼ã¿: + <variablelist> + <varlistentry><term>value</term> + <listitem> + <simpara> + åæå¤ãçç¥ããå ´åã«ã¯ãVT_EMPTYãªãã¸ã§ã¯ãã使ããã¾ãã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>type</term> + <listitem> + <simpara> + VARIANTãªãã¸ã§ã¯ãã®contentåãæå®ãã¾ãã使ç¨å¯è½ãªå¤ã¯ã + <constant>VT_UI1</constant>, <constant>VT_UI2</constant>, + <constant>VT_UI4</constant>, <constant>VT_I1</constant>, + <constant>VT_I2</constant>, <constant>VT_I4</constant>, + <constant>VT_R4</constant>, <constant>VT_R8</constant>, + <constant>VT_INT</constant>, <constant>VT_UINT</constant>, + <constant>VT_BOOL</constant>, <constant>VT_ERROR</constant>, + <constant>VT_CY</constant>, <constant>VT_DATE</constant>, + <constant>VT_BSTR</constant>, + <constant>VT_DECIMAL</constant>, + <constant>VT_UNKNOWN</constant>, + <constant>VT_DISPATCH</constant>, + <constant>VT_VARIANT</constant>ã§ãããããã®å¤ã¯ç¸äºã«æä»ç + ã§ãããå¤ããããã¨ãæå®ããããã« + <constant>VT_BYREF</constant>ãçµã¿åããããã¨ãå¯è½ã§ãã + çç¥ãããå ´åã«ã¯ã<parameter>value</parameter> ã®åã使ç¨ã + ãã¾ãããã®ä»ã®æ å ±ã«ã¤ãã¦ã¯ãMSDNã©ã¤ãã©ãªãåç §ä¸ããã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>codepage</term> + <listitem> + <simpara> + PHPã®æååã®UNICODEæååã¸ã®å¤æããã³ãã®é夿ã§ä½¿ç¨ãã + ãã³ã¼ããã¼ã¸ãæå®ãã¾ãã使ç¨å¯è½ãªå¤ã¯ã + <constant>CP_ACP</constant>, <constant>CP_MACCP</constant>, + <constant>CP_OEMCP</constant>, + <constant>CP_SYMBOL</constant>, + <constant>CP_THREAD_ACP</constant>, + <constant>CP_UTF7</constant>, <constant>CP_UTF8</constant>ã§ + ãã + </simpara> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + </refentry> <refentry id="function.com-load"> <refnamediv> @@ -27,12 +247,22 @@ <replaceable><optional>server name</optional></replaceable> </parameter> </paramdef> + <paramdef>int + <parameter> + <optional>codepage</optional> + </parameter> + </paramdef> </funcprototype> </funcsynopsis> <para> <function>com_load</function>ã¯ãæ°è¦ã®COMã³ã³ãã¼ãã³ãã使ãã ãã®ã³ã³ãã¼ãã³ãã¸ã®ãªãã¡ã¬ã³ã¹ãè¿ãã¾ãã失æããå ´åã« <literal>false</literal>ãè¿ãã¾ãã + Possible values for <parameter>codepage</parameter> are + <constant>CP_ACP</constant>, <constant>CP_MACCP</constant>, + <constant>CP_OEMCP</constant>, <constant>CP_SYMBOL</constant>, + <constant>CP_THREAD_ACP</constant>, <constant>CP_UTF7</constant> + and <constant>CP_UTF8</constant>. </para> </refsect1> </refentry> @@ -180,10 +410,50 @@ </funcsynopsis> <para> <parameter>com_object</parameter>ãæãCOMã³ã³ãã¼ãã³ãã® - <parameter>property</parameter>ã®å¤ãè¨å®ãã¾ãã - <parameter>property</parameter>ãè¨å®ããã¦ããå ´åã« - <literal>true</literal>ãè¿ãã¾ããã¨ã©ã¼æã« - <literal>false</literal>ãè¿ãã¾ãã + <parameter>property</parameter>ã®å¤ãè¨å®ãã¾ããæåæã«æ°è¦ã«è¨ + å®ãããå¤ãã¨ã©ã¼ã®å ´åã«<literal>false</literal>ãè¿ãã¾ãã + </para> + </refsect1> + </refentry> + + <refentry id="function.com-addref"> + <refnamediv> + <refname>com_addref</refname> + <refpurpose> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãå¢ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>com_addref</function></funcdef> + <void/> + </funcprototype> + </funcsynopsis> + <para> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãå¢ããã¾ãã + </para> + </refsect1> + </refentry> + + <refentry id="function.com-release"> + <refnamediv> + <refname>com_release</refname> + <refpurpose> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãæ¸ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>com_release</function></funcdef> + <void/> + </funcprototype> + </funcsynopsis> + <para> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãæ¸ããã¾ãã </para> </refsect1> </refentry> Index: phpdoc/ja/functions/dbx.xml diff -u phpdoc/ja/functions/dbx.xml:1.3 phpdoc/ja/functions/dbx.xml:1.4 --- phpdoc/ja/functions/dbx.xml:1.3 Sat May 5 21:54:00 2001 +++ phpdoc/ja/functions/dbx.xml Sun May 20 00:43:01 2001 @@ -214,7 +214,7 @@ </para> <para> Microsoft SQL Serverã«é¢ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯ãå®éã«ã¯ - mssql_get_last_message 颿°ã®çµæã¨ãªãã¾ãã + <function>mssql_get_last_message</function> 颿°ã®çµæã¨ãªãã¾ãã </para> </note> </refsect1> Index: phpdoc/ja/functions/fbsql.xml diff -u phpdoc/ja/functions/fbsql.xml:1.1 phpdoc/ja/functions/fbsql.xml:1.2 --- phpdoc/ja/functions/fbsql.xml:1.1 Sat May 5 21:54:00 2001 +++ phpdoc/ja/functions/fbsql.xml Sun May 20 00:43:01 2001 @@ -1,5 +1,5 @@ <reference id="ref.fbsql"> - <title>FrontBase 颿°</title> + <title>FrontBase functions</title> <titleabbrev>FrontBase</titleabbrev> <partintro> <simpara> @@ -23,7 +23,9 @@ 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"> @@ -92,7 +94,7 @@ <funcsynopsis> <funcprototype> <funcdef>bool <function>fbsql_autocommit</function></funcdef> - <paramdef>int + <paramdef>resource <parameter>link_identifier</parameter> </paramdef> <paramdef>bool @@ -106,6 +108,7 @@ <function>fbsql_autocommit</function> returns the current autocommit status. if the optional OnOff parameter is given the auto commit status will be changed. + </para> </refsect1> </refentry> @@ -120,7 +123,7 @@ <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_change_user</function></funcdef> + <funcdef>resource <function>fbsql_change_user</function></funcdef> <paramdef>string <parameter>user</parameter></paramdef> <paramdef>string <parameter>password</parameter></paramdef> <paramdef>string @@ -141,21 +144,22 @@ optional parameter link_identifier. If a database is specified, this will default or current database after the user has been changed. If the new user and password authorization fails, - the current connected user stays active.</para> + the current connected user stays active. + </para> </refsect1> </refentry> <refentry id="function.fbsql-close"> <refnamediv> <refname>fbsql_close</refname> - <refpurpose>FrontBase æ¥ç¶ãéãã</refpurpose> + <refpurpose>Close FrontBase connection</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_close</function></funcdef> - <paramdef>int + <funcdef>boolean <function>fbsql_close</function></funcdef> + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -163,7 +167,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on error. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on error. </para> <para> <function>fbsql_close</function> closes the connection to the FrontBase server that's associated with the specified link @@ -175,17 +179,15 @@ as non-persistent open links are automatically closed at the end of the script's execution. </para> - <note> - </note> <example> - <title>FrontBase close example</title> + <title><function>fbsql_close</function> example</title> <programlisting role="php"> <?php $link = fbsql_connect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); print ("Connected successfully"); fbsql_close ($link); -?> +?> </programlisting> </example> <para> @@ -198,15 +200,13 @@ <refentry id="function.fbsql-connect"> <refnamediv> <refname>fbsql_connect</refname> - <refpurpose> - FrontBase ãµã¼ãã¸ã®æ¥ç¶ããªã¼ãã³ãã - </refpurpose> + <refpurpose>Open a connection to a FrontBase Server</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_connect</function></funcdef> + <funcdef>resource <function>fbsql_connect</function></funcdef> <paramdef>string <parameter> <optional>hostname @@ -248,7 +248,7 @@ <function>fbsql_close</function>. </para> <example> - <title>FrontBase connect example</title> + <title><function>fbsql_connect</function> example</title> <programlisting role="php"> <?php @@ -260,7 +260,8 @@ ?> </programlisting> </example> - <para> See also + <para> + See also <function>fbsql_pconnect</function>, and <function>fbsql_close</function>. </para> @@ -270,15 +271,15 @@ <refentry id="function.fbsql-create-db"> <refnamediv> <refname>fbsql_create_db</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ã使ãã</refpurpose> + <refpurpose>Create a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_create_db</function></funcdef> + <funcdef>bool <function>fbsql_create_db</function></funcdef> <paramdef>string <parameter>database name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -291,17 +292,17 @@ identifier. </para> <example> - <title>FrontBase create database example</title> + <title><function>fbsql_create_db</function> example</title> <programlisting role="php"> <?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); if (fbsql_create_db ("my_db")) { - print ("Database created successfully\n"); + print("Database created successfully\n"); } else { - printf ("Error creating database: %s\n", fbsql_error ()); + printf("Error creating database: %s\n", fbsql_error ()); } -?> +?> </programlisting> </example> <para> @@ -313,19 +314,19 @@ <refentry id="function.fbsql-data-seek"> <refnamediv> <refname>fbsql_data_seek</refname> - <refpurpose>å é¨çãªçµæãã¤ã³ã¿ãç§»åãã</refpurpose> + <refpurpose>Move internal result pointer</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_data_seek</function></funcdef> - <paramdef>int <parameter>result_identifier</parameter></paramdef> + <funcdef>bool <function>fbsql_data_seek</function></funcdef> + <paramdef>resource <parameter>result_identifier</parameter></paramdef> <paramdef>int <parameter>row_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on failure. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on failure. </para> <para> <function>fbsql_data_seek</function> moves the internal row @@ -338,7 +339,7 @@ </para> <example> - <title>FrontBase data seek example</title> + <title><function>fbsql_data_seek</function> example</title> <programlisting role="php"> <?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") @@ -347,7 +348,7 @@ fbsql_select_db ("samp_db") or die ("Could not select database"); - $query = "SELECT last_name, first_name FROM friends"; + $query = "SELECT last_name, first_name FROM friends;"; $result = fbsql_query ($query) or die ("Query failed"); @@ -362,11 +363,11 @@ if(!($row = fbsql_fetch_object ($result))) continue; - printf ("%s %s<BR>\n", $row->last_name, $row->first_name); + printf("%s %s<BR>\n", $row->last_name, $row->first_name); } fbsql_free_result ($result); -?> +?> </programlisting> </example> </refsect1> @@ -375,16 +376,16 @@ <refentry id="function.fbsql-db-query"> <refnamediv> <refname>fbsql_db_query</refname> - <refpurpose>FrontBaseã¯ã¨ãªãéä¿¡ãã</refpurpose> + <refpurpose>Send a FrontBase query</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_db_query</function></funcdef> + <funcdef>resource <function>fbsql_db_query</function></funcdef> <paramdef>string <parameter>database</parameter></paramdef> <paramdef>string <parameter>query</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -393,7 +394,7 @@ </funcsynopsis> <para> Returns: A positive FrontBase result identifier to the query result, - or false on error. + or <literal>FALSE</literal> on error. </para> <para> <function>fbsql_db_query</function> selects a database and @@ -412,15 +413,15 @@ <refentry id="function.fbsql-drop-db"> <refnamediv> <refname>fbsql_drop_db</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ãç ´æ£(åé¤)ãã</refpurpose> + <refpurpose>Drop (delete) a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_drop_db</function></funcdef> + <funcdef>bool <function>fbsql_drop_db</function></funcdef> <paramdef>string <parameter>database_name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -428,7 +429,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on failure. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on failure. </para> <para> <function>fbsql_drop_db</function> attempts to drop (remove) an @@ -441,16 +442,15 @@ <refentry id="function.fbsql-errno"> <refnamediv> <refname>fbsql_errno</refname> - <refpurpose> - ç´è¿ã®FrontBaseå¦çã«ããã¨ã©ã¼ã¡ãã»ã¼ã¸çªå·ãè¿ã - </refpurpose> + <refpurpose>Returns the numerical value of the error message from previous + FrontBase operation</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_errno</function></funcdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -477,9 +477,9 @@ echo fbsql_errno().": ".fbsql_error()."<BR>"; fbsql_select_db("nonexistentdb"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -$conn = fbsql_query("SELECT * FROM nonexistenttable"); +$conn = fbsql_query("SELECT * FROM nonexistenttable;"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -?> +?> </programlisting> </informalexample> </para> @@ -493,16 +493,15 @@ <refentry id="function.fbsql-error"> <refnamediv> <refname>fbsql_error</refname> - <refpurpose> - ç´è¿ã®FrontBaseå¦çã«ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã®ããã¹ããè¿ã - </refpurpose> + <refpurpose>Returns the text of the error message from previous + FrontBase operation</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_error</function></funcdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -528,9 +527,9 @@ echo fbsql_errno().": ".fbsql_error()."<BR>"; fbsql_select_db("nonexistentdb"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -$conn = fbsql_query("SELECT * FROM nonexistenttable"); +$conn = fbsql_query("SELECT * FROM nonexistenttable;"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -?> +?> </programlisting> </informalexample> </para> @@ -545,7 +544,7 @@ <refnamediv> <refname>fbsql_fetch_array</refname> <refpurpose> - 飿³é åãæ°å¤é åãã¾ãã¯ä¸¡æ¹ã®é åã¨ãã¦çµæã¬ã³ã¼ããåå¾ãã + Fetch a result row as an associative array, a numeric array, or both. </refpurpose> </refnamediv> <refsect1> @@ -553,7 +552,7 @@ <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_array</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter> <optional>result_type</optional> @@ -562,7 +561,7 @@ </funcprototype> </funcsynopsis> <para> - Returns an array that corresponds to the fetched row, or false + Returns an array that corresponds to the fetched row, or <literal>FALSE</literal> if there are no more rows.</para> <para> <function>fbsql_fetch_array</function> is an extended version of @@ -598,7 +597,7 @@ <function>fbsql_fetch_row</function> and <function>fbsql_fetch_assoc</function>. </para> <example> - <title><function>fbsql_fetch_array</function></title> + <title><function>fbsql_fetch_array</function> example</title> <programlisting role="php"> <?php fbsql_connect ($host, $user, $password); @@ -610,7 +609,7 @@ echo "fullname: ".$row[1]."<br>\n"; } fbsql_free_result ($result); -?> +?> </programlisting> </example> </refsect1> @@ -620,7 +619,7 @@ <refnamediv> <refname>fbsql_fetch_assoc</refname> <refpurpose> - 飿³é åã¨ãã¦çµæã¬ã³ã¼ããåå¾ãã + Fetch a result row as an associative array </refpurpose> </refnamediv> <refsect1> @@ -628,12 +627,12 @@ <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_assoc</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns an associative array that corresponds to the fetched row, - or false if there are no more rows.</para> + or <literal>FALSE</literal> 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 @@ -659,7 +658,7 @@ <function>fbsql_fetch_row</function> and <function>fbsql_fetch_array</function>. </para> <example> - <title><function>fbsql_fetch_assoc</function></title> + <title><function>fbsql_fetch_assoc</function> example</title> <programlisting role="php"> <?php fbsql_connect ($host, $user, $password); @@ -669,7 +668,7 @@ echo $row["fullname"]; } fbsql_free_result ($result); -?> +?> </programlisting> </example> </refsect1> @@ -679,7 +678,7 @@ <refnamediv> <refname>fbsql_fetch_field</refname> <refpurpose> - çµæããã«ã©ã æ å ±ãåå¾ãããªãã¸ã§ã¯ãã¨ãã¦è¿ã + Get column information from a result and return as an object </refpurpose> </refnamediv> <refsect1> @@ -687,7 +686,7 @@ <funcsynopsis> <funcprototype> <funcdef>object <function>fbsql_fetch_field</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter> <optional>field_offset</optional> @@ -735,7 +734,7 @@ </itemizedlist> </para> <example> - <title><function>fbsql_fetch_field</function></title> + <title><function>fbsql_fetch_field</function> example</title> <programlisting role="php"> <?php fbsql_connect ($host, $user, $password) @@ -760,7 +759,7 @@ $i++; } fbsql_free_result ($result); -?> +?> </programlisting> </example> <para> @@ -773,7 +772,7 @@ <refnamediv> <refname>fbsql_fetch_lengths</refname> <refpurpose> - çµæã®ååºåã®é·ããå¾ã + Get the length of each output in a result </refpurpose> </refnamediv> <refsect1> @@ -781,16 +780,15 @@ <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_lengths</function></funcdef> - <paramdef>int - <parameter> - <optional>result</optional> - </parameter> + <paramdef>resource + <parameter><optional>result</optional></parameter> + </paramdef> </funcprototype> </funcsynopsis> <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. + or <literal>FALSE</literal> on error. </para> <para> <function>fbsql_fetch_lengths</function> stores the lengths of @@ -809,14 +807,14 @@ <refentry id="function.fbsql-fetch-object"> <refnamediv> <refname>fbsql_fetch_object</refname> - <refpurpose>ãªãã¸ã§ã¯ãã¨ãã¦çµæã¬ã³ã¼ããåå¾ãã</refpurpose> + <refpurpose>Fetch a result row as an object</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>object <function>fbsql_fetch_object</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter> <optional>result_type</optional> @@ -826,7 +824,7 @@ </funcsynopsis> <para> Returns an object with properties that correspond to the fetched - row, or false if there are no more rows. + row, or <literal>FALSE</literal> if there are no more rows. </para> <para> <function>fbsql_fetch_object</function> is similar to @@ -856,7 +854,7 @@ echo $row->fullname; } fbsql_free_result ($result); -?> +?> </programlisting> </example> </para> @@ -870,18 +868,18 @@ <refentry id="function.fbsql-fetch-row"> <refnamediv> <refname>fbsql_fetch_row</refname> - <refpurpose>æ°å¤é åã¨ãã¦çµæã¬ã³ã¼ããå¾ã</refpurpose> + <refpurpose>Get a result row as an enumerated array</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_row</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Returns: An array that corresponds to the fetched row, or false + Returns: An array that corresponds to the fetched row, or <literal>FALSE</literal> if there are no more rows. </para> <para> @@ -892,7 +890,7 @@ </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 + return the next row in the result set, or <literal>FALSE</literal> if there are no more rows. </para> <para> @@ -909,7 +907,7 @@ <refnamediv> <refname>fbsql_field_flags</refname> <refpurpose> - çµæã«ããã¦æå®ãããã£ã¼ã«ãã«é¢ãããã©ã°ãå¾ã + Get the flags associated with the specified field in a result </refpurpose> </refnamediv> <refsect1> @@ -917,7 +915,7 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_flags</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -934,7 +932,7 @@ <refnamediv> <refname>fbsql_field_name</refname> <refpurpose> - çµæã«ããã¦æå®ãããã£ã¼ã«ãã®ååãå¾ã + Get the name of the specified field in a result </refpurpose> </refnamediv> <refsect1> @@ -942,7 +940,7 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_name</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_index</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -993,7 +991,7 @@ <refnamediv> <refname>fbsql_field_len</refname> <refpurpose> - æå®ãããã£ã¼ã«ãã®é·ããå¾ã + Returns the length of the specified field </refpurpose> </refnamediv> <refsect1> @@ -1001,7 +999,7 @@ <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_field_len</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1016,15 +1014,15 @@ <refnamediv> <refname>fbsql_field_seek</refname> <refpurpose> - æå®ãããã£ã¼ã«ããªãã»ããã«çµæãã¤ã³ã¿ãè¨å®ãã + Set result pointer to a specified field offset </refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_field_seek</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <funcdef>bool <function>fbsql_field_seek</function></funcdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1044,7 +1042,7 @@ <refnamediv> <refname>fbsql_field_table</refname> <refpurpose> - æå®ãããã£ã¼ã«ãããããã¼ãã«ã®ååãå¾ã + Get name of the table the specified field is in </refpurpose> </refnamediv> <refsect1> @@ -1052,12 +1050,13 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_table</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - æå®ãããã£ã¼ã«ãããããã¼ãã«ã®ååãè¿ãã¾ãã + Returns the name of the table that the specifed field is + in. </para> </refsect1> </refentry> @@ -1066,7 +1065,7 @@ <refnamediv> <refname>fbsql_field_type</refname> <refpurpose> - çµæã®ä¸ã§æå®ãããã£ã¼ã«ãã®åãå¾ã + Get the type of the specified field in a result </refpurpose> </refnamediv> <refsect1> @@ -1074,7 +1073,7 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_type</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1086,13 +1085,13 @@ detailed in the <ulink url="&url.fbsql.docs;">FrontBase documentation</ulink>. <example> - <title>fbsql field types</title> + <title><function>fbsql_field_type</function> example</title> <programlisting role="php"> <?php -fbsql_connect ("localhost:3306"); +fbsql_connect ("localhost", "_SYSTEM", ""); fbsql_select_db ("wisconsin"); -$result = fbsql_query ("SELECT * FROM onek"); +$result = fbsql_query ("SELECT * FROM onek;"); $fields = fbsql_num_fields ($result); $rows = fbsql_num_rows ($result); $i = 0; @@ -1109,7 +1108,7 @@ } fbsql_close(); -?> +?> </programlisting> </example> </para> @@ -1119,13 +1118,13 @@ <refentry id="function.fbsql-free-result"> <refnamediv> <refname>fbsql_free_result</refname> - <refpurpose>çµæä¿æç¨ã®ã¡ã¢ãªãéæ¾ãã</refpurpose> + <refpurpose>Free result memory</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_free_result</function></funcdef> + <funcdef>bool <function>fbsql_free_result</function></funcdef> <paramdef>int <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1146,7 +1145,7 @@ <refnamediv> <refname>fbsql_insert_id</refname> <refpurpose> - ç´è¿ã®INSERTå¦çã§çæãããIDãå¾ã + Get the id generated from the previous INSERT operation </refpurpose> </refnamediv> <refsect1> @@ -1154,7 +1153,7 @@ <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_insert_id</function></funcdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1163,14 +1162,14 @@ </funcsynopsis> <para> <function>fbsql_insert_id</function> returns the ID generated for - an AUTO_INCREMENT column by the previous INSERT query using the + 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 AUTO_INCREMENT value. If you need to + 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> @@ -1178,22 +1177,10 @@ <para> The value of the FrontBase SQL function <literal>LAST_INSERT_ID()</literal> always contains the most - recently generated AUTO_INCREMENT value, and is not reset + recently generated DEFAULT UNIQUE value, and is not reset between queries. </para> </note> - <warning> - <para> - <function>fbsql_insert_id</function> converts the return type of - the native FrontBase C API function - <literal>fbsql_insert_id()</literal> to a type of - <literal>long</literal>. If your AUTO_INCREMENT column has - a column type of BIGINT, the value returned by - <function>fbsql_insert_id</function> will be incorrect. - Instead, use the internal FrontBase SQL function - <literal>LAST_INSERT_ID()</literal>. - </para> - </warning> </refsect1> </refentry> @@ -1201,15 +1188,15 @@ <refnamediv> <refname>fbsql_list_dbs</refname> <refpurpose> - FrontBaseãµã¼ãã§å©ç¨å¯è½ãªãã¼ã¿ãã¼ã¹ã®ä¸è¦§ãå¾ã + List databases available on a FrontBase server </refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_list_dbs</function></funcdef> - <paramdef>int + <funcdef>resource <function>fbsql_list_dbs</function></funcdef> + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1258,16 +1245,16 @@ <refentry id="function.fbsql-list-fields"> <refnamediv> <refname>fbsql_list_fields</refname> - <refpurpose>FrontBaseçµæãã£ã¼ã«ãã®ä¸è¦§ãå¾ã</refpurpose> + <refpurpose>List FrontBase result fields</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_list_fields</function></funcdef> + <funcdef>resource <function>fbsql_list_fields</function></funcdef> <paramdef>string <parameter>database_name</parameter></paramdef> <paramdef>string <parameter>table_name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1322,15 +1309,15 @@ <refentry id="function.fbsql-list-tables"> <refnamediv> <refname>fbsql_list_tables</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ã®ãã¼ãã«ä¸è¦§ãå¾ã</refpurpose> + <refpurpose>List tables in a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_list_tables</function></funcdef> + <funcdef>resource <function>fbsql_list_tables</function></funcdef> <paramdef>string <parameter>database</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1347,17 +1334,61 @@ </refsect1> </refentry> + <refentry id="function.fbsql-next-result"> + <refnamediv> + <refname>fbsql_next_result</refname> + <refpurpose>Move the internal result pointer to the next result</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool + <function>fbsql_next_result</function> + </funcdef> + <paramdef>int <parameter>result_id</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <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 <literal>TRUE</literal> if an additional result set was + available or <literal>FALSE</literal> othervise. + </para> + <example> + <title><function>fbsql_next_result</function> example</title> + <programlisting role="php"> +<?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> + <refpurpose>Get number of fields in result</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_num_fields</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -1376,14 +1407,14 @@ <refentry id="function.fbsql-num-rows"> <refnamediv> <refname>fbsql_num_rows</refname> - <refpurpose>çµæã®ã¬ã³ã¼ãæ°ãå¾ã</refpurpose> + <refpurpose>Get number of rows in result</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_num_rows</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -1399,7 +1430,7 @@ $link = fbsql_connect("localhost", "username", "password"); fbsql_select_db("database", $link); -$result = fbsql_query("SELECT * FROM table1", $link); +$result = fbsql_query("SELECT * FROM table1;", $link); $num_rows = fbsql_num_rows($result); echo "$num_rows Rows\n"; @@ -1422,21 +1453,16 @@ <refnamediv> <refname>fbsql_pconnect</refname> <refpurpose> - FrontBaseãµã¼ãã¸ã®æç¶çãªæ¥ç¶ããªã¼ãã³ãã + Open a persistent connection to a FrontBase Server </refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_pconnect</function></funcdef> + <funcdef>resource <function>fbsql_pconnect</function></funcdef> <paramdef>string - <parameter> - <optional>hostname - <optional>:port</optional> - <optional>:/path/to/socket</optional> - </optional> - </parameter> + <parameter><optional>hostname</optional></parameter> </paramdef> <paramdef>string <parameter><optional>username</optional></parameter> @@ -1448,25 +1474,22 @@ </funcsynopsis> <para> Returns: A positive FrontBase persistent link identifier on success, - or false on error. + or <literal>FALSE</literal> 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:port</parameter> = - 'localhost:3306', <parameter>username</parameter> = name of the - user that owns the server process and - <parameter>password</parameter> = empty password. + missing optional parameters: <parameter>host</parameter> = + 'localhost', <parameter>username</parameter> = "_SYSTEM" + and <parameter>password</parameter> = empty password. </para> <para> - The hostname string can also include a port - number. eg. "hostname:port" or a path to a socket - eg. ":/path/to/socket" for the localhost. - </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, @@ -1487,15 +1510,15 @@ <refentry id="function.fbsql-query"> <refnamediv> <refname>fbsql_query</refname> - <refpurpose>FrontBaseã¯ã¨ãªãéä¿¡ãã</refpurpose> + <refpurpose>Send a FrontBase query</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_query</function></funcdef> + <funcdef>resource <function>fbsql_query</function></funcdef> <paramdef>string <parameter>query</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter><optional>link_identifier</optional></parameter> </paramdef> </funcprototype> @@ -1511,27 +1534,27 @@ </para> <note> <para> - The query string should not end with a semicolon. + The query string shall always end with a semicolon. </para> </note> <para> - <function>fbsql_query</function> returns TRUE (non-zero) or FALSE + <function>fbsql_query</function> returns <literal>TRUE</literal> (non-zero) or <literal>FALSE</literal> to indicate whether or not the query succeeded. A return value - of TRUE means that the query was legal and could be executed by + of <literal>TRUE</literal> 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: + <function>fbsql_query</function> fails and returns <literal>FALSE</literal>: <example> - <title><function>fbsql_query</function></title> + <title><function>fbsql_query</function> example</title> <programlisting role="php"> <?php $result = fbsql_query ("SELECT * WHERE 1=1") or die ("Invalid query"); -?> +?> </programlisting> </example> </para> @@ -1539,19 +1562,19 @@ 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: + fails and returns <literal>FALSE</literal>: <example> - <title><function>fbsql_query</function></title> + <title><function>fbsql_query</function> example</title> <programlisting role="php"> <?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 + <function>fbsql_query</function> will also fail and return <literal>FALSE</literal> if you don't have permission to access the table(s) referenced by the query. </para> @@ -1593,7 +1616,7 @@ <funcsynopsis> <funcprototype> <funcdef>mixed <function>fbsql_result</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>row</parameter></paramdef> <paramdef>mixed <parameter> @@ -1635,15 +1658,15 @@ <refentry id="function.fbsql-select-db"> <refnamediv> <refname>fbsql_select_db</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ã鏿ãã</refpurpose> + <refpurpose>Select a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_select_db</function></funcdef> + <funcdef>resource <function>fbsql_select_db</function></funcdef> <paramdef>string <parameter>database_name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1651,7 +1674,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on error. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on error. </para> <para> <function>fbsql_select_db</function> sets the current active @@ -1662,6 +1685,14 @@ 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> @@ -1676,14 +1707,14 @@ <refentry id="function.fbsql-tablename"> <refnamediv> <refname>fbsql_tablename</refname> - <refpurpose>æå®ãããã£ã¼ã«ãã®ãã¼ãã«åãå¾ã</refpurpose> + <refpurpose>Get table name of field</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_tablename</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>i</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1694,10 +1725,10 @@ <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> Example</title> + <title><function>fbsql_tablename</function> example</title> <programlisting role="php"> <?php -fbsql_connect ("localhost:3306"); +fbsql_connect ("localhost", "_SYSTEM", ""); $result = fbsql_list_tables ("wisconsin"); $i = 0; while ($i < fbsql_num_rows ($result)) { @@ -1705,7 +1736,7 @@ echo $tb_names[$i] . "<BR>"; $i++; } -?> +?> </programlisting> </example> </para> @@ -1715,7 +1746,7 @@ <refentry id="function.fbsql-warnings"> <refnamediv> <refname>fbsql_warnings</refname> - <refpurpose>FrontBaseã®è¦åãæå¹ã¾ãã¯ç¡å¹ã«ãã</refpurpose> + <refpurpose>Enable or disable FrontBase warnings</refpurpose> </refnamediv> <refsect1> <title>説æ</title> @@ -1730,7 +1761,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true if warnings is turned on otherwise false. + Returns <literal>TRUE</literal> if warnings is turned on otherwise <literal>FALSE</literal>. </para> <para> <function>fbsql_warnings</function> enables or disables FrontBase Index: phpdoc/ja/functions/math.xml diff -u phpdoc/ja/functions/math.xml:1.17 phpdoc/ja/functions/math.xml:1.18 --- phpdoc/ja/functions/math.xml:1.17 Sat May 5 22:22:49 2001 +++ phpdoc/ja/functions/math.xml Sun May 20 00:43:01 2001 @@ -840,6 +840,24 @@ ããããæååã使ããå°æ°é¨ã®åã®ããã(".")ã®ä»£ããã« <parameter>dec_point</parameter>ã§ä¸ããããæååã使ãã¾ãã </para> + <para> + ä¾ãã°ããã©ã³ã¹èªè¡¨è¨ã§ã¯é叏尿°ç¹ä»¥ä¸ã¯2æ¡ã¨ããã«ã³ã(',')ã + å°æ°é¨ã®åºåãæåãã¹ãã¼ã¹ã1000ã®ä½æ¯ã®åºåãæåã¨ãã¦ä½¿ç¨ã + ã¾ããããã¯ã次ã®ããã«è¡ãã¾ãã + <informalexample> + <programlisting role="php"> +<?php + $nombre = 1234.56; + // è±èªè¡¨è¨ (ããã©ã«ã) + $english_format_number = number_format($nombre); + // 1,234.56 + // ãã©ã³ã¹èªè¡¨è¨ + $nombre_format_francais = number_format($nombre, 2, ',', ' '); + // 1 234,56 +?> + </programlisting> + </informalexample> + </para> </refsect1> </refentry> Index: phpdoc/ja/functions/misc.xml diff -u phpdoc/ja/functions/misc.xml:1.17 phpdoc/ja/functions/misc.xml:1.18 --- phpdoc/ja/functions/misc.xml:1.17 Sun Mar 18 08:36:45 2001 +++ phpdoc/ja/functions/misc.xml Sun May 20 00:43:01 2001 @@ -47,9 +47,9 @@ </funcsynopsis> <simpara> æ¥ç¶ã¹ãã¼ã¿ã¹ã®ããããã£ã¼ã«ããè¿ãã¾ãã - 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ããç« ã® - <link linkend="features.connection-handling">æ¥ç¶å¦ç</link> - ã«é¢ããè¨è¿°ãåç §ä¸ããã + 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ã + ãç« ã®<link linkend="features.connection-handling">æ¥ç¶å¦ç + </link>ã«é¢ããè¨è¿°ãåç §ä¸ããã </simpara> </refsect1> </refentry> @@ -69,10 +69,18 @@ </funcsynopsis> <simpara> ã¹ã¯ãªãããã¿ã¤ã ã¢ã¦ãããå ´åã«trueãè¿ãã¾ãã - 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ããç« ã® - <link linkend="features.connection-handling">æ¥ç¶å¦ç</link> - ã«é¢ããè¨è¿°ãåç §ä¸ããã </simpara> + <warning> + <title>éå»ã®é¢æ°</title> + <simpara> + ãã®é¢æ°ã¯ãéå»ã®ãã®ã§ããã4.0.5以éã«ã¯åå¨ãã¾ããã + </simpara> + </warning> + <simpara> + 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ã + ãç« ã®<link linkend="features.connection-handling">æ¥ç¶å¦ç + </link>ã«é¢ããè¨è¿°ãåç §ä¸ããã + </simpara> </refsect1> </refentry> @@ -217,8 +225,18 @@ </funcprototype> </funcsynopsis> <para> - <parameter>name</parameter> ã§æå®ããååã®å®æ°ãå®ç¾©ããã¦ããå ´åã« - trueããã®ä»ã®å ´åã«falseãè¿ãã¾ãã + <parameter>name</parameter> ã§æå®ããååã®å®æ°ãå®ç¾©ããã¦ãã + å ´åã«trueããã®ä»ã®å ´åã«falseãè¿ãã¾ãã + <example> + <title>宿°ã®ãã§ãã¯</title> + <programlisting role="php"> +<?php +if (defined("CONSTANT")){ // å¼ç¨ç¬¦ã§æ¬ããã¦ããå¿ è¦ãããã¾ã + echo CONSTANT; // + } +?> + </programlisting> + </example> </para> <para> <function>define</function>, @@ -268,7 +286,7 @@ </para> <para> <example> - <title>颿°ã使ç¨ãã <function>die</function> ã®ä¾</title> + <title>颿°ã使ç¨ãã<function>die</function>ã®ä¾</title> <programlisting role="php"> <?php @@ -296,7 +314,7 @@ <refentry id="function.eval"> <refnamediv> <refname>eval</refname> - <refpurpose>æååã PHP ã³ã¼ãã¨ãã¦è©ä¾¡ãã</refpurpose> + <refpurpose>æååãPHPã³ã¼ãã¨ãã¦è©ä¾¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> @@ -611,7 +629,8 @@ <refnamediv> <refname>ignore_user_abort</refname> <refpurpose> - ã¯ã©ã¤ã¢ã³ãæ¥ç¶ãæã¨ãªã£ãæã«ã¹ã¯ãªããã®å®è¡ã䏿ãããã©ãããè¨å®ãã + ã¯ã©ã¤ã¢ã³ãæ¥ç¶ãæã¨ãªã£ãæã«ã¹ã¯ãªããã®å®è¡ã䏿ãããã©ã + ããè¨å®ãã </refpurpose> </refnamediv> <refsect1> @@ -852,62 +871,6 @@ </refsect1> </refentry> - <refentry id="function.serialize"> - <refnamediv> - <refname>serialize</refname> - <refpurpose> - å¤ã®ä¿åå¯è½ãªè¡¨ç¾ãçæãã - </refpurpose> - </refnamediv> - <refsect1> - <title>説æ</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>serialize</function></funcdef> - <paramdef>mixed <parameter>value</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - <function>serialize</function> ã¯ã<parameter>value</parameter>ã® - ä¿åå¯è½ãªãã¤ãã¹ããªã¼ã 表ç¾ãå«ãæååãè¿ãã¾ãã - </simpara> - <simpara> - åãæ§é ã失ããã«PHPã®å¤ãä¿åã¾ãã¯æ¸¡ãéã«æå¹ã§ãã - </simpara> - <simpara> - ã·ãªã¢ã«åãããæååãPHPã®å¤ã«æ»ãã«ã¯ã - <function>unserialize</function>ã使ç¨ãã¦ä¸ããã - <function>serialize</function>ã¯å<type>integer</type>, - <type>double</type>,<type>string</type>,<type>array</type> - (夿¬¡å ),<type>object</type> - (ãªãã¸ã§ã¯ãããããã£ã¯ã·ãªã¢ã«åããã¾ãããã¡ã½ããã¯å¤±ããã¾ã) - ã«å¯¾å¿ãã¾ãã - </simpara> - <para> - <example> - <title><function>serialize</function>ã®ä¾</title> - <programlisting role="php"> -// $session_data ã¯ã«ã¬ã³ãã¦ã¼ã¶ã¼ã®ã»ãã·ã§ã³æ å ±ãå«ã夿¬¡å é åã -// ä¿æãã¦ãã¾ãããªã¯ã¨ã¹ãã®æå¾ã«ããããã¼ã¿ãã¼ã¹ã«ä¿åããããã« -// serialize() ã使ç¨ãã¾ãã - -$conn = odbc_connect("webdb", "php", "chicken"); -$stmt = odbc_prepare($conn, - "UPDATE sessions SET data = ? WHERE id = ?"); -$sqldata = array(serialize($session_data), $PHP_AUTH_USER); -if (!odbc_execute($stmt, &$sqldata)) { - $stmt = odbc_prepare($conn, - "INSERT INTO sessions (id, data) VALUES(?, ?)"); - if (!odbc_execute($stmt, &$sqldata)) { - /* ä½ãåé¡ããã£ãããã§ããBitch, whine and moan. */ - } -} - </programlisting> - </example> - </para> - </refsect1> - </refentry> - <refentry id="function.show-source"> <refnamediv> <refname>show_source</refname> @@ -978,9 +941,9 @@ <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>uniqid</function></funcdef> + <funcdef>int <function>uniqid</function></funcdef> <paramdef>string <parameter>prefix</parameter></paramdef> - <paramdef>boolean + <paramdef>bool <parameter> <replaceable><optional>lcg</optional></replaceable> </parameter> @@ -988,11 +951,11 @@ </funcprototype> </funcsynopsis> <simpara> - <function>uniqid</function>ã¯ãããªç§åä½ã®ç¾å¨æå»ã«åºã¥ã - å é è¾ï¼prefixï¼ãä»ããã¦ãã¼ã¯ãªIDãè¿ãã¾ãã - ããã¤ãã®ãã¹ãä¸ã§åæã«IDãçæãããå ´åã - å ¨ãåãããªç§ã®IDãçæãããã®ãé²ãã®ã«prefixãæç¨ã§ãã - <parameter>prefix</parameter>ã«ã¯114æåã¾ã§ã®é·ããæå®ãããã¨ãã§ãã¾ãã + <function>uniqid</function>ã¯ãããªç§åä½ã®ç¾å¨æå»ã«åºã¥ãå é è¾ + ï¼prefixï¼ãä»ããã¦ãã¼ã¯ãªIDãè¿ãã¾ããããã¤ãã®ãã¹ãä¸ã§å + æã«IDãçæãããå ´åãå ¨ãåãããªç§ã®IDãçæãããã®ãé²ãã® + ã«prefixãæç¨ã§ãã<parameter>prefix</parameter>ã«ã¯114æåã¾ã§ + ã®é·ããæå®ãããã¨ãã§ãã¾ãã </simpara> <simpara> ãªãã·ã§ã³ã® <parameter>lcg</parameter> ãã©ã¡ã¼ã¿ã true ã®å ´åã @@ -1006,14 +969,14 @@ </simpara> <note> <simpara> - <parameter>lcg</parameter> ãã©ã¡ã¼ã¿ã¯ã - PHP 4ã¾ãã¯PHP 3.0.13以éã§ã®ã¿ä½¿ç¨å¯è½ã§ãã + <parameter>lcg</parameter> ãã©ã¡ã¼ã¿ã¯ãPHP 4ã¾ãã¯PHP 3.0.13以 + éã§ã®ã¿ä½¿ç¨å¯è½ã§ãã </simpara> </note> <para> - ã¦ãã¼ã¯ãªIDã¾ãã¯ãã¼ã¯ã³ãå¿ è¦ãªå ´åãããã¦ã - ãããã¯ã¼ã¯çµç±ã§ã¦ã¼ã¶ã¼ã«ãã®ãã¼ã¯ã³ã渡ããã¨ããå ´åã - 次ã®ä¾ã®ããã«ããã®ãæ¨å¥¨ããã¾ãã + ã¦ãã¼ã¯ãªIDã¾ãã¯ãã¼ã¯ã³ãå¿ è¦ãªå ´åãããã¦ããããã¯ã¼ã¯çµç± + ã§ã¦ã¼ã¶ã¼ã«ãã®ãã¼ã¯ã³ã渡ããã¨ããå ´å(ä¾ãã°ãã»ãã·ã§ã³ã¯ã + ãã¼)ãæ¬¡ã®ä¾ã®ããã«ããã®ãæ¨å¥¨ããã¾ãã <informalexample> <programlisting role="php"> $token = md5 (uniqid ("")); // ã©ã³ãã è¦ç´ ãªã @@ -1074,57 +1037,6 @@ </refsect1> </refentry> - <refentry id="function.unserialize"> - <refnamediv> - <refname>unserialize</refname> - <refpurpose>ä¿åç¨è¡¨ç¾ãã PHP ã®å¤ãçæãã</refpurpose> - </refnamediv> - <refsect1> - <title>説æ</title> - <funcsynopsis> - <funcprototype> - <funcdef>mixed <function>unserialize</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - <function>unserialize</function> ã¯ãã·ãªã¢ã«åããã夿° - (<function>serialize</function> ãåç §) ãã¨ããPHP 夿°å¤ã« - æ»ã夿ãè¡ãã¾ãã夿ãããå¤ãè¿ããã¾ãããã®å¤ã¯ã - <type>integer</type>, <type>double</type>, - <type>string</type>, <type>array</type> , <type>object</type> - ã¨ãããã¨ãå¯è½ã§ãã - ãªãã¸ã§ã¯ããã·ãªã¢ã«åãããå ´åã - è¿ãå¤ã«ãã®ã¡ã½ããã¯ä¿åããã¦ãã¾ããã - </simpara> - <para> - <example> - <title><function>unserialize</function>ã®ä¾</title> - <programlisting role="php"> -// ããã§ããã¼ã¿ãã¼ã¹ãã $session_data ã«ã»ãã·ã§ã³ãã¼ã¿ããã¼ã -// ããããã« unserialize() ã使ç¨ãã¾ãã -// ãã®ä¾ã¯ã<function>serialize</function> ã§è¨è¿°ãããä¾ãè£è¶³ãããã®ã§ãã - -$conn = odbc_connect("webdb", "php", "chicken"); -$stmt = odbc_prepare($conn, "SELECT data FROM sessions WHERE id = ?"); -$sqldata = array($PHP_AUTH_USER); -if (!odbc_execute($stmt, &$sqldata) || !odbc_fetch_into($stmt, &$tmp)) { - // å®è¡ã¾ãã¯åå¾ã失æããå ´åã空ã®é åã§åæåãã¾ã - $session_data = array(); -} else { - // $tmp[0] ã«ã·ãªã¢ã«åããããã¼ã¿ãä¿æãã¦ããå¿ è¦ãããã¾ãã - $session_data = unserialize($tmp[0]); - if (!is_array($session_data)) { - // ä½ãåé¡ããã£ãããã空ã®é åã§åæåãã¾ãã - $session_data = array(); - } -} - </programlisting> - </example> - </para> - </refsect1> - </refentry> - <refentry id="function.usleep"> <refnamediv> <refname>usleep</refname> Index: phpdoc/ja/functions/oci8.xml diff -u phpdoc/ja/functions/oci8.xml:1.13 phpdoc/ja/functions/oci8.xml:1.14 --- phpdoc/ja/functions/oci8.xml:1.13 Sat May 5 22:22:49 2001 +++ phpdoc/ja/functions/oci8.xml Sun May 20 00:43:01 2001 @@ -1336,8 +1336,8 @@ var_dump($data); } -OCIFreeCursor ($stmt); -OCIFreeStatement ($curs); +OCIFreeStatement ($stmt); +OCIFreeCursor ($curs); OCILogoff ($conn); ?> </programlisting> Index: phpdoc/ja/functions/pdf.xml diff -u phpdoc/ja/functions/pdf.xml:1.21 phpdoc/ja/functions/pdf.xml:1.22 --- phpdoc/ja/functions/pdf.xml:1.21 Wed Mar 28 05:45:34 2001 +++ phpdoc/ja/functions/pdf.xml Sun May 20 00:43:02 2001 @@ -1987,6 +1987,33 @@ </refsect1> </refentry> + <refentry id="function.pdf-setcolor"> + <refnamediv> + <refname>PDF_setcolor</refname> + <refpurpose>å¡ãã¤ã¶ãè²ããã³è¼ªéè²ãCMYKã§è¨å®ãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>PDF_setcolor</function></funcdef> + <paramdef>int <parameter>pdf object</parameter></paramdef> + <paramdef>string <parameter>type</parameter></paramdef> + <paramdef>string <parameter>colorspace</parameter></paramdef> + <paramdef>double <parameter>c1</parameter></paramdef> + <paramdef>double <parameter>c2</parameter></paramdef> + <paramdef>double <parameter>c3</parameter></paramdef> + <paramdef>double <parameter>c4</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ã«ã¬ã³ãã®ã«ã©ã¼ã¹ãã¼ã¹ã¨è²ãè¨å®ãã¾ãã + <parameter>type</parameter>ã¯ã"fill", "stroke", "both" ã®ã©ãã + ã§ãã + </para> + </refsect1> + </refentry> + <refentry id="function.pdf-setdash"> <refnamediv> <refname>pdf_setdash</refname> Index: phpdoc/ja/functions/var.xml diff -u phpdoc/ja/functions/var.xml:1.26 phpdoc/ja/functions/var.xml:1.27 --- phpdoc/ja/functions/var.xml:1.26 Fri Apr 27 19:20:55 2001 +++ phpdoc/ja/functions/var.xml Sun May 20 00:43:02 2001 @@ -791,6 +791,11 @@ ãªãã¸ã§ã¯ãã«é¢ãã¦ãåæ§ã®è¡¨ç¤ºå½¢å¼ã¨ãªãã¾ãã </simpara> <simpara> + <function>print_r</function>ã¯ãé åãã¤ã³ã¿ãçµç«¯ã¾ã§ç§»åããã + ã¨ã«æ³¨æãã¦ä¸ããããã¤ã³ã¿ãæåã«æ»ãããã« + <function>reset</function>ã使ç¨ãã¦ä¸ããã + </simpara> + <simpara> <function>print_r</function>ã <function>var_dump</function>ã¨æ¯è¼ãã¦ã¿ã¦ä¸ããã </simpara> @@ -817,6 +822,75 @@ </refsect1> </refentry> + <refentry id="function.serialize"> + <refnamediv> + <refname>serialize</refname> + <refpurpose> + å¤ã®ä¿åå¯è½ãªè¡¨ç¾ãçæãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>serialize</function></funcdef> + <paramdef>mixed <parameter>value</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <function>serialize</function> ã¯ã<parameter>value</parameter>ã® + ä¿åå¯è½ãªãã¤ãã¹ããªã¼ã 表ç¾ãå«ãæååãè¿ãã¾ãã + </simpara> + <simpara> + åãæ§é ã失ããã«PHPã®å¤ãä¿åã¾ãã¯æ¸¡ãéã«æå¹ã§ãã + </simpara> + <simpara> + ã·ãªã¢ã«åãããæååãPHPã®å¤ã«æ»ãã«ã¯ã + <function>unserialize</function>ã使ç¨ãã¦ä¸ããã + <function>serialize</function>ã¯å<type>integer</type>, + <type>double</type>,<type>string</type>,<type>array</type> + (夿¬¡å ),<type>object</type> + (ãªãã¸ã§ã¯ãããããã£ã¯ã·ãªã¢ã«åããã¾ãããã¡ã½ããã¯å¤±ããã¾ã) + ã«å¯¾å¿ãã¾ãã + </simpara> + <note> + <para> + PHP 3ã§ã¯ãã¡ã½ããã¯ã·ãªã¢ã«åããããªãã¸ã§ã¯ããéã·ãªã¢ã«å + ããéã«ä¿åããã¾ãããPHP 4ã§ã¯ãã®å¶éã¯åãé¤ããããããã㣠+ ã¨ã¡ã½ããã®ä¸¡æ¹ãä¿åãã¾ããããè©³ç´°ãªæ å ±ã«ã¤ãã¦ã¯ã + <link linkend="language.oop">ãªãã¸ã§ã¯ãã¨ã¯ã©ã¹</link> ã® + <link linkend="language.oop.serialization">ãªãã¸ã§ã¯ãã®ã·ãªã¢ + ã«å</link>ã®ç¯ãåç §ä¸ããã + </para> + </note> + <para> + <example> + <title><function>serialize</function>ã®ä¾</title> + <programlisting role="php"> +// $session_data ã¯ã«ã¬ã³ãã¦ã¼ã¶ã¼ã®ã»ãã·ã§ã³æ å ±ãå«ã夿¬¡å é åã +// ä¿æãã¦ãã¾ãããªã¯ã¨ã¹ãã®æå¾ã«ããããã¼ã¿ãã¼ã¹ã«ä¿åããããã« +// serialize() ã使ç¨ãã¾ãã + +$conn = odbc_connect("webdb", "php", "chicken"); +$stmt = odbc_prepare($conn, + "UPDATE sessions SET data = ? WHERE id = ?"); +$sqldata = array(serialize($session_data), $PHP_AUTH_USER); +if (!odbc_execute($stmt, &$sqldata)) { + $stmt = odbc_prepare($conn, + "INSERT INTO sessions (id, data) VALUES(?, ?)"); + if (!odbc_execute($stmt, &$sqldata)) { + /* ä½ãåé¡ããã£ãããã§ããBitch, whine and moan. */ + } +} + </programlisting> + </example> + </para> + <para> + <function>unserialize</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.settype"> <refnamediv> <refname>settype</refname> @@ -898,6 +972,69 @@ </refsect1> </refentry> + <refentry id="function.unserialize"> + <refnamediv> + <refname>unserialize</refname> + <refpurpose>ä¿åç¨è¡¨ç¾ãã PHP ã®å¤ãçæãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>unserialize</function></funcdef> + <paramdef>string <parameter>str</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <function>unserialize</function> ã¯ãã·ãªã¢ã«åããã夿° + (<function>serialize</function> ãåç §) ãã¨ããPHP 夿°å¤ã« + æ»ã夿ãè¡ãã¾ãã夿ãããå¤ãè¿ããã¾ãããã®å¤ã¯ã + <type>integer</type>, <type>double</type>, + <type>string</type>, <type>array</type> , <type>object</type> + ã¨ãããã¨ãå¯è½ã§ãããªãã¸ã§ã¯ããã·ãªã¢ã«åãããå ´åãè¿ãå¤ + ã«ãã®ã¡ã½ããã¯ä¿åããã¦ãã¾ããã + </simpara> + <note> + <para> + PHP 3ã§ã¯ãã¡ã½ããã¯ã·ãªã¢ã«åããããªãã¸ã§ã¯ããéã·ãªã¢ã«å + ããéã«ä¿åããã¾ãããPHP 4ã§ã¯ãã®å¶éã¯åãé¤ããããããã㣠+ ã¨ã¡ã½ããã®ä¸¡æ¹ãä¿åãã¾ããããè©³ç´°ãªæ å ±ã«ã¤ãã¦ã¯ã + <link linkend="language.oop">ãªãã¸ã§ã¯ãã¨ã¯ã©ã¹</link> ã® + <link linkend="language.oop.serialization">ãªãã¸ã§ã¯ãã®ã·ãªã¢ + ã«å</link>ã®ç¯ãåç §ä¸ããã + </para> + </note> + <para> + <example> + <title><function>unserialize</function>ã®ä¾</title> + <programlisting role="php"> +// ããã§ããã¼ã¿ãã¼ã¹ãã $session_data ã«ã»ãã·ã§ã³ãã¼ã¿ããã¼ã +// ããããã« unserialize() ã使ç¨ãã¾ãã +// ãã®ä¾ã¯ã<function>serialize</function> ã§è¨è¿°ãããä¾ãè£è¶³ãããã®ã§ãã + +$conn = odbc_connect("webdb", "php", "chicken"); +$stmt = odbc_prepare($conn, "SELECT data FROM sessions WHERE id = ?"); +$sqldata = array($PHP_AUTH_USER); +if (!odbc_execute($stmt, &$sqldata) || !odbc_fetch_into($stmt, &$tmp)) { + // å®è¡ã¾ãã¯åå¾ã失æããå ´åã空ã®é åã§åæåãã¾ã + $session_data = array(); +} else { + // $tmp[0] ã«ã·ãªã¢ã«åããããã¼ã¿ãä¿æãã¦ããå¿ è¦ãããã¾ãã + $session_data = unserialize($tmp[0]); + if (!is_array($session_data)) { + // ä½ãåé¡ããã£ãããã空ã®é åã§åæåãã¾ãã + $session_data = array(); + } +} + </programlisting> + </example> + </para> + <para> + <function>serialize</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.unset"> <refnamediv> <refname>unset</refname> Index: phpdoc/ja/functions/xml.xml diff -u phpdoc/ja/functions/xml.xml:1.10 phpdoc/ja/functions/xml.xml:1.11 --- phpdoc/ja/functions/xml.xml:1.10 Thu Jan 4 22:29:05 2001 +++ phpdoc/ja/functions/xml.xml Sun May 20 00:43:02 2001 @@ -396,18 +396,18 @@ } function startElement($parser, $name, $attribs){ - print "&lt;<font color=\"#0000cc\">$name</font>"; + print "&lt;<font color=\"#0000cc\">$name</font>"; if (sizeof($attribs)) { while (list($k, $v) = each($attribs)) { - print " <font color=\"#009900\">$k</font>=\"<font - color=\"#990000\">$v</font>\""; + print " <font color=\"#009900\">$k</font>=\"<font + color=\"#990000\">$v</font>\""; } } print "&gt;"; } function endElement($parser, $name){ - print "&lt;/<font color=\"#0000cc\">$name</font>&gt;"; + print "&lt;/<font color=\"#0000cc\">$name</font>&gt;"; } function characterData($parser, $data){ @@ -432,7 +432,7 @@ function defaultHandler($parser, $data){ if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - printf('<font color="#aa00aa">%s</font>', htmlspecialchars($data)); + printf('<font color="#aa00aa">%s</font>', htmlspecialchars($data)); } else { printf('<font size="-1">%s</font>', htmlspecialchars($data)); } @@ -1059,7 +1059,7 @@ </para> <para> å¤é¨ã¨ã³ãã£ãã£å®£è¨ã®è¨è¿°ç¨å®ç¾©ã«é¢ãã¦ã¯ã - <ulink url="&url.rec-xml;#sec-external-ent">XML 1.0 仿§ã® 4.2.2 + <ulink url="&url.rec-xml;#sec-external-ent">XML 1.0 仿§ã® 4.2.2 ç¯</ulink>ãåç §ä¸ããã </para> <para> @@ -1179,7 +1179,7 @@ > | <parameter>publicId</parameter >}></programlisting> è¡¨è¨æ³å®£è¨ã®å®ç¾©ã«é¢ãã¦ã¯ã - <ulink url="&url.rec-xml;#Notations">XML 1.0 仿§ã® 4.7 ç¯</ulink> + <ulink url="&url.rec-xml;#Notations">XML 1.0 仿§ã® 4.7 ç¯</ulink> ãåç §ä¸ããã </para> <para> Index: phpdoc/ja/language/oop.xml diff -u phpdoc/ja/language/oop.xml:1.7 phpdoc/ja/language/oop.xml:1.8 --- phpdoc/ja/language/oop.xml:1.7 Sat Mar 10 21:56:44 2001 +++ phpdoc/ja/language/oop.xml Sun May 20 00:43:02 2001 @@ -38,11 +38,40 @@ ãã®ä¾ã¯ãç± ã®ä¸ã®ç©ã¨ç± ã«ã¢ã¤ãã ãå ãããé¤ãããããäºã¤ã®é¢æ°ã¸ã® 飿³é åãããªã Cart ã¨ããååã®ã¯ã©ã¹ãå®ç¾©ãã¾ãã </para> + + <caution> + <simpara> + 以ä¸ã®æ³¨ææ¸ãã¯PHP 4ã«é¢ãããã®ã§ãã + </simpara> + + <simpara> + åå<literal>stdClass</literal>ã¯ãZendã«ããå é¨çã«ä½¿ç¨ãããä¿ + åããã¦ãã¾ããPHPã§<literal>stdClass</literal>ã¨ããååã®ã¯ã© + ã¹ã使ç¨ãããã¨ã¯ã§ãã¾ããã + </simpara> + + <simpara> + The function names <literal>__sleep</literal> and + <literal>__wakeup</literal> are magical in PHP classes. You + cannot have functions with these names in any of your + classes unless you want the magic functionality associated + with them. See below for more information. + </simpara> + + <simpara> + PHP reserves all function names starting with __ as magical. + It is recommended that you do not use function names with + __ in PHP unless you want some documented magic functionality. + </simpara> + </caution> + <note> <simpara> PHP 4ã§ã¯ã夿°<literal>var</literal>ã«ã¤ãã¦ã¯å®æ°ã«ããåæåã® - ã¿ãå¯è½ã§ãã宿°ä»¥å¤ã§åæåãè¡ãå ´åã«ã¯ã³ã³ã¹ãã©ã¯ã¿ãä½¿ç¨ - ãã¦ä¸ããã + ã¿ãå¯è½ã§ãã宿°ä»¥å¤ã§åæåãè¡ãå ´åã«ã¯åæå颿°ãå¿ è¦ã§ãã + ãã®åæå颿°ã¯ããªãã¸ã§ã¯ããã¯ã©ã¹ããæ§ç¯ãããéã«èªåçã« + ã³ã¼ã«ããã¾ãããã®ãããªé¢æ°ã¯ã³ã³ã¹ãã©ã¯ã¿ã¨å¼ã°ãã¾ãã(ä»¥ä¸ + åç §) </simpara> <informalexample> <programlisting role="php"> @@ -69,32 +98,96 @@ </informalexample> </note> <para> - ã¯ã©ã¹ã¯åãã¤ã¾ããå®éã®å¤æ°ã®éåã§ãã - new æ¼ç®åã«ããææã®åã®å¤æ°ã使ããå¿ è¦ãããã¾ãã + ã¯ã©ã¹ã¯åãã¤ã¾ããå®éã®å¤æ°ã®éåã§ãã<literal>new</literal>æ¼ + ç®åã«ããææã®åã®å¤æ°ã使ããå¿ è¦ãããã¾ãã </para> <informalexample> <programlisting role="php"> -$cart = new Cart; -$cart->add_item("10", 1); + $cart = new Cart; + $cart->add_item("10", 1); + + $another_cart = new Cart; + $another_cart->add_item("0815", 3); </programlisting> </informalexample> <para> - ãã®ä¾ã¯ãã¯ã©ã¹ Cart ã®ãªãã¸ã§ã¯ã $cart ã使ãã¾ãã - ãªãã¸ã§ã¯ãã®é¢æ° add_item() ãçªå·10 ã®ç©ãç± ã«å ããããã«ã³ã¼ã«ãã - ã¦ãã¾ãã + ãã®ä¾ã¯ãã¯ã©ã¹Cartã®ãªãã¸ã§ã¯ã $cartããã³$another_cartã使 + ãã¾ãã$cartãªãã¸ã§ã¯ãã®é¢æ° add_item()ãååçªå·10ã®ååä¸ã¤ã + ã«ã¼ãã«è¿½å ããã¦ãã¾ããååçªå·0815ã®åå3ã¤ã$another_cartã«è¿½ + å ããã¦ãã¾ãã </para> + <para> - ã¯ã©ã¹ã¯ãä»ã®ã¯ã©ã¹ãæ¡å¼µãããã¨ã«ãã使ãããã¨ãã§ãã¾ãã - æ¡å¼µã¾ãã¯æ´¾çã¯ã©ã¹ã¯ãåºåºã¯ã©ã¹ã®å ¨ã¦ã®å¤æ°ã¨é¢æ°ãããã¦ã - æ¡å¼µããéã®å®ç¾©ã«ããå ãããããã®ãä¿æãã¦ãã¾ãã - ãã®å®ç¾©ã¯ãextends ãã¼ã¯ã¼ãã«ããè¡ãªããã¨ãã§ãã¾ãã - å¤éç¶æ¿ã¯ãµãã¼ãããã¦ãã¾ããã + Both, $cart and $another_cart, have functions add_item(), + remove_item() and a variable items. These are distinct + functions and variables. You can think of the objects as + something similar to directories in a filesystem. In a + filesystem you can have two different files README.TXT, as + long as they are in different directories. Just like with + directories where you'll have to type the full pathname in + order to reach each file from the toplevel directory, you + have to specify the complete name of the function you want + to call: In PHP terms, the toplevel directory would be the + global namespace, and the pathname separator would be ->. + Thus, the names $cart->items and $another_cart->items + name two different variables. Note that the variable is + named $cart->items, not $cart->$items, that is, a + variable name in PHP has only a single dollar sign. </para> - + <informalexample> <programlisting role="php"> +// correct, single $ +$cart->items = array("10" => 1); + +// invalid, because $cart->$items becomes $cart->"" +$cart->$items = array("10" => 1); + +// correct, but may or may not be what was intended: +// $cart->$myvar becomes $ncart->items +$myvar = 'items'; +$cart->$myvar = array("10" => 1); + </programlisting> + </informalexample> + + <para> + Within a class definition, you do not know under which name the object will + be accessible in your program: At the time the Cart class was + written, it was unknown that the object will be named $cart or + $another_cart later. Thus, you cannot write $cart->items within + the Cart class itself. Instead, in order to be able to access it's own + functions and variables from within a class, one can use the + pseudo-variable $this which can be read as 'my own' or + 'current object'. Thus, '$this->items[$artnr] += $num' can + be read as 'add $num to the $artnr counter of my own items + array' or 'add $num to the $artnr counter of the items array + within the current object'. + </para> + </sect1> + + <sect1 id="keyword.extends"> + <title><literal>extends</literal></title> + + <para> + Often you need classes with similar variables and functions + to another existing class. In fact, it is good practice to + define a generic class which can be used in all your + projects and adapt this class for the needs of each of your + specific projects. To facilitate this, Classes can be + extensions of other classes. The extended or derived class + has all variables and functions of the base class (this is + called 'inheritance' despite the fact that nobody died) and what + you add in the extended definition. It is not possible to + substract from a class, that is, to undefine any existing + functions or variables. An extended class is always dependent + on a single base class, that is, multiple inheritance is + not supported. Classes are extended using the keyword 'extends'. + </para> + + <informalexample> + <programlisting role="php"> class Named_Cart extends Cart { var $owner; @@ -107,7 +200,7 @@ <para> ãã®ä¾ã¯ãCart ã®å ¨ã¦ã®å¤æ°åã³é¢æ°ã«å ãã¦å¤æ° $owner 㨠- 颿° $set_owner ãä¿æããã¯ã©ã¹ Named_Cart ãå®ç¾©ãã¦ãã¾ãã + 颿° set_owner() ãä¿æããã¯ã©ã¹ Named_Cart ãå®ç¾©ãã¦ãã¾ãã ãã®å®ç¾©ã«ãããååä»ãã®ç± ãéå¸¸ã®ææ®µã§ä½æããç± ã®ä¿æè ã è¨å®ãããå¾ãããããã¨ãã§ãã¾ãã ååä»ãã®ç± ã§å ã®ç± ã¯ã©ã¹ã®é¢æ°ã使ããã¨ãå¯è½ã§ãã @@ -122,35 +215,31 @@ </programlisting> </informalexample> - <para> - ã¯ã©ã¹ã«ããã颿°ã®ä¸ã§ã¯ã夿° $this ã¯ãã®ãªãã¸ã§ã¯ãèªèº«ãæ - å³ãã¾ãããªãã¸ã§ã¯ãã®ä¸ã§ã¯ãä½ããã®ã¯ã©ã¹å¤æ°ã颿°ã«ã¢ã¯ã»ã¹ - ãããå ´åã« $this->something ã使ãå¿ è¦ãããã¾ãããªãã¸ã§ã¯ãã® - å é¨ã¾ãã¯å¤é¨ã®å ´åããã®ãªãã¸ã§ã¯ãã®ããããã£ã«ã¢ã¯ã»ã¹ããé - ã« $ ã¯ä¸è¦ã§ãã - </para> - - <informalexample> - <programlisting role="php"> -$ncart->owner = "chris"; // $ ã¯ä¸è¦ + </sect1> -$ncart->$owner = "chris"; -// $ncart->$owner = $ncart->"" ãªã®ã§ããã¯èª¤ã + <sect1 id="language.oop.constructor"> + <title><literal>ã³ã³ã¹ãã©ã¯ã¿</literal></title> -$myvar = 'owner'; -$ncart->$myvar = "chris"; -// $ncart->$myvar = $ncart->ownerãªã®ã§ããã¯æå¹ - </programlisting> - </informalexample> + <caution> + <simpara> + In PHP 3 and PHP 4 constructors behave differently. The PHP 4 + semantics are strongly preferred. + </simpara> + </caution> <para> - ã³ã³ã¹ãã©ã¯ã¿ã¯ãã¯ã©ã¹ã®æ°ããã¤ã³ã¹ã¿ã³ã¹ã使ããéã« - èªåçã«ã³ã¼ã«ãããã¯ã©ã¹é¢æ°ã§ãã - 颿°ã¯ãã¯ã©ã¹ã¨åãååãæããéã«ã³ã³ã¹ãã©ã¯ã¿ã¨ãªãã¾ãã + ã³ã³ã¹ãã©ã¯ã¿ã¯ã<literal>new</literal>ã«ããã¯ã©ã¹ã®æ°ããã¤ã³ã¹ + ã¿ã³ã¹ã使ããéã«èªåçã«ã³ã¼ã«ãããã¯ã©ã¹é¢æ°ã§ãã + PHP 3ã§ã¯ããã颿°ããã¯ã©ã¹åã¨åãååãæãã¦ããå ´åã«ã³ã³ã¹ + ãã©ã¯ã¿ã«ãªãã¾ãããPHP 4ã§ã¯ããã颿°ãããã®ã³ã³ã¹ãã©ã¯ã¿ã + å®ç¾©ããã¦ããã¯ã©ã¹ã¨åãååãæãã¦ããå ´åã«ã³ã³ã¹ãã©ã¯ã¿ã«ãª + ãã¾ãããããã®éãã¯å ãã§ãããéè¦ãªéããããã¾ãã(以ä¸ãå + ç §) </para> - + <informalexample> <programlisting role="php"> +// Works in PHP 3 and PHP 4. class Auto_Cart extends Cart { function Auto_Cart () { $this->add_item ("10", 1); @@ -162,13 +251,16 @@ <para> ãã®ä¾ã¯ãCart ã«ã³ã³ã¹ãã©ã¯ã¿ãå ããã¯ã©ã¹ Auto_Cart ãå®ç¾©ãã¦ãã¾ãã ãã®ã³ã³ã¹ãã©ã¯ã¿ã¯ã"new" ã«ããæ°ãã Auto_Cart ã使ããã度㫠- ç± ã« 10 çªã®ç©ãä¸ã¤ä¿æããããã«åæåãã¾ãã - ã³ã³ã¹ãã©ã¯ã¿ã¯ããªãã·ã§ã³ã¨ãã¦å¼æ°ãã¨ãã¾ãã - ããã«ãããã³ã³ã¹ãã©ã¯ã¿ã¯é常ã«ä¾¿å©ãªãã®ã¨ãªãã¾ãã + ç± ã«10çªã®ç©ãä¸ã¤ä¿æããããã«åæåãã¾ããã³ã³ã¹ãã©ã¯ã¿ã¯ã㪠+ ãã·ã§ã³ã¨ãã¦å¼æ°ãã¨ãã¾ããããã«ãããã³ã³ã¹ãã©ã¯ã¿ã¯é常ã«ä¾¿ + å©ãªãã®ã¨ãªãã¾ããTo be able to still use the class + without parameters, all parameters to constructors should be + made optional by providing default values. </para> <informalexample> <programlisting role="php"> +// Works in PHP 3 and PHP 4. class Constructor_Cart extends Cart { function Constructor_Cart ($item = "10", $num = 1) { $this->add_item ($item, $num); @@ -184,18 +276,378 @@ $different_cart = new Constructor_Cart ("20", 17); </programlisting> </informalexample> - + <caution> <simpara> - æ´¾çã¯ã©ã¹ã®å ´åãæ´¾çã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ãã³ã¼ã«ãããæã«ã - 親ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ãèªåçã«ã³ã¼ã«ãããã¨ãããã¨ã¯ããã¾ - ããã + In PHP 3, derived classes and constructors have a number of + limitations. The following examples should be read carefully + to understand these limitations. + </simpara> + </caution> + + <informalexample> + <programlisting role="php"> +class A { + function A() { + echo "I am the constructor of A.<br>\n"; + } +} + +class B extends A { + function C() { + "I am a regular function.<br>\n"; + } +} + +// no constructor is being called in PHP 3. +$b = new B; + </programlisting> + </informalexample> + + <para> + In PHP 3, no constructor is being called in the above example. + The rule in PHP 3 is: 'A constructor is a function of the same + name as the class.'. The name of the class is B, and there is + no function called B() in class B. Nothing happens. + </para> + + <para> + This is fixed in PHP 4 by introducing another rule: If a class + has no constructor, the constructor of the base class is being + called, if it exists. The above example would have printed + 'I am the constructor of A.<br>' in PHP 4. + </para> + + <informalexample> + <programlisting role="php"> +class A { + function A() { + echo "I am the constructor of A.<br>\n"; + } + + function B() { + echo "I am a regular function named B in class A.<br>\n"; + echo "I am not a constructor in A.<br>\n"; + } +} + +class B extends A { + function C() { + echo "I am a regular function.<br>\n"; + } +} + +// This will call B() as a constructor. +$b = new B; + </programlisting> + </informalexample> + + <para> + In PHP 3, the function B() in class A will suddenly become a + constructor in class B, although it was never intended to be. + The rule in PHP 3 is: 'A constructor is a function of the same + name as the class.'. PHP 3 does not care if the function is + being defined in class B, or if it has been inherited. + </para> + + <para> + This is fixed in PHP 4 by modifying the rule to: 'A constructor + is a function of the same name as the class it is being defined + in.'. Thus in PHP 4, the class B would have no constructor function + of its own and the constructor of the base class would have been + called, printing 'I am the constructor of A.<br>'. + </para> + + <caution> + <simpara> + Neither PHP 3 nor PHP 4 call constructors of the base class + automatically from a constructor of a derived class. It is + your responsibility to propagate the call to constructors + upstream where appropriate. </simpara> </caution> + + <note> + <simpara> + There are no destructors in PHP 3 or PHP 4. You may use + <function>register_shutdown_function</function> instead + to simulate most effects of destructors. + </simpara> + </note> + + <para> + Destructors are functions that are called automatically + when a variable is destroyed, either with <function>unset</function> + or by simply going out of scope. There are no destructors + in PHP. + </para> </sect1> - - <sect1 id="language.oop.newref"> - <title>ã³ã³ã¹ãã©ã¯ã¿ã®ä¸ã§ã®åç §</title> + + <sect1 id="keyword.paamayim_nekudotayim"><!-- :-) --> + <title><literal>::</literal></title> + + <caution> + <simpara> + The following is valid for PHP 4 only. + </simpara> + </caution> + + <para> + Sometimes it is useful to refer to functions and variables + in base classes or to refer to functions in classes that + have not yet any instances. The :: operator is being used + for this. + </para> + + <informalexample> + <programlisting role="php"> +class A { + function example() { + echo "I am the original function A::example().<br>\n"; + } +} + +class B extends A { + function example() { + echo "I am the redefined function B::example().<br>\n"; + A::example(); + } +} + +// there is no object of class A. +// this will print +// I am the original function A::example().<br> +A::example(); + +// create an object of class B. +$b = new B; + +// this will print +// I am the redefined function B::example().<br> +// I am the original function A::example().<br> +$b->example(); + </programlisting> + </informalexample> + + <para> + The above example calls the function example() in + class A, but there is no object of class A, so that + we cannot write $a->example() or similar. Instead we + call example() as a 'class function', that is, as a + function of the class itself, not any object of that + class. + </para> + + <para> + There are class functions, but there are no class variables. + In fact, there is no object at all at the time of the call. + Thus, a class function may not use any object variables (but + it can use local and global variables), and it may no use + $this at all. + </para> + + <para> + In the above example, class B redefines the function example(). + The original definition in class A is shadowed + and no longer available, unless you are refering specifically + to the implementation of example() in class A using the + ::-operator. Write A::example() to do this (in fact, you + should be writing parent::example(), as shown in the next + section). + </para> + + <para> + In this context, there is a current object and it may + have object variables. Thus, when used from WITHIN an + object function, you may use $this and object variables. + </para> + + </sect1> + + <sect1 id="keyword.parent"> + <title><literal>親ã¯ã©ã¹</literal></title> + + <para> + You may find yourself writing code that refers to + variables and functions in base classes. This is + particularly true if your derived class is a refinement + or specialisation of code in your base class. + </para> + + <para> + Instead of using the literal name of the base class in your + code, you should be using the special name + <literal>parent</literal>, which refers to the name of your + base class as given in the <literal>extends</literal> + declation of your class. By doing this, you avoid using the + name of your base class in more than one place. Should + your inheritance tree change during implementation, the + change is easily made by simply changing the + <literal>extends</literal> declaration of your class. + </para> + + <informalexample> + <programlisting role="php"> +class A { + function example() { + echo "I am A::example() and provide basic functionality.<br>\n"; + } +} + +class B extends A { + function example() { + echo "I am B::example and provide additional functionality().<br>\n"; + parent::example(); + } +} + +$b = new B; + +// This will call B::example(), which will in turn call A::example(). +$b->example(); + </programlisting> + </informalexample> + </sect1> + + <sect1 id="language.oop.serialization"> + <title>Serializing objects - objects in sessions</title> + + <note> + <simpara> + In PHP 3, objects will lose their class association + throughout the process of serialization and unserialization. + The resulting variable is of type object, but has no class + and no methods, thus it is pretty useless (it has become + just like an array with a funny syntax). + </simpara> + </note> + + <caution> + <simpara> + The following information is valid for PHP 4 only. + </simpara> + </caution> + + <para> + <function>serialize</function> returns a string containing a + byte-stream representation of any value that can be stored in + PHP. <function>unserialize</function> can use this string to + recreate the original variable values. Using serialize to + save an object will save all variables in an object. The + functions in an object will not be saved, only the name of + the class. + </para> + + <para> + In order to be able to <function>unserialize</function> an + object, the class of that object needs to be defined. That + is, if you have an object $a of class A on page1.php and + serialize this, you'll get a string that refers to class A + and contains all values of variabled contained in $a. If + you want to be able to unserialize this on page2.php, + recreating $a of class A, the definition of class A must + be present in page2.php. This can be done for example + by storing the class defintion of class A in an include + file and including this file in both page1.php and page2.php. + </para> + + <informalexample> + <programlisting role="php"> +classa.inc: + class A { + var $one = 1; + + function show_one() { + echo $this->one; + } + } + +page1.php: + include("classa.inc"); + + $a = new A; + $s = serialize($a); + // store $s somewhere where page2.php can find it. + $fp = fopen("store", "w"); + echo $s; + fclose($fp); + +page2.php: + // this is needed for the unserialize to work properly. + include("classa.inc"); + + $s = implode("", @file("store")); + unserialize($s); + + // now use the function show_one of the $a object. + $a->show_one(); + </programlisting> + </informalexample> + + <para> + If you are using sessions and use <function>session_register</function> + to register objects, these objects are serialized automatically + at the end of each PHP page, and are unserialized automatically on + each of the following pages. This basically means that these objects + can show up on any of your pages once they become part of your + session. + </para> + + <para> + It is strongly recommended that you include the class + definitions of all such registered objects on all of your + pages, even if you do not actually use these classes on all + of your pages. If you don't and an object is being + unserialized without its class definition being present, it + will lose its class association and become an object of class + <literal>stdClass</literal> without any functions available + at all, that is, it will become quite useless. + </para> + + <para> + So if the in the example above $a became part of a session by + running <literal>session_register("a")</literal>, you should + include the file <literal>classa.inc</literal> on all of your + pages, not only page1.php and page2.php. + </para> + </sect1> + + <sect1 id="language.oop.magic-functions"> + <title>The magic functions <literal>__sleep</literal> and <literal>__wakeup</literal></title> + + <para> + <function>serialize</function> checks if your class has a function with + the magic name <literal>__sleep</literal>. If so, that function is + being run prior to any serialization. It can clean up the object + and is supposed to return an array with the names of all variables + of that object that should be serialized. + </para> + + <para> + The intended use of <literal>__sleep</literal> is to close any + database connections that object may have, committing pending + data or perform similar cleanup tasks. Also, the function is + useful if you have very large objects which need not be + saved completely. + </para> + + <para> + Conversely, <function>unserialize</function> checks for the + presence of a function with the magic name + <literal>__wakeup</literal>. If present, this function can + reconstruct any ressources that object may have. + </para> + + <para> + The intended use of <literal>__wakeup</literal> is to + reestablish any database connections that may have been lost + during serialization and perform other reinitialization + tasks. + </para> + </sect1> + + <sect1 id="language.oop.newref"> + <title>ã³ã³ã¹ãã©ã¯ã¿ã®å é¨ã§ã®åç §</title> <para> ã³ã³ã¹ãã©ã¯ã¿ã®ä¸ã§åç §ã使ããã¨çµæãæ··ä¹±ããå¯è½æ§ãããã¾ãã æ¬ç¯ã§ã¯ãã¥ã¼ããªã¢ã«å½¢å¼ã§èª¬æãã¾ããããã®åé¡ãé¿ããããã«å½¹ @@ -219,14 +671,14 @@ echo "<br>",$this->Name; } - function setName($name) { - $this->Name = $name; + function setName($name) { + $this->Name = $name; } } - </programlisting> - </informalexample> - </para> - + </programlisting> + </informalexample> + </para> + <para> ã³ãã¼æ¼ç®å <literal>=</literal> ã«ãã使ããã <varname>$bar1</varname> 㨠åç §æ¼ç®å <literal>=&</literal> @@ -276,7 +728,7 @@ </note> ä¸è¨ã®è¨è¿°ãæ£ãããã¨ã示ãããã«ä»¥ä¸ã®ã³ã¼ããè¦ã¦ã¿ã¾ãããã - <informalexample> + <informalexample> <programlisting role="php"> // ããã§ãname ã夿´ãã¦ã¿ã¾ããã©ããªãã§ãããã? // $bar 㨠$globalref[0] ã®ä¸¡æ¹å ±ååãå¤ããã¨äºæ³ããããããã¾ãã... @@ -298,22 +750,23 @@ $globalref[1]->echoName(); /* åºå: -set from outside set from outside */ + set from outside + set from outside */ - </programlisting> + </programlisting> </informalexample> </para> <para> - å¥ã®æå¾ã®ä¾ã«ã¤ãã¦èãã¦ã¿ã¦ä¸ããã - + æå¾ã«å¥ã®ä¾ã«ã¤ãã¦èãã¦ã¿ã¦ä¸ããã + <informalexample> <programlisting role="php"> - + class a { function a($i) { - $this->value = $i; - // ããã§åç §ã使ãå¿ è¦ããªãçç±ãèãã¦ã¿ã¦ä¸ãã - $this->b = new b($this); + $this->value = $i; + // ããã§åç §ã使ãå¿ è¦ããªãçç±ãèãã¦ã¿ã¦ä¸ãã + $this->b = new b($this); } function createRef() { @@ -366,7 +819,7 @@ </informalexample> </para> </sect1> - + </chapter> <!-- Keep this comment at the end of the file Index: phpdoc/ja/pear/standards.xml diff -u phpdoc/ja/pear/standards.xml:1.4 phpdoc/ja/pear/standards.xml:1.5 --- phpdoc/ja/pear/standards.xml:1.4 Fri Apr 13 07:03:33 2001 +++ phpdoc/ja/pear/standards.xml Sun May 20 00:43:02 2001 @@ -1,6 +1,12 @@ <chapter id="pear.standards"> <title>PEAR ã³ã¼ãã£ã³ã°æ¨æº</title> - + <note> + <simpara> + PEARã³ã¼ãã£ã³ã°æ¨æº(PEAR Coding Standards)ã¯ãPHPã¨å ±ã«é å¸ããã + ããPEARã®ã¤ã³ã¹ãã¼ã«ãã¼ã«ã«ãããã¦ã³ãã¼ãå¯è½ã§ãããã«ãããã + PEARã«ã¨ããã¾ããã³ã¼ãã«é©ç¨ãã¾ãã + </simpara> + </note> <sect1 id="pear.standards.indenting"> <title>ã¤ã³ãã³ã</title> <para> @@ -14,7 +20,10 @@ (setq tab-width 4 c-basic-offset 4 c-hanging-comment-ender-p nil - indent-tabs-mode nil)) + indent-tabs-mode + (not + (and (string-match "/\\(PEAR\\|pear\\)/" (buffer-file-name)) + (string-match "\.php$" (buffer-file-name)))))) </programlisting> </para> <para>
Index: phpdoc/ja/appendices/migration4.xml diff -u phpdoc/ja/appendices/migration4.xml:1.2 phpdoc/ja/appendices/migration4.xml:1.3 --- phpdoc/ja/appendices/migration4.xml:1.2 Tue Mar 13 14:59:45 2001 +++ phpdoc/ja/appendices/migration4.xml Sun May 20 00:43:01 2001 @@ -202,7 +202,7 @@ </section> <section> - <title>æ¨å¥¨ãããªã颿°ã¨æ¡å¼µDeprecate functions and extensions</title> + <title>æ¨å¥¨ãããªã颿°ã¨æ¡å¼µ</title> <para> Adabas ããã³ Solid ãã¼ã¿ãã¼ã¹æ¡å¼µã¯ããã¯ãæ¨å¥¨ããã¾ããã ä»å¾ã¯ãunified ODBC æ¡å¼µã代ããã«ä½¿ç¨ãã¦ä¸ããã Index: phpdoc/ja/functions/com.xml diff -u phpdoc/ja/functions/com.xml:1.5 phpdoc/ja/functions/com.xml:1.6 --- phpdoc/ja/functions/com.xml:1.5 Thu Jan 4 22:29:04 2001 +++ phpdoc/ja/functions/com.xml Sun May 20 00:43:01 2001 @@ -1,13 +1,233 @@ <reference id="ref.com"> <title>Windowsç¨ã®COMãµãã¼ã颿°</title> <titleabbrev>COM</titleabbrev> - + <partintro> <simpara> 以ä¸ã®é¢æ°ã¯ãWindowsçã®PHPã§ã®ã¿å©ç¨å¯è½ã§ãããããã®é¢æ°ã¯ã PHP4ã§è¿½å ããã¾ããã </simpara> </partintro> + + <refentry id="class.com"> + <refnamediv> + <refname>COM</refname> + <refpurpose>COM class</refpurpose> + </refnamediv> + <refsynopsisdiv> + <synopsis>$obj = new <classname>COM</classname>("server.object")</synopsis> + </refsynopsisdiv> + <refsect1 id="class.com.class"> + <title>説æ</title> + <simpara> + COM ã¯ã©ã¹ã¯ãPHPã¹ã¯ãªããã«çµ±åããã (D)COMã³ã³ãã¼ãã³ãã®ã + ã¬ã¼ã ã¯ã¼ã¯ãæä¾ãã¾ãã + </simpara> + </refsect1> + <refsect1 id="class.com.constructor"> + <title>ã¡ã½ãã</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>COM::COM</function></funcdef> + <paramdef>string <parameter>module_name</parameter></paramdef> + <paramdef>string + <parameter><optional>server_name</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>codepage</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + COM ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ã ãã©ã¡ã¼ã¿: + <variablelist> + <varlistentry><term>module_name</term> + <listitem> + <simpara> + ãªã¯ã¨ã¹ããããã³ã³ãã¼ãã³ãã®ååã¾ãã¯ã¯ã©ã¹IDã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>server_name</term> + <listitem> + <simpara> + ã³ã³ãã¼ãã³ããåå¾ããDCOMãµã¼ãã®ååã + <literal>NULL</literal>ã®å ´åã«ã¯ã + <literal>localhost</literal>ãæå®ãããã¨ä»®å®ããã¾ãã + DCOMã使ç¨ããããã«ã¯ã<filename>php.ini</filename>ã§ + <constant>com.allow_dcom</constant> ã + <literal>TRUE</literal>ã«è¨å®ãã¦ããå¿ è¦ãããã¾ãã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>codepage</term> + <listitem> + <simpara> + PHPã®æååã®UNICODEæååã¸ã®å¤æããã³ãã®é夿ã§ä½¿ç¨ãã + ãã³ã¼ããã¼ã¸ãæå®ãã¾ãã使ç¨å¯è½ãªå¤ã¯ã + <constant>CP_ACP</constant>, <constant>CP_MACCP</constant>, + <constant>CP_OEMCP</constant>, + <constant>CP_SYMBOL</constant>, + <constant>CP_THREAD_ACP</constant>, + <constant>CP_UTF7</constant>, <constant>CP_UTF8</constant>ã§ + ãã + </simpara> + </listitem> + </varlistentry> + </variablelist> + </para> + <para> + <example id="example.com1"> + <title>COM ã®ä¾ (1)</title> + <programlisting role="php"> +// Wordãèµ·å +$word = new COM("word.application") or die("Unable to instanciate Word"); +print "Loaded Word, version {$word->Version}\n"; + +// åé¢ã«è¡¨ç¤º +$word->Visible = 1; + +// 空ã®ããã¥ã¡ã³ãããªã¼ãã³ +$word->Documents->Add(); + +// ä½ãåç´ãªä½æ¥ããã +$word->Selection->TypeText("This is a test..."); +$word->Documents[1]->SaveAs("Useless test.doc"); + +// Wordãéãã +$word->Quit(); + +// ãªãã¸ã§ã¯ããéæ¾ +$word->Release(); +$word = null; + </programlisting> + </example> + </para> + <para> + <example id="example.com2"> + <title>COM ã®ä¾ (2)</title> + <programlisting role="php"> +$conn = new COM("ADODB.Connection") or die("Cannot start ADO"); +$conn->Open("Provider=SQLOLEDB; Data Source=localhost; +Initial Catalog=database; User ID=user; Password=password"); + +$rs = $conn->Execute("SELECT * FROM sometable"); // Recordset + +$num_columns = $rs->Fields->Count(); +echo $num_columns . "\n"; + +for ($i=0; $i < $num_columns; $i++) +{ + $fld[$i] = $rs->Fields($i); +} + +$rowcount = 0; +while (!$rs->EOF) +{ + for ($i=0; $i < $num_columns; $i++) + { + echo $fld[$i]->value . "\t"; + } + echo "\n"; + $rowcount++; // è¡ã«ã¦ã³ã¿ãå¢ãã + $rs->MoveNext(); +} + +$rs->Close(); +$conn->Close(); + +$rs->Release(); +$conn->Release(); + +$rs = null; +$conn = null; + </programlisting> + </example> + </para> + </refsect1> + </refentry> + + <refentry id="class.variant"> + <refnamediv> + <refname>VARIANT</refname> + <refpurpose>VARIANT ã¯ã©ã¹</refpurpose> + </refnamediv> + <refsynopsisdiv> + <synopsis>$vVar = new <classname>VARIANT</classname>($var)</synopsis> + </refsynopsisdiv> + <refsect1 id="class.variant.class"> + <title>説æ</title> + <simpara> + VARIANTæ§é ä½ã«å¤æ°ãã©ããããããã®ç°¡åãªã³ã³ããã¯ã©ã¹ã + </simpara> + </refsect1> + <refsect1 id="class.variant.constructor"> + <title>ã¡ã½ãã</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>VARIANT::VARIANT</function></funcdef> + <paramdef>mixed + <parameter><optional>value</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>type</optional></parameter> + </paramdef> + <paramdef>int + <parameter><optional>codepage</optional></parameter> + </paramdef> + </funcprototype> + </funcsynopsis> + <para> + VARIANT ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ã ãã©ã¡ã¼ã¿: + <variablelist> + <varlistentry><term>value</term> + <listitem> + <simpara> + åæå¤ãçç¥ããå ´åã«ã¯ãVT_EMPTYãªãã¸ã§ã¯ãã使ããã¾ãã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>type</term> + <listitem> + <simpara> + VARIANTãªãã¸ã§ã¯ãã®contentåãæå®ãã¾ãã使ç¨å¯è½ãªå¤ã¯ã + <constant>VT_UI1</constant>, <constant>VT_UI2</constant>, + <constant>VT_UI4</constant>, <constant>VT_I1</constant>, + <constant>VT_I2</constant>, <constant>VT_I4</constant>, + <constant>VT_R4</constant>, <constant>VT_R8</constant>, + <constant>VT_INT</constant>, <constant>VT_UINT</constant>, + <constant>VT_BOOL</constant>, <constant>VT_ERROR</constant>, + <constant>VT_CY</constant>, <constant>VT_DATE</constant>, + <constant>VT_BSTR</constant>, + <constant>VT_DECIMAL</constant>, + <constant>VT_UNKNOWN</constant>, + <constant>VT_DISPATCH</constant>, + <constant>VT_VARIANT</constant>ã§ãããããã®å¤ã¯ç¸äºã«æä»ç + ã§ãããå¤ããããã¨ãæå®ããããã« + <constant>VT_BYREF</constant>ãçµã¿åããããã¨ãå¯è½ã§ãã + çç¥ãããå ´åã«ã¯ã<parameter>value</parameter> ã®åã使ç¨ã + ãã¾ãããã®ä»ã®æ å ±ã«ã¤ãã¦ã¯ãMSDNã©ã¤ãã©ãªãåç §ä¸ããã + </simpara> + </listitem> + </varlistentry> + <varlistentry><term>codepage</term> + <listitem> + <simpara> + PHPã®æååã®UNICODEæååã¸ã®å¤æããã³ãã®é夿ã§ä½¿ç¨ãã + ãã³ã¼ããã¼ã¸ãæå®ãã¾ãã使ç¨å¯è½ãªå¤ã¯ã + <constant>CP_ACP</constant>, <constant>CP_MACCP</constant>, + <constant>CP_OEMCP</constant>, + <constant>CP_SYMBOL</constant>, + <constant>CP_THREAD_ACP</constant>, + <constant>CP_UTF7</constant>, <constant>CP_UTF8</constant>ã§ + ãã + </simpara> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + </refentry> <refentry id="function.com-load"> <refnamediv> @@ -27,12 +247,22 @@ <replaceable><optional>server name</optional></replaceable> </parameter> </paramdef> + <paramdef>int + <parameter> + <optional>codepage</optional> + </parameter> + </paramdef> </funcprototype> </funcsynopsis> <para> <function>com_load</function>ã¯ãæ°è¦ã®COMã³ã³ãã¼ãã³ãã使ãã ãã®ã³ã³ãã¼ãã³ãã¸ã®ãªãã¡ã¬ã³ã¹ãè¿ãã¾ãã失æããå ´åã« <literal>false</literal>ãè¿ãã¾ãã + Possible values for <parameter>codepage</parameter> are + <constant>CP_ACP</constant>, <constant>CP_MACCP</constant>, + <constant>CP_OEMCP</constant>, <constant>CP_SYMBOL</constant>, + <constant>CP_THREAD_ACP</constant>, <constant>CP_UTF7</constant> + and <constant>CP_UTF8</constant>. </para> </refsect1> </refentry> @@ -180,10 +410,50 @@ </funcsynopsis> <para> <parameter>com_object</parameter>ãæãCOMã³ã³ãã¼ãã³ãã® - <parameter>property</parameter>ã®å¤ãè¨å®ãã¾ãã - <parameter>property</parameter>ãè¨å®ããã¦ããå ´åã« - <literal>true</literal>ãè¿ãã¾ããã¨ã©ã¼æã« - <literal>false</literal>ãè¿ãã¾ãã + <parameter>property</parameter>ã®å¤ãè¨å®ãã¾ããæåæã«æ°è¦ã«è¨ + å®ãããå¤ãã¨ã©ã¼ã®å ´åã«<literal>false</literal>ãè¿ãã¾ãã + </para> + </refsect1> + </refentry> + + <refentry id="function.com-addref"> + <refnamediv> + <refname>com_addref</refname> + <refpurpose> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãå¢ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>com_addref</function></funcdef> + <void/> + </funcprototype> + </funcsynopsis> + <para> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãå¢ããã¾ãã + </para> + </refsect1> + </refentry> + + <refentry id="function.com-release"> + <refnamediv> + <refname>com_release</refname> + <refpurpose> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãæ¸ãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>com_release</function></funcdef> + <void/> + </funcprototype> + </funcsynopsis> + <para> + ã³ã³ãã¼ãã³ããªãã¡ã¬ã³ã¹ã«ã¦ã³ã¿ãæ¸ããã¾ãã </para> </refsect1> </refentry> Index: phpdoc/ja/functions/dbx.xml diff -u phpdoc/ja/functions/dbx.xml:1.3 phpdoc/ja/functions/dbx.xml:1.4 --- phpdoc/ja/functions/dbx.xml:1.3 Sat May 5 21:54:00 2001 +++ phpdoc/ja/functions/dbx.xml Sun May 20 00:43:01 2001 @@ -214,7 +214,7 @@ </para> <para> Microsoft SQL Serverã«é¢ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯ãå®éã«ã¯ - mssql_get_last_message 颿°ã®çµæã¨ãªãã¾ãã + <function>mssql_get_last_message</function> 颿°ã®çµæã¨ãªãã¾ãã </para> </note> </refsect1> Index: phpdoc/ja/functions/fbsql.xml diff -u phpdoc/ja/functions/fbsql.xml:1.1 phpdoc/ja/functions/fbsql.xml:1.2 --- phpdoc/ja/functions/fbsql.xml:1.1 Sat May 5 21:54:00 2001 +++ phpdoc/ja/functions/fbsql.xml Sun May 20 00:43:01 2001 @@ -1,5 +1,5 @@ <reference id="ref.fbsql"> - <title>FrontBase 颿°</title> + <title>FrontBase functions</title> <titleabbrev>FrontBase</titleabbrev> <partintro> <simpara> @@ -23,7 +23,9 @@ 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"> @@ -92,7 +94,7 @@ <funcsynopsis> <funcprototype> <funcdef>bool <function>fbsql_autocommit</function></funcdef> - <paramdef>int + <paramdef>resource <parameter>link_identifier</parameter> </paramdef> <paramdef>bool @@ -106,6 +108,7 @@ <function>fbsql_autocommit</function> returns the current autocommit status. if the optional OnOff parameter is given the auto commit status will be changed. + </para> </refsect1> </refentry> @@ -120,7 +123,7 @@ <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_change_user</function></funcdef> + <funcdef>resource <function>fbsql_change_user</function></funcdef> <paramdef>string <parameter>user</parameter></paramdef> <paramdef>string <parameter>password</parameter></paramdef> <paramdef>string @@ -141,21 +144,22 @@ optional parameter link_identifier. If a database is specified, this will default or current database after the user has been changed. If the new user and password authorization fails, - the current connected user stays active.</para> + the current connected user stays active. + </para> </refsect1> </refentry> <refentry id="function.fbsql-close"> <refnamediv> <refname>fbsql_close</refname> - <refpurpose>FrontBase æ¥ç¶ãéãã</refpurpose> + <refpurpose>Close FrontBase connection</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_close</function></funcdef> - <paramdef>int + <funcdef>boolean <function>fbsql_close</function></funcdef> + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -163,7 +167,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on error. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on error. </para> <para> <function>fbsql_close</function> closes the connection to the FrontBase server that's associated with the specified link @@ -175,17 +179,15 @@ as non-persistent open links are automatically closed at the end of the script's execution. </para> - <note> - </note> <example> - <title>FrontBase close example</title> + <title><function>fbsql_close</function> example</title> <programlisting role="php"> <?php $link = fbsql_connect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); print ("Connected successfully"); fbsql_close ($link); -?> +?> </programlisting> </example> <para> @@ -198,15 +200,13 @@ <refentry id="function.fbsql-connect"> <refnamediv> <refname>fbsql_connect</refname> - <refpurpose> - FrontBase ãµã¼ãã¸ã®æ¥ç¶ããªã¼ãã³ãã - </refpurpose> + <refpurpose>Open a connection to a FrontBase Server</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_connect</function></funcdef> + <funcdef>resource <function>fbsql_connect</function></funcdef> <paramdef>string <parameter> <optional>hostname @@ -248,7 +248,7 @@ <function>fbsql_close</function>. </para> <example> - <title>FrontBase connect example</title> + <title><function>fbsql_connect</function> example</title> <programlisting role="php"> <?php @@ -260,7 +260,8 @@ ?> </programlisting> </example> - <para> See also + <para> + See also <function>fbsql_pconnect</function>, and <function>fbsql_close</function>. </para> @@ -270,15 +271,15 @@ <refentry id="function.fbsql-create-db"> <refnamediv> <refname>fbsql_create_db</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ã使ãã</refpurpose> + <refpurpose>Create a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_create_db</function></funcdef> + <funcdef>bool <function>fbsql_create_db</function></funcdef> <paramdef>string <parameter>database name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -291,17 +292,17 @@ identifier. </para> <example> - <title>FrontBase create database example</title> + <title><function>fbsql_create_db</function> example</title> <programlisting role="php"> <?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") or die ("Could not connect"); if (fbsql_create_db ("my_db")) { - print ("Database created successfully\n"); + print("Database created successfully\n"); } else { - printf ("Error creating database: %s\n", fbsql_error ()); + printf("Error creating database: %s\n", fbsql_error ()); } -?> +?> </programlisting> </example> <para> @@ -313,19 +314,19 @@ <refentry id="function.fbsql-data-seek"> <refnamediv> <refname>fbsql_data_seek</refname> - <refpurpose>å é¨çãªçµæãã¤ã³ã¿ãç§»åãã</refpurpose> + <refpurpose>Move internal result pointer</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_data_seek</function></funcdef> - <paramdef>int <parameter>result_identifier</parameter></paramdef> + <funcdef>bool <function>fbsql_data_seek</function></funcdef> + <paramdef>resource <parameter>result_identifier</parameter></paramdef> <paramdef>int <parameter>row_number</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on failure. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on failure. </para> <para> <function>fbsql_data_seek</function> moves the internal row @@ -338,7 +339,7 @@ </para> <example> - <title>FrontBase data seek example</title> + <title><function>fbsql_data_seek</function> example</title> <programlisting role="php"> <?php $link = fbsql_pconnect ("localhost", "_SYSTEM", "secret") @@ -347,7 +348,7 @@ fbsql_select_db ("samp_db") or die ("Could not select database"); - $query = "SELECT last_name, first_name FROM friends"; + $query = "SELECT last_name, first_name FROM friends;"; $result = fbsql_query ($query) or die ("Query failed"); @@ -362,11 +363,11 @@ if(!($row = fbsql_fetch_object ($result))) continue; - printf ("%s %s<BR>\n", $row->last_name, $row->first_name); + printf("%s %s<BR>\n", $row->last_name, $row->first_name); } fbsql_free_result ($result); -?> +?> </programlisting> </example> </refsect1> @@ -375,16 +376,16 @@ <refentry id="function.fbsql-db-query"> <refnamediv> <refname>fbsql_db_query</refname> - <refpurpose>FrontBaseã¯ã¨ãªãéä¿¡ãã</refpurpose> + <refpurpose>Send a FrontBase query</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_db_query</function></funcdef> + <funcdef>resource <function>fbsql_db_query</function></funcdef> <paramdef>string <parameter>database</parameter></paramdef> <paramdef>string <parameter>query</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -393,7 +394,7 @@ </funcsynopsis> <para> Returns: A positive FrontBase result identifier to the query result, - or false on error. + or <literal>FALSE</literal> on error. </para> <para> <function>fbsql_db_query</function> selects a database and @@ -412,15 +413,15 @@ <refentry id="function.fbsql-drop-db"> <refnamediv> <refname>fbsql_drop_db</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ãç ´æ£(åé¤)ãã</refpurpose> + <refpurpose>Drop (delete) a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_drop_db</function></funcdef> + <funcdef>bool <function>fbsql_drop_db</function></funcdef> <paramdef>string <parameter>database_name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -428,7 +429,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on failure. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on failure. </para> <para> <function>fbsql_drop_db</function> attempts to drop (remove) an @@ -441,16 +442,15 @@ <refentry id="function.fbsql-errno"> <refnamediv> <refname>fbsql_errno</refname> - <refpurpose> - ç´è¿ã®FrontBaseå¦çã«ããã¨ã©ã¼ã¡ãã»ã¼ã¸çªå·ãè¿ã - </refpurpose> + <refpurpose>Returns the numerical value of the error message from previous + FrontBase operation</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_errno</function></funcdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -477,9 +477,9 @@ echo fbsql_errno().": ".fbsql_error()."<BR>"; fbsql_select_db("nonexistentdb"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -$conn = fbsql_query("SELECT * FROM nonexistenttable"); +$conn = fbsql_query("SELECT * FROM nonexistenttable;"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -?> +?> </programlisting> </informalexample> </para> @@ -493,16 +493,15 @@ <refentry id="function.fbsql-error"> <refnamediv> <refname>fbsql_error</refname> - <refpurpose> - ç´è¿ã®FrontBaseå¦çã«ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã®ããã¹ããè¿ã - </refpurpose> + <refpurpose>Returns the text of the error message from previous + FrontBase operation</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_error</function></funcdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -528,9 +527,9 @@ echo fbsql_errno().": ".fbsql_error()."<BR>"; fbsql_select_db("nonexistentdb"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -$conn = fbsql_query("SELECT * FROM nonexistenttable"); +$conn = fbsql_query("SELECT * FROM nonexistenttable;"); echo fbsql_errno().": ".fbsql_error()."<BR>"; -?> +?> </programlisting> </informalexample> </para> @@ -545,7 +544,7 @@ <refnamediv> <refname>fbsql_fetch_array</refname> <refpurpose> - 飿³é åãæ°å¤é åãã¾ãã¯ä¸¡æ¹ã®é åã¨ãã¦çµæã¬ã³ã¼ããåå¾ãã + Fetch a result row as an associative array, a numeric array, or both. </refpurpose> </refnamediv> <refsect1> @@ -553,7 +552,7 @@ <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_array</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter> <optional>result_type</optional> @@ -562,7 +561,7 @@ </funcprototype> </funcsynopsis> <para> - Returns an array that corresponds to the fetched row, or false + Returns an array that corresponds to the fetched row, or <literal>FALSE</literal> if there are no more rows.</para> <para> <function>fbsql_fetch_array</function> is an extended version of @@ -598,7 +597,7 @@ <function>fbsql_fetch_row</function> and <function>fbsql_fetch_assoc</function>. </para> <example> - <title><function>fbsql_fetch_array</function></title> + <title><function>fbsql_fetch_array</function> example</title> <programlisting role="php"> <?php fbsql_connect ($host, $user, $password); @@ -610,7 +609,7 @@ echo "fullname: ".$row[1]."<br>\n"; } fbsql_free_result ($result); -?> +?> </programlisting> </example> </refsect1> @@ -620,7 +619,7 @@ <refnamediv> <refname>fbsql_fetch_assoc</refname> <refpurpose> - 飿³é åã¨ãã¦çµæã¬ã³ã¼ããåå¾ãã + Fetch a result row as an associative array </refpurpose> </refnamediv> <refsect1> @@ -628,12 +627,12 @@ <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_assoc</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns an associative array that corresponds to the fetched row, - or false if there are no more rows.</para> + or <literal>FALSE</literal> 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 @@ -659,7 +658,7 @@ <function>fbsql_fetch_row</function> and <function>fbsql_fetch_array</function>. </para> <example> - <title><function>fbsql_fetch_assoc</function></title> + <title><function>fbsql_fetch_assoc</function> example</title> <programlisting role="php"> <?php fbsql_connect ($host, $user, $password); @@ -669,7 +668,7 @@ echo $row["fullname"]; } fbsql_free_result ($result); -?> +?> </programlisting> </example> </refsect1> @@ -679,7 +678,7 @@ <refnamediv> <refname>fbsql_fetch_field</refname> <refpurpose> - çµæããã«ã©ã æ å ±ãåå¾ãããªãã¸ã§ã¯ãã¨ãã¦è¿ã + Get column information from a result and return as an object </refpurpose> </refnamediv> <refsect1> @@ -687,7 +686,7 @@ <funcsynopsis> <funcprototype> <funcdef>object <function>fbsql_fetch_field</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter> <optional>field_offset</optional> @@ -735,7 +734,7 @@ </itemizedlist> </para> <example> - <title><function>fbsql_fetch_field</function></title> + <title><function>fbsql_fetch_field</function> example</title> <programlisting role="php"> <?php fbsql_connect ($host, $user, $password) @@ -760,7 +759,7 @@ $i++; } fbsql_free_result ($result); -?> +?> </programlisting> </example> <para> @@ -773,7 +772,7 @@ <refnamediv> <refname>fbsql_fetch_lengths</refname> <refpurpose> - çµæã®ååºåã®é·ããå¾ã + Get the length of each output in a result </refpurpose> </refnamediv> <refsect1> @@ -781,16 +780,15 @@ <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_lengths</function></funcdef> - <paramdef>int - <parameter> - <optional>result</optional> - </parameter> + <paramdef>resource + <parameter><optional>result</optional></parameter> + </paramdef> </funcprototype> </funcsynopsis> <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. + or <literal>FALSE</literal> on error. </para> <para> <function>fbsql_fetch_lengths</function> stores the lengths of @@ -809,14 +807,14 @@ <refentry id="function.fbsql-fetch-object"> <refnamediv> <refname>fbsql_fetch_object</refname> - <refpurpose>ãªãã¸ã§ã¯ãã¨ãã¦çµæã¬ã³ã¼ããåå¾ãã</refpurpose> + <refpurpose>Fetch a result row as an object</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>object <function>fbsql_fetch_object</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter> <optional>result_type</optional> @@ -826,7 +824,7 @@ </funcsynopsis> <para> Returns an object with properties that correspond to the fetched - row, or false if there are no more rows. + row, or <literal>FALSE</literal> if there are no more rows. </para> <para> <function>fbsql_fetch_object</function> is similar to @@ -856,7 +854,7 @@ echo $row->fullname; } fbsql_free_result ($result); -?> +?> </programlisting> </example> </para> @@ -870,18 +868,18 @@ <refentry id="function.fbsql-fetch-row"> <refnamediv> <refname>fbsql_fetch_row</refname> - <refpurpose>æ°å¤é åã¨ãã¦çµæã¬ã³ã¼ããå¾ã</refpurpose> + <refpurpose>Get a result row as an enumerated array</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>array <function>fbsql_fetch_row</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - Returns: An array that corresponds to the fetched row, or false + Returns: An array that corresponds to the fetched row, or <literal>FALSE</literal> if there are no more rows. </para> <para> @@ -892,7 +890,7 @@ </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 + return the next row in the result set, or <literal>FALSE</literal> if there are no more rows. </para> <para> @@ -909,7 +907,7 @@ <refnamediv> <refname>fbsql_field_flags</refname> <refpurpose> - çµæã«ããã¦æå®ãããã£ã¼ã«ãã«é¢ãããã©ã°ãå¾ã + Get the flags associated with the specified field in a result </refpurpose> </refnamediv> <refsect1> @@ -917,7 +915,7 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_flags</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -934,7 +932,7 @@ <refnamediv> <refname>fbsql_field_name</refname> <refpurpose> - çµæã«ããã¦æå®ãããã£ã¼ã«ãã®ååãå¾ã + Get the name of the specified field in a result </refpurpose> </refnamediv> <refsect1> @@ -942,7 +940,7 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_name</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_index</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -993,7 +991,7 @@ <refnamediv> <refname>fbsql_field_len</refname> <refpurpose> - æå®ãããã£ã¼ã«ãã®é·ããå¾ã + Returns the length of the specified field </refpurpose> </refnamediv> <refsect1> @@ -1001,7 +999,7 @@ <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_field_len</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1016,15 +1014,15 @@ <refnamediv> <refname>fbsql_field_seek</refname> <refpurpose> - æå®ãããã£ã¼ã«ããªãã»ããã«çµæãã¤ã³ã¿ãè¨å®ãã + Set result pointer to a specified field offset </refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_field_seek</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <funcdef>bool <function>fbsql_field_seek</function></funcdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1044,7 +1042,7 @@ <refnamediv> <refname>fbsql_field_table</refname> <refpurpose> - æå®ãããã£ã¼ã«ãããããã¼ãã«ã®ååãå¾ã + Get name of the table the specified field is in </refpurpose> </refnamediv> <refsect1> @@ -1052,12 +1050,13 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_table</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> <para> - æå®ãããã£ã¼ã«ãããããã¼ãã«ã®ååãè¿ãã¾ãã + Returns the name of the table that the specifed field is + in. </para> </refsect1> </refentry> @@ -1066,7 +1065,7 @@ <refnamediv> <refname>fbsql_field_type</refname> <refpurpose> - çµæã®ä¸ã§æå®ãããã£ã¼ã«ãã®åãå¾ã + Get the type of the specified field in a result </refpurpose> </refnamediv> <refsect1> @@ -1074,7 +1073,7 @@ <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_field_type</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>field_offset</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1086,13 +1085,13 @@ detailed in the <ulink url="&url.fbsql.docs;">FrontBase documentation</ulink>. <example> - <title>fbsql field types</title> + <title><function>fbsql_field_type</function> example</title> <programlisting role="php"> <?php -fbsql_connect ("localhost:3306"); +fbsql_connect ("localhost", "_SYSTEM", ""); fbsql_select_db ("wisconsin"); -$result = fbsql_query ("SELECT * FROM onek"); +$result = fbsql_query ("SELECT * FROM onek;"); $fields = fbsql_num_fields ($result); $rows = fbsql_num_rows ($result); $i = 0; @@ -1109,7 +1108,7 @@ } fbsql_close(); -?> +?> </programlisting> </example> </para> @@ -1119,13 +1118,13 @@ <refentry id="function.fbsql-free-result"> <refnamediv> <refname>fbsql_free_result</refname> - <refpurpose>çµæä¿æç¨ã®ã¡ã¢ãªãéæ¾ãã</refpurpose> + <refpurpose>Free result memory</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_free_result</function></funcdef> + <funcdef>bool <function>fbsql_free_result</function></funcdef> <paramdef>int <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1146,7 +1145,7 @@ <refnamediv> <refname>fbsql_insert_id</refname> <refpurpose> - ç´è¿ã®INSERTå¦çã§çæãããIDãå¾ã + Get the id generated from the previous INSERT operation </refpurpose> </refnamediv> <refsect1> @@ -1154,7 +1153,7 @@ <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_insert_id</function></funcdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1163,14 +1162,14 @@ </funcsynopsis> <para> <function>fbsql_insert_id</function> returns the ID generated for - an AUTO_INCREMENT column by the previous INSERT query using the + 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 AUTO_INCREMENT value. If you need to + 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> @@ -1178,22 +1177,10 @@ <para> The value of the FrontBase SQL function <literal>LAST_INSERT_ID()</literal> always contains the most - recently generated AUTO_INCREMENT value, and is not reset + recently generated DEFAULT UNIQUE value, and is not reset between queries. </para> </note> - <warning> - <para> - <function>fbsql_insert_id</function> converts the return type of - the native FrontBase C API function - <literal>fbsql_insert_id()</literal> to a type of - <literal>long</literal>. If your AUTO_INCREMENT column has - a column type of BIGINT, the value returned by - <function>fbsql_insert_id</function> will be incorrect. - Instead, use the internal FrontBase SQL function - <literal>LAST_INSERT_ID()</literal>. - </para> - </warning> </refsect1> </refentry> @@ -1201,15 +1188,15 @@ <refnamediv> <refname>fbsql_list_dbs</refname> <refpurpose> - FrontBaseãµã¼ãã§å©ç¨å¯è½ãªãã¼ã¿ãã¼ã¹ã®ä¸è¦§ãå¾ã + List databases available on a FrontBase server </refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_list_dbs</function></funcdef> - <paramdef>int + <funcdef>resource <function>fbsql_list_dbs</function></funcdef> + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1258,16 +1245,16 @@ <refentry id="function.fbsql-list-fields"> <refnamediv> <refname>fbsql_list_fields</refname> - <refpurpose>FrontBaseçµæãã£ã¼ã«ãã®ä¸è¦§ãå¾ã</refpurpose> + <refpurpose>List FrontBase result fields</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_list_fields</function></funcdef> + <funcdef>resource <function>fbsql_list_fields</function></funcdef> <paramdef>string <parameter>database_name</parameter></paramdef> <paramdef>string <parameter>table_name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1322,15 +1309,15 @@ <refentry id="function.fbsql-list-tables"> <refnamediv> <refname>fbsql_list_tables</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ã®ãã¼ãã«ä¸è¦§ãå¾ã</refpurpose> + <refpurpose>List tables in a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_list_tables</function></funcdef> + <funcdef>resource <function>fbsql_list_tables</function></funcdef> <paramdef>string <parameter>database</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1347,17 +1334,61 @@ </refsect1> </refentry> + <refentry id="function.fbsql-next-result"> + <refnamediv> + <refname>fbsql_next_result</refname> + <refpurpose>Move the internal result pointer to the next result</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>bool + <function>fbsql_next_result</function> + </funcdef> + <paramdef>int <parameter>result_id</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <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 <literal>TRUE</literal> if an additional result set was + available or <literal>FALSE</literal> othervise. + </para> + <example> + <title><function>fbsql_next_result</function> example</title> + <programlisting role="php"> +<?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> + <refpurpose>Get number of fields in result</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_num_fields</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -1376,14 +1407,14 @@ <refentry id="function.fbsql-num-rows"> <refnamediv> <refname>fbsql_num_rows</refname> - <refpurpose>çµæã®ã¬ã³ã¼ãæ°ãå¾ã</refpurpose> + <refpurpose>Get number of rows in result</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>int <function>fbsql_num_rows</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> </funcprototype> </funcsynopsis> <para> @@ -1399,7 +1430,7 @@ $link = fbsql_connect("localhost", "username", "password"); fbsql_select_db("database", $link); -$result = fbsql_query("SELECT * FROM table1", $link); +$result = fbsql_query("SELECT * FROM table1;", $link); $num_rows = fbsql_num_rows($result); echo "$num_rows Rows\n"; @@ -1422,21 +1453,16 @@ <refnamediv> <refname>fbsql_pconnect</refname> <refpurpose> - FrontBaseãµã¼ãã¸ã®æç¶çãªæ¥ç¶ããªã¼ãã³ãã + Open a persistent connection to a FrontBase Server </refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_pconnect</function></funcdef> + <funcdef>resource <function>fbsql_pconnect</function></funcdef> <paramdef>string - <parameter> - <optional>hostname - <optional>:port</optional> - <optional>:/path/to/socket</optional> - </optional> - </parameter> + <parameter><optional>hostname</optional></parameter> </paramdef> <paramdef>string <parameter><optional>username</optional></parameter> @@ -1448,25 +1474,22 @@ </funcsynopsis> <para> Returns: A positive FrontBase persistent link identifier on success, - or false on error. + or <literal>FALSE</literal> 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:port</parameter> = - 'localhost:3306', <parameter>username</parameter> = name of the - user that owns the server process and - <parameter>password</parameter> = empty password. + missing optional parameters: <parameter>host</parameter> = + 'localhost', <parameter>username</parameter> = "_SYSTEM" + and <parameter>password</parameter> = empty password. </para> <para> - The hostname string can also include a port - number. eg. "hostname:port" or a path to a socket - eg. ":/path/to/socket" for the localhost. - </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, @@ -1487,15 +1510,15 @@ <refentry id="function.fbsql-query"> <refnamediv> <refname>fbsql_query</refname> - <refpurpose>FrontBaseã¯ã¨ãªãéä¿¡ãã</refpurpose> + <refpurpose>Send a FrontBase query</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_query</function></funcdef> + <funcdef>resource <function>fbsql_query</function></funcdef> <paramdef>string <parameter>query</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter><optional>link_identifier</optional></parameter> </paramdef> </funcprototype> @@ -1511,27 +1534,27 @@ </para> <note> <para> - The query string should not end with a semicolon. + The query string shall always end with a semicolon. </para> </note> <para> - <function>fbsql_query</function> returns TRUE (non-zero) or FALSE + <function>fbsql_query</function> returns <literal>TRUE</literal> (non-zero) or <literal>FALSE</literal> to indicate whether or not the query succeeded. A return value - of TRUE means that the query was legal and could be executed by + of <literal>TRUE</literal> 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: + <function>fbsql_query</function> fails and returns <literal>FALSE</literal>: <example> - <title><function>fbsql_query</function></title> + <title><function>fbsql_query</function> example</title> <programlisting role="php"> <?php $result = fbsql_query ("SELECT * WHERE 1=1") or die ("Invalid query"); -?> +?> </programlisting> </example> </para> @@ -1539,19 +1562,19 @@ 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: + fails and returns <literal>FALSE</literal>: <example> - <title><function>fbsql_query</function></title> + <title><function>fbsql_query</function> example</title> <programlisting role="php"> <?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 + <function>fbsql_query</function> will also fail and return <literal>FALSE</literal> if you don't have permission to access the table(s) referenced by the query. </para> @@ -1593,7 +1616,7 @@ <funcsynopsis> <funcprototype> <funcdef>mixed <function>fbsql_result</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>row</parameter></paramdef> <paramdef>mixed <parameter> @@ -1635,15 +1658,15 @@ <refentry id="function.fbsql-select-db"> <refnamediv> <refname>fbsql_select_db</refname> - <refpurpose>FrontBaseãã¼ã¿ãã¼ã¹ã鏿ãã</refpurpose> + <refpurpose>Select a FrontBase database</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>int <function>fbsql_select_db</function></funcdef> + <funcdef>resource <function>fbsql_select_db</function></funcdef> <paramdef>string <parameter>database_name</parameter></paramdef> - <paramdef>int + <paramdef>resource <parameter> <optional>link_identifier</optional> </parameter> @@ -1651,7 +1674,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true on success, false on error. + Returns: <literal>TRUE</literal> on success, <literal>FALSE</literal> on error. </para> <para> <function>fbsql_select_db</function> sets the current active @@ -1662,6 +1685,14 @@ 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> @@ -1676,14 +1707,14 @@ <refentry id="function.fbsql-tablename"> <refnamediv> <refname>fbsql_tablename</refname> - <refpurpose>æå®ãããã£ã¼ã«ãã®ãã¼ãã«åãå¾ã</refpurpose> + <refpurpose>Get table name of field</refpurpose> </refnamediv> <refsect1> <title>説æ</title> <funcsynopsis> <funcprototype> <funcdef>string <function>fbsql_tablename</function></funcdef> - <paramdef>int <parameter>result</parameter></paramdef> + <paramdef>resource <parameter>result</parameter></paramdef> <paramdef>int <parameter>i</parameter></paramdef> </funcprototype> </funcsynopsis> @@ -1694,10 +1725,10 @@ <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> Example</title> + <title><function>fbsql_tablename</function> example</title> <programlisting role="php"> <?php -fbsql_connect ("localhost:3306"); +fbsql_connect ("localhost", "_SYSTEM", ""); $result = fbsql_list_tables ("wisconsin"); $i = 0; while ($i < fbsql_num_rows ($result)) { @@ -1705,7 +1736,7 @@ echo $tb_names[$i] . "<BR>"; $i++; } -?> +?> </programlisting> </example> </para> @@ -1715,7 +1746,7 @@ <refentry id="function.fbsql-warnings"> <refnamediv> <refname>fbsql_warnings</refname> - <refpurpose>FrontBaseã®è¦åãæå¹ã¾ãã¯ç¡å¹ã«ãã</refpurpose> + <refpurpose>Enable or disable FrontBase warnings</refpurpose> </refnamediv> <refsect1> <title>説æ</title> @@ -1730,7 +1761,7 @@ </funcprototype> </funcsynopsis> <para> - Returns: true if warnings is turned on otherwise false. + Returns <literal>TRUE</literal> if warnings is turned on otherwise <literal>FALSE</literal>. </para> <para> <function>fbsql_warnings</function> enables or disables FrontBase Index: phpdoc/ja/functions/math.xml diff -u phpdoc/ja/functions/math.xml:1.17 phpdoc/ja/functions/math.xml:1.18 --- phpdoc/ja/functions/math.xml:1.17 Sat May 5 22:22:49 2001 +++ phpdoc/ja/functions/math.xml Sun May 20 00:43:01 2001 @@ -840,6 +840,24 @@ ããããæååã使ããå°æ°é¨ã®åã®ããã(".")ã®ä»£ããã« <parameter>dec_point</parameter>ã§ä¸ããããæååã使ãã¾ãã </para> + <para> + ä¾ãã°ããã©ã³ã¹èªè¡¨è¨ã§ã¯é叏尿°ç¹ä»¥ä¸ã¯2æ¡ã¨ããã«ã³ã(',')ã + å°æ°é¨ã®åºåãæåãã¹ãã¼ã¹ã1000ã®ä½æ¯ã®åºåãæåã¨ãã¦ä½¿ç¨ã + ã¾ããããã¯ã次ã®ããã«è¡ãã¾ãã + <informalexample> + <programlisting role="php"> +<?php + $nombre = 1234.56; + // è±èªè¡¨è¨ (ããã©ã«ã) + $english_format_number = number_format($nombre); + // 1,234.56 + // ãã©ã³ã¹èªè¡¨è¨ + $nombre_format_francais = number_format($nombre, 2, ',', ' '); + // 1 234,56 +?> + </programlisting> + </informalexample> + </para> </refsect1> </refentry> Index: phpdoc/ja/functions/misc.xml diff -u phpdoc/ja/functions/misc.xml:1.17 phpdoc/ja/functions/misc.xml:1.18 --- phpdoc/ja/functions/misc.xml:1.17 Sun Mar 18 08:36:45 2001 +++ phpdoc/ja/functions/misc.xml Sun May 20 00:43:01 2001 @@ -47,9 +47,9 @@ </funcsynopsis> <simpara> æ¥ç¶ã¹ãã¼ã¿ã¹ã®ããããã£ã¼ã«ããè¿ãã¾ãã - 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ããç« ã® - <link linkend="features.connection-handling">æ¥ç¶å¦ç</link> - ã«é¢ããè¨è¿°ãåç §ä¸ããã + 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ã + ãç« ã®<link linkend="features.connection-handling">æ¥ç¶å¦ç + </link>ã«é¢ããè¨è¿°ãåç §ä¸ããã </simpara> </refsect1> </refentry> @@ -69,10 +69,18 @@ </funcsynopsis> <simpara> ã¹ã¯ãªãããã¿ã¤ã ã¢ã¦ãããå ´åã«trueãè¿ãã¾ãã - 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ããç« ã® - <link linkend="features.connection-handling">æ¥ç¶å¦ç</link> - ã«é¢ããè¨è¿°ãåç §ä¸ããã </simpara> + <warning> + <title>éå»ã®é¢æ°</title> + <simpara> + ãã®é¢æ°ã¯ãéå»ã®ãã®ã§ããã4.0.5以éã«ã¯åå¨ãã¾ããã + </simpara> + </warning> + <simpara> + 詳細ãªèª¬æã«é¢ãã¦ã¯ã<link linkend="features">æ©è½ </link>ã«é¢ã + ãç« ã®<link linkend="features.connection-handling">æ¥ç¶å¦ç + </link>ã«é¢ããè¨è¿°ãåç §ä¸ããã + </simpara> </refsect1> </refentry> @@ -217,8 +225,18 @@ </funcprototype> </funcsynopsis> <para> - <parameter>name</parameter> ã§æå®ããååã®å®æ°ãå®ç¾©ããã¦ããå ´åã« - trueããã®ä»ã®å ´åã«falseãè¿ãã¾ãã + <parameter>name</parameter> ã§æå®ããååã®å®æ°ãå®ç¾©ããã¦ãã + å ´åã«trueããã®ä»ã®å ´åã«falseãè¿ãã¾ãã + <example> + <title>宿°ã®ãã§ãã¯</title> + <programlisting role="php"> +<?php +if (defined("CONSTANT")){ // å¼ç¨ç¬¦ã§æ¬ããã¦ããå¿ è¦ãããã¾ã + echo CONSTANT; // + } +?> + </programlisting> + </example> </para> <para> <function>define</function>, @@ -268,7 +286,7 @@ </para> <para> <example> - <title>颿°ã使ç¨ãã <function>die</function> ã®ä¾</title> + <title>颿°ã使ç¨ãã<function>die</function>ã®ä¾</title> <programlisting role="php"> <?php @@ -296,7 +314,7 @@ <refentry id="function.eval"> <refnamediv> <refname>eval</refname> - <refpurpose>æååã PHP ã³ã¼ãã¨ãã¦è©ä¾¡ãã</refpurpose> + <refpurpose>æååãPHPã³ã¼ãã¨ãã¦è©ä¾¡ãã</refpurpose> </refnamediv> <refsect1> <title>説æ</title> @@ -611,7 +629,8 @@ <refnamediv> <refname>ignore_user_abort</refname> <refpurpose> - ã¯ã©ã¤ã¢ã³ãæ¥ç¶ãæã¨ãªã£ãæã«ã¹ã¯ãªããã®å®è¡ã䏿ãããã©ãããè¨å®ãã + ã¯ã©ã¤ã¢ã³ãæ¥ç¶ãæã¨ãªã£ãæã«ã¹ã¯ãªããã®å®è¡ã䏿ãããã©ã + ããè¨å®ãã </refpurpose> </refnamediv> <refsect1> @@ -852,62 +871,6 @@ </refsect1> </refentry> - <refentry id="function.serialize"> - <refnamediv> - <refname>serialize</refname> - <refpurpose> - å¤ã®ä¿åå¯è½ãªè¡¨ç¾ãçæãã - </refpurpose> - </refnamediv> - <refsect1> - <title>説æ</title> - <funcsynopsis> - <funcprototype> - <funcdef>string <function>serialize</function></funcdef> - <paramdef>mixed <parameter>value</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - <function>serialize</function> ã¯ã<parameter>value</parameter>ã® - ä¿åå¯è½ãªãã¤ãã¹ããªã¼ã 表ç¾ãå«ãæååãè¿ãã¾ãã - </simpara> - <simpara> - åãæ§é ã失ããã«PHPã®å¤ãä¿åã¾ãã¯æ¸¡ãéã«æå¹ã§ãã - </simpara> - <simpara> - ã·ãªã¢ã«åãããæååãPHPã®å¤ã«æ»ãã«ã¯ã - <function>unserialize</function>ã使ç¨ãã¦ä¸ããã - <function>serialize</function>ã¯å<type>integer</type>, - <type>double</type>,<type>string</type>,<type>array</type> - (夿¬¡å ),<type>object</type> - (ãªãã¸ã§ã¯ãããããã£ã¯ã·ãªã¢ã«åããã¾ãããã¡ã½ããã¯å¤±ããã¾ã) - ã«å¯¾å¿ãã¾ãã - </simpara> - <para> - <example> - <title><function>serialize</function>ã®ä¾</title> - <programlisting role="php"> -// $session_data ã¯ã«ã¬ã³ãã¦ã¼ã¶ã¼ã®ã»ãã·ã§ã³æ å ±ãå«ã夿¬¡å é åã -// ä¿æãã¦ãã¾ãããªã¯ã¨ã¹ãã®æå¾ã«ããããã¼ã¿ãã¼ã¹ã«ä¿åããããã« -// serialize() ã使ç¨ãã¾ãã - -$conn = odbc_connect("webdb", "php", "chicken"); -$stmt = odbc_prepare($conn, - "UPDATE sessions SET data = ? WHERE id = ?"); -$sqldata = array(serialize($session_data), $PHP_AUTH_USER); -if (!odbc_execute($stmt, &$sqldata)) { - $stmt = odbc_prepare($conn, - "INSERT INTO sessions (id, data) VALUES(?, ?)"); - if (!odbc_execute($stmt, &$sqldata)) { - /* ä½ãåé¡ããã£ãããã§ããBitch, whine and moan. */ - } -} - </programlisting> - </example> - </para> - </refsect1> - </refentry> - <refentry id="function.show-source"> <refnamediv> <refname>show_source</refname> @@ -978,9 +941,9 @@ <title>説æ</title> <funcsynopsis> <funcprototype> - <funcdef>string <function>uniqid</function></funcdef> + <funcdef>int <function>uniqid</function></funcdef> <paramdef>string <parameter>prefix</parameter></paramdef> - <paramdef>boolean + <paramdef>bool <parameter> <replaceable><optional>lcg</optional></replaceable> </parameter> @@ -988,11 +951,11 @@ </funcprototype> </funcsynopsis> <simpara> - <function>uniqid</function>ã¯ãããªç§åä½ã®ç¾å¨æå»ã«åºã¥ã - å é è¾ï¼prefixï¼ãä»ããã¦ãã¼ã¯ãªIDãè¿ãã¾ãã - ããã¤ãã®ãã¹ãä¸ã§åæã«IDãçæãããå ´åã - å ¨ãåãããªç§ã®IDãçæãããã®ãé²ãã®ã«prefixãæç¨ã§ãã - <parameter>prefix</parameter>ã«ã¯114æåã¾ã§ã®é·ããæå®ãããã¨ãã§ãã¾ãã + <function>uniqid</function>ã¯ãããªç§åä½ã®ç¾å¨æå»ã«åºã¥ãå é è¾ + ï¼prefixï¼ãä»ããã¦ãã¼ã¯ãªIDãè¿ãã¾ããããã¤ãã®ãã¹ãä¸ã§å + æã«IDãçæãããå ´åãå ¨ãåãããªç§ã®IDãçæãããã®ãé²ãã® + ã«prefixãæç¨ã§ãã<parameter>prefix</parameter>ã«ã¯114æåã¾ã§ + ã®é·ããæå®ãããã¨ãã§ãã¾ãã </simpara> <simpara> ãªãã·ã§ã³ã® <parameter>lcg</parameter> ãã©ã¡ã¼ã¿ã true ã®å ´åã @@ -1006,14 +969,14 @@ </simpara> <note> <simpara> - <parameter>lcg</parameter> ãã©ã¡ã¼ã¿ã¯ã - PHP 4ã¾ãã¯PHP 3.0.13以éã§ã®ã¿ä½¿ç¨å¯è½ã§ãã + <parameter>lcg</parameter> ãã©ã¡ã¼ã¿ã¯ãPHP 4ã¾ãã¯PHP 3.0.13以 + éã§ã®ã¿ä½¿ç¨å¯è½ã§ãã </simpara> </note> <para> - ã¦ãã¼ã¯ãªIDã¾ãã¯ãã¼ã¯ã³ãå¿ è¦ãªå ´åãããã¦ã - ãããã¯ã¼ã¯çµç±ã§ã¦ã¼ã¶ã¼ã«ãã®ãã¼ã¯ã³ã渡ããã¨ããå ´åã - 次ã®ä¾ã®ããã«ããã®ãæ¨å¥¨ããã¾ãã + ã¦ãã¼ã¯ãªIDã¾ãã¯ãã¼ã¯ã³ãå¿ è¦ãªå ´åãããã¦ããããã¯ã¼ã¯çµç± + ã§ã¦ã¼ã¶ã¼ã«ãã®ãã¼ã¯ã³ã渡ããã¨ããå ´å(ä¾ãã°ãã»ãã·ã§ã³ã¯ã + ãã¼)ãæ¬¡ã®ä¾ã®ããã«ããã®ãæ¨å¥¨ããã¾ãã <informalexample> <programlisting role="php"> $token = md5 (uniqid ("")); // ã©ã³ãã è¦ç´ ãªã @@ -1074,57 +1037,6 @@ </refsect1> </refentry> - <refentry id="function.unserialize"> - <refnamediv> - <refname>unserialize</refname> - <refpurpose>ä¿åç¨è¡¨ç¾ãã PHP ã®å¤ãçæãã</refpurpose> - </refnamediv> - <refsect1> - <title>説æ</title> - <funcsynopsis> - <funcprototype> - <funcdef>mixed <function>unserialize</function></funcdef> - <paramdef>string <parameter>str</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <simpara> - <function>unserialize</function> ã¯ãã·ãªã¢ã«åããã夿° - (<function>serialize</function> ãåç §) ãã¨ããPHP 夿°å¤ã« - æ»ã夿ãè¡ãã¾ãã夿ãããå¤ãè¿ããã¾ãããã®å¤ã¯ã - <type>integer</type>, <type>double</type>, - <type>string</type>, <type>array</type> , <type>object</type> - ã¨ãããã¨ãå¯è½ã§ãã - ãªãã¸ã§ã¯ããã·ãªã¢ã«åãããå ´åã - è¿ãå¤ã«ãã®ã¡ã½ããã¯ä¿åããã¦ãã¾ããã - </simpara> - <para> - <example> - <title><function>unserialize</function>ã®ä¾</title> - <programlisting role="php"> -// ããã§ããã¼ã¿ãã¼ã¹ãã $session_data ã«ã»ãã·ã§ã³ãã¼ã¿ããã¼ã -// ããããã« unserialize() ã使ç¨ãã¾ãã -// ãã®ä¾ã¯ã<function>serialize</function> ã§è¨è¿°ãããä¾ãè£è¶³ãããã®ã§ãã - -$conn = odbc_connect("webdb", "php", "chicken"); -$stmt = odbc_prepare($conn, "SELECT data FROM sessions WHERE id = ?"); -$sqldata = array($PHP_AUTH_USER); -if (!odbc_execute($stmt, &$sqldata) || !odbc_fetch_into($stmt, &$tmp)) { - // å®è¡ã¾ãã¯åå¾ã失æããå ´åã空ã®é åã§åæåãã¾ã - $session_data = array(); -} else { - // $tmp[0] ã«ã·ãªã¢ã«åããããã¼ã¿ãä¿æãã¦ããå¿ è¦ãããã¾ãã - $session_data = unserialize($tmp[0]); - if (!is_array($session_data)) { - // ä½ãåé¡ããã£ãããã空ã®é åã§åæåãã¾ãã - $session_data = array(); - } -} - </programlisting> - </example> - </para> - </refsect1> - </refentry> - <refentry id="function.usleep"> <refnamediv> <refname>usleep</refname> Index: phpdoc/ja/functions/oci8.xml diff -u phpdoc/ja/functions/oci8.xml:1.13 phpdoc/ja/functions/oci8.xml:1.14 --- phpdoc/ja/functions/oci8.xml:1.13 Sat May 5 22:22:49 2001 +++ phpdoc/ja/functions/oci8.xml Sun May 20 00:43:01 2001 @@ -1336,8 +1336,8 @@ var_dump($data); } -OCIFreeCursor ($stmt); -OCIFreeStatement ($curs); +OCIFreeStatement ($stmt); +OCIFreeCursor ($curs); OCILogoff ($conn); ?> </programlisting> Index: phpdoc/ja/functions/pdf.xml diff -u phpdoc/ja/functions/pdf.xml:1.21 phpdoc/ja/functions/pdf.xml:1.22 --- phpdoc/ja/functions/pdf.xml:1.21 Wed Mar 28 05:45:34 2001 +++ phpdoc/ja/functions/pdf.xml Sun May 20 00:43:02 2001 @@ -1987,6 +1987,33 @@ </refsect1> </refentry> + <refentry id="function.pdf-setcolor"> + <refnamediv> + <refname>PDF_setcolor</refname> + <refpurpose>å¡ãã¤ã¶ãè²ããã³è¼ªéè²ãCMYKã§è¨å®ãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>void <function>PDF_setcolor</function></funcdef> + <paramdef>int <parameter>pdf object</parameter></paramdef> + <paramdef>string <parameter>type</parameter></paramdef> + <paramdef>string <parameter>colorspace</parameter></paramdef> + <paramdef>double <parameter>c1</parameter></paramdef> + <paramdef>double <parameter>c2</parameter></paramdef> + <paramdef>double <parameter>c3</parameter></paramdef> + <paramdef>double <parameter>c4</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <para> + ã«ã¬ã³ãã®ã«ã©ã¼ã¹ãã¼ã¹ã¨è²ãè¨å®ãã¾ãã + <parameter>type</parameter>ã¯ã"fill", "stroke", "both" ã®ã©ãã + ã§ãã + </para> + </refsect1> + </refentry> + <refentry id="function.pdf-setdash"> <refnamediv> <refname>pdf_setdash</refname> Index: phpdoc/ja/functions/var.xml diff -u phpdoc/ja/functions/var.xml:1.26 phpdoc/ja/functions/var.xml:1.27 --- phpdoc/ja/functions/var.xml:1.26 Fri Apr 27 19:20:55 2001 +++ phpdoc/ja/functions/var.xml Sun May 20 00:43:02 2001 @@ -791,6 +791,11 @@ ãªãã¸ã§ã¯ãã«é¢ãã¦ãåæ§ã®è¡¨ç¤ºå½¢å¼ã¨ãªãã¾ãã </simpara> <simpara> + <function>print_r</function>ã¯ãé åãã¤ã³ã¿ãçµç«¯ã¾ã§ç§»åããã + ã¨ã«æ³¨æãã¦ä¸ããããã¤ã³ã¿ãæåã«æ»ãããã« + <function>reset</function>ã使ç¨ãã¦ä¸ããã + </simpara> + <simpara> <function>print_r</function>ã <function>var_dump</function>ã¨æ¯è¼ãã¦ã¿ã¦ä¸ããã </simpara> @@ -817,6 +822,75 @@ </refsect1> </refentry> + <refentry id="function.serialize"> + <refnamediv> + <refname>serialize</refname> + <refpurpose> + å¤ã®ä¿åå¯è½ãªè¡¨ç¾ãçæãã + </refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>string <function>serialize</function></funcdef> + <paramdef>mixed <parameter>value</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <function>serialize</function> ã¯ã<parameter>value</parameter>ã® + ä¿åå¯è½ãªãã¤ãã¹ããªã¼ã 表ç¾ãå«ãæååãè¿ãã¾ãã + </simpara> + <simpara> + åãæ§é ã失ããã«PHPã®å¤ãä¿åã¾ãã¯æ¸¡ãéã«æå¹ã§ãã + </simpara> + <simpara> + ã·ãªã¢ã«åãããæååãPHPã®å¤ã«æ»ãã«ã¯ã + <function>unserialize</function>ã使ç¨ãã¦ä¸ããã + <function>serialize</function>ã¯å<type>integer</type>, + <type>double</type>,<type>string</type>,<type>array</type> + (夿¬¡å ),<type>object</type> + (ãªãã¸ã§ã¯ãããããã£ã¯ã·ãªã¢ã«åããã¾ãããã¡ã½ããã¯å¤±ããã¾ã) + ã«å¯¾å¿ãã¾ãã + </simpara> + <note> + <para> + PHP 3ã§ã¯ãã¡ã½ããã¯ã·ãªã¢ã«åããããªãã¸ã§ã¯ããéã·ãªã¢ã«å + ããéã«ä¿åããã¾ãããPHP 4ã§ã¯ãã®å¶éã¯åãé¤ããããããã㣠+ ã¨ã¡ã½ããã®ä¸¡æ¹ãä¿åãã¾ããããè©³ç´°ãªæ å ±ã«ã¤ãã¦ã¯ã + <link linkend="language.oop">ãªãã¸ã§ã¯ãã¨ã¯ã©ã¹</link> ã® + <link linkend="language.oop.serialization">ãªãã¸ã§ã¯ãã®ã·ãªã¢ + ã«å</link>ã®ç¯ãåç §ä¸ããã + </para> + </note> + <para> + <example> + <title><function>serialize</function>ã®ä¾</title> + <programlisting role="php"> +// $session_data ã¯ã«ã¬ã³ãã¦ã¼ã¶ã¼ã®ã»ãã·ã§ã³æ å ±ãå«ã夿¬¡å é åã +// ä¿æãã¦ãã¾ãããªã¯ã¨ã¹ãã®æå¾ã«ããããã¼ã¿ãã¼ã¹ã«ä¿åããããã« +// serialize() ã使ç¨ãã¾ãã + +$conn = odbc_connect("webdb", "php", "chicken"); +$stmt = odbc_prepare($conn, + "UPDATE sessions SET data = ? WHERE id = ?"); +$sqldata = array(serialize($session_data), $PHP_AUTH_USER); +if (!odbc_execute($stmt, &$sqldata)) { + $stmt = odbc_prepare($conn, + "INSERT INTO sessions (id, data) VALUES(?, ?)"); + if (!odbc_execute($stmt, &$sqldata)) { + /* ä½ãåé¡ããã£ãããã§ããBitch, whine and moan. */ + } +} + </programlisting> + </example> + </para> + <para> + <function>unserialize</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.settype"> <refnamediv> <refname>settype</refname> @@ -898,6 +972,69 @@ </refsect1> </refentry> + <refentry id="function.unserialize"> + <refnamediv> + <refname>unserialize</refname> + <refpurpose>ä¿åç¨è¡¨ç¾ãã PHP ã®å¤ãçæãã</refpurpose> + </refnamediv> + <refsect1> + <title>説æ</title> + <funcsynopsis> + <funcprototype> + <funcdef>mixed <function>unserialize</function></funcdef> + <paramdef>string <parameter>str</parameter></paramdef> + </funcprototype> + </funcsynopsis> + <simpara> + <function>unserialize</function> ã¯ãã·ãªã¢ã«åããã夿° + (<function>serialize</function> ãåç §) ãã¨ããPHP 夿°å¤ã« + æ»ã夿ãè¡ãã¾ãã夿ãããå¤ãè¿ããã¾ãããã®å¤ã¯ã + <type>integer</type>, <type>double</type>, + <type>string</type>, <type>array</type> , <type>object</type> + ã¨ãããã¨ãå¯è½ã§ãããªãã¸ã§ã¯ããã·ãªã¢ã«åãããå ´åãè¿ãå¤ + ã«ãã®ã¡ã½ããã¯ä¿åããã¦ãã¾ããã + </simpara> + <note> + <para> + PHP 3ã§ã¯ãã¡ã½ããã¯ã·ãªã¢ã«åããããªãã¸ã§ã¯ããéã·ãªã¢ã«å + ããéã«ä¿åããã¾ãããPHP 4ã§ã¯ãã®å¶éã¯åãé¤ããããããã㣠+ ã¨ã¡ã½ããã®ä¸¡æ¹ãä¿åãã¾ããããè©³ç´°ãªæ å ±ã«ã¤ãã¦ã¯ã + <link linkend="language.oop">ãªãã¸ã§ã¯ãã¨ã¯ã©ã¹</link> ã® + <link linkend="language.oop.serialization">ãªãã¸ã§ã¯ãã®ã·ãªã¢ + ã«å</link>ã®ç¯ãåç §ä¸ããã + </para> + </note> + <para> + <example> + <title><function>unserialize</function>ã®ä¾</title> + <programlisting role="php"> +// ããã§ããã¼ã¿ãã¼ã¹ãã $session_data ã«ã»ãã·ã§ã³ãã¼ã¿ããã¼ã +// ããããã« unserialize() ã使ç¨ãã¾ãã +// ãã®ä¾ã¯ã<function>serialize</function> ã§è¨è¿°ãããä¾ãè£è¶³ãããã®ã§ãã + +$conn = odbc_connect("webdb", "php", "chicken"); +$stmt = odbc_prepare($conn, "SELECT data FROM sessions WHERE id = ?"); +$sqldata = array($PHP_AUTH_USER); +if (!odbc_execute($stmt, &$sqldata) || !odbc_fetch_into($stmt, &$tmp)) { + // å®è¡ã¾ãã¯åå¾ã失æããå ´åã空ã®é åã§åæåãã¾ã + $session_data = array(); +} else { + // $tmp[0] ã«ã·ãªã¢ã«åããããã¼ã¿ãä¿æãã¦ããå¿ è¦ãããã¾ãã + $session_data = unserialize($tmp[0]); + if (!is_array($session_data)) { + // ä½ãåé¡ããã£ãããã空ã®é åã§åæåãã¾ãã + $session_data = array(); + } +} + </programlisting> + </example> + </para> + <para> + <function>serialize</function>ãåç §ä¸ããã + </para> + </refsect1> + </refentry> + <refentry id="function.unset"> <refnamediv> <refname>unset</refname> Index: phpdoc/ja/functions/xml.xml diff -u phpdoc/ja/functions/xml.xml:1.10 phpdoc/ja/functions/xml.xml:1.11 --- phpdoc/ja/functions/xml.xml:1.10 Thu Jan 4 22:29:05 2001 +++ phpdoc/ja/functions/xml.xml Sun May 20 00:43:02 2001 @@ -396,18 +396,18 @@ } function startElement($parser, $name, $attribs){ - print "&lt;<font color=\"#0000cc\">$name</font>"; + print "&lt;<font color=\"#0000cc\">$name</font>"; if (sizeof($attribs)) { while (list($k, $v) = each($attribs)) { - print " <font color=\"#009900\">$k</font>=\"<font - color=\"#990000\">$v</font>\""; + print " <font color=\"#009900\">$k</font>=\"<font + color=\"#990000\">$v</font>\""; } } print "&gt;"; } function endElement($parser, $name){ - print "&lt;/<font color=\"#0000cc\">$name</font>&gt;"; + print "&lt;/<font color=\"#0000cc\">$name</font>&gt;"; } function characterData($parser, $data){ @@ -432,7 +432,7 @@ function defaultHandler($parser, $data){ if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - printf('<font color="#aa00aa">%s</font>', htmlspecialchars($data)); + printf('<font color="#aa00aa">%s</font>', htmlspecialchars($data)); } else { printf('<font size="-1">%s</font>', htmlspecialchars($data)); } @@ -1059,7 +1059,7 @@ </para> <para> å¤é¨ã¨ã³ãã£ãã£å®£è¨ã®è¨è¿°ç¨å®ç¾©ã«é¢ãã¦ã¯ã - <ulink url="&url.rec-xml;#sec-external-ent">XML 1.0 仿§ã® 4.2.2 + <ulink url="&url.rec-xml;#sec-external-ent">XML 1.0 仿§ã® 4.2.2 ç¯</ulink>ãåç §ä¸ããã </para> <para> @@ -1179,7 +1179,7 @@ > | <parameter>publicId</parameter >}></programlisting> è¡¨è¨æ³å®£è¨ã®å®ç¾©ã«é¢ãã¦ã¯ã - <ulink url="&url.rec-xml;#Notations">XML 1.0 仿§ã® 4.7 ç¯</ulink> + <ulink url="&url.rec-xml;#Notations">XML 1.0 仿§ã® 4.7 ç¯</ulink> ãåç §ä¸ããã </para> <para> Index: phpdoc/ja/language/oop.xml diff -u phpdoc/ja/language/oop.xml:1.7 phpdoc/ja/language/oop.xml:1.8 --- phpdoc/ja/language/oop.xml:1.7 Sat Mar 10 21:56:44 2001 +++ phpdoc/ja/language/oop.xml Sun May 20 00:43:02 2001 @@ -38,11 +38,40 @@ ãã®ä¾ã¯ãç± ã®ä¸ã®ç©ã¨ç± ã«ã¢ã¤ãã ãå ãããé¤ãããããäºã¤ã®é¢æ°ã¸ã® 飿³é åãããªã Cart ã¨ããååã®ã¯ã©ã¹ãå®ç¾©ãã¾ãã </para> + + <caution> + <simpara> + 以ä¸ã®æ³¨ææ¸ãã¯PHP 4ã«é¢ãããã®ã§ãã + </simpara> + + <simpara> + åå<literal>stdClass</literal>ã¯ãZendã«ããå é¨çã«ä½¿ç¨ãããä¿ + åããã¦ãã¾ããPHPã§<literal>stdClass</literal>ã¨ããååã®ã¯ã© + ã¹ã使ç¨ãããã¨ã¯ã§ãã¾ããã + </simpara> + + <simpara> + The function names <literal>__sleep</literal> and + <literal>__wakeup</literal> are magical in PHP classes. You + cannot have functions with these names in any of your + classes unless you want the magic functionality associated + with them. See below for more information. + </simpara> + + <simpara> + PHP reserves all function names starting with __ as magical. + It is recommended that you do not use function names with + __ in PHP unless you want some documented magic functionality. + </simpara> + </caution> + <note> <simpara> PHP 4ã§ã¯ã夿°<literal>var</literal>ã«ã¤ãã¦ã¯å®æ°ã«ããåæåã® - ã¿ãå¯è½ã§ãã宿°ä»¥å¤ã§åæåãè¡ãå ´åã«ã¯ã³ã³ã¹ãã©ã¯ã¿ãä½¿ç¨ - ãã¦ä¸ããã + ã¿ãå¯è½ã§ãã宿°ä»¥å¤ã§åæåãè¡ãå ´åã«ã¯åæå颿°ãå¿ è¦ã§ãã + ãã®åæå颿°ã¯ããªãã¸ã§ã¯ããã¯ã©ã¹ããæ§ç¯ãããéã«èªåçã« + ã³ã¼ã«ããã¾ãããã®ãããªé¢æ°ã¯ã³ã³ã¹ãã©ã¯ã¿ã¨å¼ã°ãã¾ãã(ä»¥ä¸ + åç §) </simpara> <informalexample> <programlisting role="php"> @@ -69,32 +98,96 @@ </informalexample> </note> <para> - ã¯ã©ã¹ã¯åãã¤ã¾ããå®éã®å¤æ°ã®éåã§ãã - new æ¼ç®åã«ããææã®åã®å¤æ°ã使ããå¿ è¦ãããã¾ãã + ã¯ã©ã¹ã¯åãã¤ã¾ããå®éã®å¤æ°ã®éåã§ãã<literal>new</literal>æ¼ + ç®åã«ããææã®åã®å¤æ°ã使ããå¿ è¦ãããã¾ãã </para> <informalexample> <programlisting role="php"> -$cart = new Cart; -$cart->add_item("10", 1); + $cart = new Cart; + $cart->add_item("10", 1); + + $another_cart = new Cart; + $another_cart->add_item("0815", 3); </programlisting> </informalexample> <para> - ãã®ä¾ã¯ãã¯ã©ã¹ Cart ã®ãªãã¸ã§ã¯ã $cart ã使ãã¾ãã - ãªãã¸ã§ã¯ãã®é¢æ° add_item() ãçªå·10 ã®ç©ãç± ã«å ããããã«ã³ã¼ã«ãã - ã¦ãã¾ãã + ãã®ä¾ã¯ãã¯ã©ã¹Cartã®ãªãã¸ã§ã¯ã $cartããã³$another_cartã使 + ãã¾ãã$cartãªãã¸ã§ã¯ãã®é¢æ° add_item()ãååçªå·10ã®ååä¸ã¤ã + ã«ã¼ãã«è¿½å ããã¦ãã¾ããååçªå·0815ã®åå3ã¤ã$another_cartã«è¿½ + å ããã¦ãã¾ãã </para> + <para> - ã¯ã©ã¹ã¯ãä»ã®ã¯ã©ã¹ãæ¡å¼µãããã¨ã«ãã使ãããã¨ãã§ãã¾ãã - æ¡å¼µã¾ãã¯æ´¾çã¯ã©ã¹ã¯ãåºåºã¯ã©ã¹ã®å ¨ã¦ã®å¤æ°ã¨é¢æ°ãããã¦ã - æ¡å¼µããéã®å®ç¾©ã«ããå ãããããã®ãä¿æãã¦ãã¾ãã - ãã®å®ç¾©ã¯ãextends ãã¼ã¯ã¼ãã«ããè¡ãªããã¨ãã§ãã¾ãã - å¤éç¶æ¿ã¯ãµãã¼ãããã¦ãã¾ããã + Both, $cart and $another_cart, have functions add_item(), + remove_item() and a variable items. These are distinct + functions and variables. You can think of the objects as + something similar to directories in a filesystem. In a + filesystem you can have two different files README.TXT, as + long as they are in different directories. Just like with + directories where you'll have to type the full pathname in + order to reach each file from the toplevel directory, you + have to specify the complete name of the function you want + to call: In PHP terms, the toplevel directory would be the + global namespace, and the pathname separator would be ->. + Thus, the names $cart->items and $another_cart->items + name two different variables. Note that the variable is + named $cart->items, not $cart->$items, that is, a + variable name in PHP has only a single dollar sign. </para> - + <informalexample> <programlisting role="php"> +// correct, single $ +$cart->items = array("10" => 1); + +// invalid, because $cart->$items becomes $cart->"" +$cart->$items = array("10" => 1); + +// correct, but may or may not be what was intended: +// $cart->$myvar becomes $ncart->items +$myvar = 'items'; +$cart->$myvar = array("10" => 1); + </programlisting> + </informalexample> + + <para> + Within a class definition, you do not know under which name the object will + be accessible in your program: At the time the Cart class was + written, it was unknown that the object will be named $cart or + $another_cart later. Thus, you cannot write $cart->items within + the Cart class itself. Instead, in order to be able to access it's own + functions and variables from within a class, one can use the + pseudo-variable $this which can be read as 'my own' or + 'current object'. Thus, '$this->items[$artnr] += $num' can + be read as 'add $num to the $artnr counter of my own items + array' or 'add $num to the $artnr counter of the items array + within the current object'. + </para> + </sect1> + + <sect1 id="keyword.extends"> + <title><literal>extends</literal></title> + + <para> + Often you need classes with similar variables and functions + to another existing class. In fact, it is good practice to + define a generic class which can be used in all your + projects and adapt this class for the needs of each of your + specific projects. To facilitate this, Classes can be + extensions of other classes. The extended or derived class + has all variables and functions of the base class (this is + called 'inheritance' despite the fact that nobody died) and what + you add in the extended definition. It is not possible to + substract from a class, that is, to undefine any existing + functions or variables. An extended class is always dependent + on a single base class, that is, multiple inheritance is + not supported. Classes are extended using the keyword 'extends'. + </para> + + <informalexample> + <programlisting role="php"> class Named_Cart extends Cart { var $owner; @@ -107,7 +200,7 @@ <para> ãã®ä¾ã¯ãCart ã®å ¨ã¦ã®å¤æ°åã³é¢æ°ã«å ãã¦å¤æ° $owner 㨠- 颿° $set_owner ãä¿æããã¯ã©ã¹ Named_Cart ãå®ç¾©ãã¦ãã¾ãã + 颿° set_owner() ãä¿æããã¯ã©ã¹ Named_Cart ãå®ç¾©ãã¦ãã¾ãã ãã®å®ç¾©ã«ãããååä»ãã®ç± ãéå¸¸ã®ææ®µã§ä½æããç± ã®ä¿æè ã è¨å®ãããå¾ãããããã¨ãã§ãã¾ãã ååä»ãã®ç± ã§å ã®ç± ã¯ã©ã¹ã®é¢æ°ã使ããã¨ãå¯è½ã§ãã @@ -122,35 +215,31 @@ </programlisting> </informalexample> - <para> - ã¯ã©ã¹ã«ããã颿°ã®ä¸ã§ã¯ã夿° $this ã¯ãã®ãªãã¸ã§ã¯ãèªèº«ãæ - å³ãã¾ãããªãã¸ã§ã¯ãã®ä¸ã§ã¯ãä½ããã®ã¯ã©ã¹å¤æ°ã颿°ã«ã¢ã¯ã»ã¹ - ãããå ´åã« $this->something ã使ãå¿ è¦ãããã¾ãããªãã¸ã§ã¯ãã® - å é¨ã¾ãã¯å¤é¨ã®å ´åããã®ãªãã¸ã§ã¯ãã®ããããã£ã«ã¢ã¯ã»ã¹ããé - ã« $ ã¯ä¸è¦ã§ãã - </para> - - <informalexample> - <programlisting role="php"> -$ncart->owner = "chris"; // $ ã¯ä¸è¦ + </sect1> -$ncart->$owner = "chris"; -// $ncart->$owner = $ncart->"" ãªã®ã§ããã¯èª¤ã + <sect1 id="language.oop.constructor"> + <title><literal>ã³ã³ã¹ãã©ã¯ã¿</literal></title> -$myvar = 'owner'; -$ncart->$myvar = "chris"; -// $ncart->$myvar = $ncart->ownerãªã®ã§ããã¯æå¹ - </programlisting> - </informalexample> + <caution> + <simpara> + In PHP 3 and PHP 4 constructors behave differently. The PHP 4 + semantics are strongly preferred. + </simpara> + </caution> <para> - ã³ã³ã¹ãã©ã¯ã¿ã¯ãã¯ã©ã¹ã®æ°ããã¤ã³ã¹ã¿ã³ã¹ã使ããéã« - èªåçã«ã³ã¼ã«ãããã¯ã©ã¹é¢æ°ã§ãã - 颿°ã¯ãã¯ã©ã¹ã¨åãååãæããéã«ã³ã³ã¹ãã©ã¯ã¿ã¨ãªãã¾ãã + ã³ã³ã¹ãã©ã¯ã¿ã¯ã<literal>new</literal>ã«ããã¯ã©ã¹ã®æ°ããã¤ã³ã¹ + ã¿ã³ã¹ã使ããéã«èªåçã«ã³ã¼ã«ãããã¯ã©ã¹é¢æ°ã§ãã + PHP 3ã§ã¯ããã颿°ããã¯ã©ã¹åã¨åãååãæãã¦ããå ´åã«ã³ã³ã¹ + ãã©ã¯ã¿ã«ãªãã¾ãããPHP 4ã§ã¯ããã颿°ãããã®ã³ã³ã¹ãã©ã¯ã¿ã + å®ç¾©ããã¦ããã¯ã©ã¹ã¨åãååãæãã¦ããå ´åã«ã³ã³ã¹ãã©ã¯ã¿ã«ãª + ãã¾ãããããã®éãã¯å ãã§ãããéè¦ãªéããããã¾ãã(以ä¸ãå + ç §) </para> - + <informalexample> <programlisting role="php"> +// Works in PHP 3 and PHP 4. class Auto_Cart extends Cart { function Auto_Cart () { $this->add_item ("10", 1); @@ -162,13 +251,16 @@ <para> ãã®ä¾ã¯ãCart ã«ã³ã³ã¹ãã©ã¯ã¿ãå ããã¯ã©ã¹ Auto_Cart ãå®ç¾©ãã¦ãã¾ãã ãã®ã³ã³ã¹ãã©ã¯ã¿ã¯ã"new" ã«ããæ°ãã Auto_Cart ã使ããã度㫠- ç± ã« 10 çªã®ç©ãä¸ã¤ä¿æããããã«åæåãã¾ãã - ã³ã³ã¹ãã©ã¯ã¿ã¯ããªãã·ã§ã³ã¨ãã¦å¼æ°ãã¨ãã¾ãã - ããã«ãããã³ã³ã¹ãã©ã¯ã¿ã¯é常ã«ä¾¿å©ãªãã®ã¨ãªãã¾ãã + ç± ã«10çªã®ç©ãä¸ã¤ä¿æããããã«åæåãã¾ããã³ã³ã¹ãã©ã¯ã¿ã¯ã㪠+ ãã·ã§ã³ã¨ãã¦å¼æ°ãã¨ãã¾ããããã«ãããã³ã³ã¹ãã©ã¯ã¿ã¯é常ã«ä¾¿ + å©ãªãã®ã¨ãªãã¾ããTo be able to still use the class + without parameters, all parameters to constructors should be + made optional by providing default values. </para> <informalexample> <programlisting role="php"> +// Works in PHP 3 and PHP 4. class Constructor_Cart extends Cart { function Constructor_Cart ($item = "10", $num = 1) { $this->add_item ($item, $num); @@ -184,18 +276,378 @@ $different_cart = new Constructor_Cart ("20", 17); </programlisting> </informalexample> - + <caution> <simpara> - æ´¾çã¯ã©ã¹ã®å ´åãæ´¾çã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ãã³ã¼ã«ãããæã«ã - 親ã¯ã©ã¹ã®ã³ã³ã¹ãã©ã¯ã¿ãèªåçã«ã³ã¼ã«ãããã¨ãããã¨ã¯ããã¾ - ããã + In PHP 3, derived classes and constructors have a number of + limitations. The following examples should be read carefully + to understand these limitations. + </simpara> + </caution> + + <informalexample> + <programlisting role="php"> +class A { + function A() { + echo "I am the constructor of A.<br>\n"; + } +} + +class B extends A { + function C() { + "I am a regular function.<br>\n"; + } +} + +// no constructor is being called in PHP 3. +$b = new B; + </programlisting> + </informalexample> + + <para> + In PHP 3, no constructor is being called in the above example. + The rule in PHP 3 is: 'A constructor is a function of the same + name as the class.'. The name of the class is B, and there is + no function called B() in class B. Nothing happens. + </para> + + <para> + This is fixed in PHP 4 by introducing another rule: If a class + has no constructor, the constructor of the base class is being + called, if it exists. The above example would have printed + 'I am the constructor of A.<br>' in PHP 4. + </para> + + <informalexample> + <programlisting role="php"> +class A { + function A() { + echo "I am the constructor of A.<br>\n"; + } + + function B() { + echo "I am a regular function named B in class A.<br>\n"; + echo "I am not a constructor in A.<br>\n"; + } +} + +class B extends A { + function C() { + echo "I am a regular function.<br>\n"; + } +} + +// This will call B() as a constructor. +$b = new B; + </programlisting> + </informalexample> + + <para> + In PHP 3, the function B() in class A will suddenly become a + constructor in class B, although it was never intended to be. + The rule in PHP 3 is: 'A constructor is a function of the same + name as the class.'. PHP 3 does not care if the function is + being defined in class B, or if it has been inherited. + </para> + + <para> + This is fixed in PHP 4 by modifying the rule to: 'A constructor + is a function of the same name as the class it is being defined + in.'. Thus in PHP 4, the class B would have no constructor function + of its own and the constructor of the base class would have been + called, printing 'I am the constructor of A.<br>'. + </para> + + <caution> + <simpara> + Neither PHP 3 nor PHP 4 call constructors of the base class + automatically from a constructor of a derived class. It is + your responsibility to propagate the call to constructors + upstream where appropriate. </simpara> </caution> + + <note> + <simpara> + There are no destructors in PHP 3 or PHP 4. You may use + <function>register_shutdown_function</function> instead + to simulate most effects of destructors. + </simpara> + </note> + + <para> + Destructors are functions that are called automatically + when a variable is destroyed, either with <function>unset</function> + or by simply going out of scope. There are no destructors + in PHP. + </para> </sect1> - - <sect1 id="language.oop.newref"> - <title>ã³ã³ã¹ãã©ã¯ã¿ã®ä¸ã§ã®åç §</title> + + <sect1 id="keyword.paamayim_nekudotayim"><!-- :-) --> + <title><literal>::</literal></title> + + <caution> + <simpara> + The following is valid for PHP 4 only. + </simpara> + </caution> + + <para> + Sometimes it is useful to refer to functions and variables + in base classes or to refer to functions in classes that + have not yet any instances. The :: operator is being used + for this. + </para> + + <informalexample> + <programlisting role="php"> +class A { + function example() { + echo "I am the original function A::example().<br>\n"; + } +} + +class B extends A { + function example() { + echo "I am the redefined function B::example().<br>\n"; + A::example(); + } +} + +// there is no object of class A. +// this will print +// I am the original function A::example().<br> +A::example(); + +// create an object of class B. +$b = new B; + +// this will print +// I am the redefined function B::example().<br> +// I am the original function A::example().<br> +$b->example(); + </programlisting> + </informalexample> + + <para> + The above example calls the function example() in + class A, but there is no object of class A, so that + we cannot write $a->example() or similar. Instead we + call example() as a 'class function', that is, as a + function of the class itself, not any object of that + class. + </para> + + <para> + There are class functions, but there are no class variables. + In fact, there is no object at all at the time of the call. + Thus, a class function may not use any object variables (but + it can use local and global variables), and it may no use + $this at all. + </para> + + <para> + In the above example, class B redefines the function example(). + The original definition in class A is shadowed + and no longer available, unless you are refering specifically + to the implementation of example() in class A using the + ::-operator. Write A::example() to do this (in fact, you + should be writing parent::example(), as shown in the next + section). + </para> + + <para> + In this context, there is a current object and it may + have object variables. Thus, when used from WITHIN an + object function, you may use $this and object variables. + </para> + + </sect1> + + <sect1 id="keyword.parent"> + <title><literal>親ã¯ã©ã¹</literal></title> + + <para> + You may find yourself writing code that refers to + variables and functions in base classes. This is + particularly true if your derived class is a refinement + or specialisation of code in your base class. + </para> + + <para> + Instead of using the literal name of the base class in your + code, you should be using the special name + <literal>parent</literal>, which refers to the name of your + base class as given in the <literal>extends</literal> + declation of your class. By doing this, you avoid using the + name of your base class in more than one place. Should + your inheritance tree change during implementation, the + change is easily made by simply changing the + <literal>extends</literal> declaration of your class. + </para> + + <informalexample> + <programlisting role="php"> +class A { + function example() { + echo "I am A::example() and provide basic functionality.<br>\n"; + } +} + +class B extends A { + function example() { + echo "I am B::example and provide additional functionality().<br>\n"; + parent::example(); + } +} + +$b = new B; + +// This will call B::example(), which will in turn call A::example(). +$b->example(); + </programlisting> + </informalexample> + </sect1> + + <sect1 id="language.oop.serialization"> + <title>Serializing objects - objects in sessions</title> + + <note> + <simpara> + In PHP 3, objects will lose their class association + throughout the process of serialization and unserialization. + The resulting variable is of type object, but has no class + and no methods, thus it is pretty useless (it has become + just like an array with a funny syntax). + </simpara> + </note> + + <caution> + <simpara> + The following information is valid for PHP 4 only. + </simpara> + </caution> + + <para> + <function>serialize</function> returns a string containing a + byte-stream representation of any value that can be stored in + PHP. <function>unserialize</function> can use this string to + recreate the original variable values. Using serialize to + save an object will save all variables in an object. The + functions in an object will not be saved, only the name of + the class. + </para> + + <para> + In order to be able to <function>unserialize</function> an + object, the class of that object needs to be defined. That + is, if you have an object $a of class A on page1.php and + serialize this, you'll get a string that refers to class A + and contains all values of variabled contained in $a. If + you want to be able to unserialize this on page2.php, + recreating $a of class A, the definition of class A must + be present in page2.php. This can be done for example + by storing the class defintion of class A in an include + file and including this file in both page1.php and page2.php. + </para> + + <informalexample> + <programlisting role="php"> +classa.inc: + class A { + var $one = 1; + + function show_one() { + echo $this->one; + } + } + +page1.php: + include("classa.inc"); + + $a = new A; + $s = serialize($a); + // store $s somewhere where page2.php can find it. + $fp = fopen("store", "w"); + echo $s; + fclose($fp); + +page2.php: + // this is needed for the unserialize to work properly. + include("classa.inc"); + + $s = implode("", @file("store")); + unserialize($s); + + // now use the function show_one of the $a object. + $a->show_one(); + </programlisting> + </informalexample> + + <para> + If you are using sessions and use <function>session_register</function> + to register objects, these objects are serialized automatically + at the end of each PHP page, and are unserialized automatically on + each of the following pages. This basically means that these objects + can show up on any of your pages once they become part of your + session. + </para> + + <para> + It is strongly recommended that you include the class + definitions of all such registered objects on all of your + pages, even if you do not actually use these classes on all + of your pages. If you don't and an object is being + unserialized without its class definition being present, it + will lose its class association and become an object of class + <literal>stdClass</literal> without any functions available + at all, that is, it will become quite useless. + </para> + + <para> + So if the in the example above $a became part of a session by + running <literal>session_register("a")</literal>, you should + include the file <literal>classa.inc</literal> on all of your + pages, not only page1.php and page2.php. + </para> + </sect1> + + <sect1 id="language.oop.magic-functions"> + <title>The magic functions <literal>__sleep</literal> and <literal>__wakeup</literal></title> + + <para> + <function>serialize</function> checks if your class has a function with + the magic name <literal>__sleep</literal>. If so, that function is + being run prior to any serialization. It can clean up the object + and is supposed to return an array with the names of all variables + of that object that should be serialized. + </para> + + <para> + The intended use of <literal>__sleep</literal> is to close any + database connections that object may have, committing pending + data or perform similar cleanup tasks. Also, the function is + useful if you have very large objects which need not be + saved completely. + </para> + + <para> + Conversely, <function>unserialize</function> checks for the + presence of a function with the magic name + <literal>__wakeup</literal>. If present, this function can + reconstruct any ressources that object may have. + </para> + + <para> + The intended use of <literal>__wakeup</literal> is to + reestablish any database connections that may have been lost + during serialization and perform other reinitialization + tasks. + </para> + </sect1> + + <sect1 id="language.oop.newref"> + <title>ã³ã³ã¹ãã©ã¯ã¿ã®å é¨ã§ã®åç §</title> <para> ã³ã³ã¹ãã©ã¯ã¿ã®ä¸ã§åç §ã使ããã¨çµæãæ··ä¹±ããå¯è½æ§ãããã¾ãã æ¬ç¯ã§ã¯ãã¥ã¼ããªã¢ã«å½¢å¼ã§èª¬æãã¾ããããã®åé¡ãé¿ããããã«å½¹ @@ -219,14 +671,14 @@ echo "<br>",$this->Name; } - function setName($name) { - $this->Name = $name; + function setName($name) { + $this->Name = $name; } } - </programlisting> - </informalexample> - </para> - + </programlisting> + </informalexample> + </para> + <para> ã³ãã¼æ¼ç®å <literal>=</literal> ã«ãã使ããã <varname>$bar1</varname> 㨠åç §æ¼ç®å <literal>=&</literal> @@ -276,7 +728,7 @@ </note> ä¸è¨ã®è¨è¿°ãæ£ãããã¨ã示ãããã«ä»¥ä¸ã®ã³ã¼ããè¦ã¦ã¿ã¾ãããã - <informalexample> + <informalexample> <programlisting role="php"> // ããã§ãname ã夿´ãã¦ã¿ã¾ããã©ããªãã§ãããã? // $bar 㨠$globalref[0] ã®ä¸¡æ¹å ±ååãå¤ããã¨äºæ³ããããããã¾ãã... @@ -298,22 +750,23 @@ $globalref[1]->echoName(); /* åºå: -set from outside set from outside */ + set from outside + set from outside */ - </programlisting> + </programlisting> </informalexample> </para> <para> - å¥ã®æå¾ã®ä¾ã«ã¤ãã¦èãã¦ã¿ã¦ä¸ããã - + æå¾ã«å¥ã®ä¾ã«ã¤ãã¦èãã¦ã¿ã¦ä¸ããã + <informalexample> <programlisting role="php"> - + class a { function a($i) { - $this->value = $i; - // ããã§åç §ã使ãå¿ è¦ããªãçç±ãèãã¦ã¿ã¦ä¸ãã - $this->b = new b($this); + $this->value = $i; + // ããã§åç §ã使ãå¿ è¦ããªãçç±ãèãã¦ã¿ã¦ä¸ãã + $this->b = new b($this); } function createRef() { @@ -366,7 +819,7 @@ </informalexample> </para> </sect1> - + </chapter> <!-- Keep this comment at the end of the file Index: phpdoc/ja/pear/standards.xml diff -u phpdoc/ja/pear/standards.xml:1.4 phpdoc/ja/pear/standards.xml:1.5 --- phpdoc/ja/pear/standards.xml:1.4 Fri Apr 13 07:03:33 2001 +++ phpdoc/ja/pear/standards.xml Sun May 20 00:43:02 2001 @@ -1,6 +1,12 @@ <chapter id="pear.standards"> <title>PEAR ã³ã¼ãã£ã³ã°æ¨æº</title> - + <note> + <simpara> + PEARã³ã¼ãã£ã³ã°æ¨æº(PEAR Coding Standards)ã¯ãPHPã¨å ±ã«é å¸ããã + ããPEARã®ã¤ã³ã¹ãã¼ã«ãã¼ã«ã«ãããã¦ã³ãã¼ãå¯è½ã§ãããã«ãããã + PEARã«ã¨ããã¾ããã³ã¼ãã«é©ç¨ãã¾ãã + </simpara> + </note> <sect1 id="pear.standards.indenting"> <title>ã¤ã³ãã³ã</title> <para> @@ -14,7 +20,10 @@ (setq tab-width 4 c-basic-offset 4 c-hanging-comment-ender-p nil - indent-tabs-mode nil)) + indent-tabs-mode + (not + (and (string-match "/\\(PEAR\\|pear\\)/" (buffer-file-name)) + (string-match "\.php$" (buffer-file-name)))))) </programlisting> </para> <para>