cvs: phpdoc-ja /reference/mysql constants.xml /reference/mysql/functions mysql-client-encoding.xml mysql-info.xml mysql-list-processes.xml
mysql-ping.xml mysql-real-escape-string.xml mysql-stat.xml mysql-thread-id.xml mysql-unbuffered-query.xml

From: Date: Sat, 06 Aug 2005 22:41:39 +0000
Subject: cvs: phpdoc-ja /reference/mysql constants.xml /reference/mysql/functions mysql-client-encoding.xml mysql-info.xml mysql-list-processes.xml
mysql-ping.xml mysql-real-escape-string.xml mysql-stat.xml mysql-thread-id.xml mysql-unbuffered-query.xml
Groups: php.doc.ja 
Request: Send a blank email to doc-ja+get-1107@lists.php.net to get a copy of this message
takagi Sat Aug 6 18:41:39 2005 EDT Added files: /phpdoc-ja/reference/mysql/functions mysql-unbuffered-query.xml mysql-thread-id.xml mysql-stat.xml mysql-real-escape-string.xml mysql-ping.xml mysql-list-processes.xml mysql-info.xml mysql-client-encoding.xml /phpdoc-ja/reference/mysql constants.xml Log: added japanese manual.

http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-unbuffered-query.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-unbuffered-query.xml +++ phpdoc-ja/reference/mysql/functions/mysql-unbuffered-query.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.9 Maintainer: takagi Status: ready --> <refentry id="function.mysql-unbuffered-query"> <refnamediv> <refname>mysql_unbuffered_query</refname> <refpurpose>MySQL に SQL クエリを送信するが、結果に対してのフェッチやバッファリングは行わない</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>resource</type><methodname>mysql_unbuffered_query</methodname> <methodparam><type>string</type><parameter>query</parameter></methodparam> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> <function>mysql_unbuffered_query</function> は SQL クエリ <parameter>query</parameter> を MySQL に送信します。その際、 <function>mysql_query</function> が行っているような自動バッファリングを 行いません。一方、この挙動により SQL クエリが消費するメモリの量を おさえられます。また、最初の 1 行目が取得されたらすぐに処理を はじめることができます。SQL の処理が完全に終わるまで待つ必要がありません。 複数の DB 接続を利用する場合には、オプションのパラメータ <parameter>link_identifier</parameter> を指定する必要があります。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>query</parameter></term> <listitem> <para> SQL クエリ。 </para> </listitem> </varlistentry> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> SELECT, SHOW, DESCRIBE あるいは EXPLAIN では、 成功した場合に <type>resource</type> 、エラー時に &false; を返します。 </para> <para> UPDATE, DELETE, DROP, などその他の SQL 文では、 成功した場合に &true; 、エラー時に &false; を返します。 </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; <note> <para> <function>mysql_unbuffered_query</function> の利点には、以下のような 代償があります: <function>mysql_unbuffered_query</function> から返される結果セットには <function>mysql_num_rows</function> や <function>mysql_data_seek</function> が使用できません。また、結果の行をすべてフェッチするまで、MySQL に 新しいクエリを送信することができません。 </para> </note> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_query</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-thread-id.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-thread-id.xml +++ phpdoc-ja/reference/mysql/functions/mysql-thread-id.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.10 Maintainer: takagi Status: ready --> <refentry id="function.mysql-thread-id"> <refnamediv> <refname>mysql_thread_id</refname> <refpurpose>カレントのスレッド ID を返す</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>int</type><methodname>mysql_thread_id</methodname> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> カレントのスレッド ID を取得します。接続が一度切断され、 <function>mysql_ping</function> によって再接続された場合には、 スレッド ID は変わります。つまり、スレッド ID は必要になったその時点で 取得すべきだということです。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> 成功した場合にスレッド ID 、失敗した場合に &false; を返します。 </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mysql_thread_id</function> の例</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $thread_id = mysql_thread_id($link); if ($thread_id){ printf("current thread id is %d\n", $thread_id); } ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ current thread id is 73 ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_ping</function></member> <member><function>mysql_list_processes</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-stat.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-stat.xml +++ phpdoc-ja/reference/mysql/functions/mysql-stat.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.11 Maintainer: takagi Status: ready --> <refentry id="function.mysql-stat"> <refnamediv> <refname>mysql_stat</refname> <refpurpose>カレントのシステム状況を得る</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>mysql_stat</methodname> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> <function>mysql_stat</function> は現在のサーバの状態を返します。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> 稼働時間、スレッド、クエリ、オープンされているテーブル、フラッシュされた テーブル、そして 1 秒あたりのクエリ数を文字列で返します。その他のデータも 含めた完全な状態を得るには、<literal>SHOW STATUS</literal> SQL コマンドを 実行する必要があります。<parameter>link_identifier</parameter> が不正な 場合には &null; が返されます。 </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mysql_stat</function> の例</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $status = explode(' ', mysql_stat($link)); print_r($status); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ Array ( [0] => Uptime: 5380 [1] => Threads: 2 [2] => Questions: 1321299 [3] => Slow queries: 0 [4] => Opens: 26 [5] => Flush tables: 1 [6] => Open tables: 17 [7] => Queries per second avg: 245.595 ) ]]> </screen> </example> </para> <para> <example> <title><function>mysql_stat</function> の別の例</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $result = mysql_query('SHOW VARIABLES', $link); while ($row = mysql_fetch_assoc($result)) { echo $row['Variable_name'] . ' = ' . $row['Value'] . "\n"; } ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ back_log = 50 basedir = /usr/local/ bdb_cache_size = 8388600 bdb_log_buffer_size = 32768 bdb_home = /var/db/mysql/ bdb_max_lock = 10000 bdb_logdir = bdb_shared_data = OFF bdb_tmpdir = /var/tmp/.... ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_get_server_info</function></member> <member><function>mysql_list_processes</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-real-escape-string.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-real-escape-string.xml +++ phpdoc-ja/reference/mysql/functions/mysql-real-escape-string.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.24 Maintainer: takagi Status: ready --> <refentry id="function.mysql-real-escape-string"> <refnamediv> <refname>mysql_real_escape_string</refname> <refpurpose>SQL 文中で用いる文字列の特殊文字をエスケープする</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>mysql_real_escape_string</methodname> <methodparam><type>string</type><parameter>unescaped_string</parameter></methodparam> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> 現在の接続の文字セットで <parameter>unescaped_string</parameter> の 特殊文字をエスケープし、 <function>mysql_query</function> で安全に 利用できる形式に変換します。バイナリデータを挿入しようとしている場合、 必ずこの関数を利用しなければなりません。 </para> <para> <function>mysql_real_escape_string</function> は、MySQL のライブラリ関数 mysql_real_escape_string をコールしています。これは以下の文字について 先頭にバックスラッシュを付加します。 <literal>\x00</literal>, <literal>\n</literal>, <literal>\r</literal>, <literal>\</literal>, <literal>'</literal>, <literal>"</literal> そして <literal>\x1a</literal>. </para> <para> データの安全性を確保するため、MySQL へクエリを送信する場合には (わずかな例外を除いて)常にこの関数を用いなければなりません。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> <varlistentry> <term><parameter>unescaped_string</parameter></term> <listitem> <para> エスケープされる文字列。 </para> </listitem> </varlistentry> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> 成功した場合にエスケープ後の文字列、失敗した場合に &false; を返します。 </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>単純な <function>mysql_real_escape_string</function> の例</title> <programlisting role="php"> <![CDATA[ <?php // 接続 $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password') OR die(mysql_error()); // クエリ $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'", mysql_real_escape_string($user), mysql_real_escape_string($password)); ?> ]]> </programlisting> </example> </para> <para> <example> <title>SQL インジェクション攻撃の例</title> <programlisting role="php"> <![CDATA[ <?php // データベース上のユーザに一致するかどうかを調べる $query = "SELECT * FROM users WHERE user='{$_POST['username']}' AND password='{$_POST['password']}'"; mysql_query($query); // $_POST['password'] をチェックしなければ、このような例でユーザに望みどおりの情報を取得されてしまう $_POST['username'] = 'aidan'; $_POST['password'] = "' OR ''='"; // MySQL に送信されたクエリは、 echo $query; ?> ]]> </programlisting> <para> MySQL に送信されたクエリは次のとおり: </para> <screen> <![CDATA[ SELECT * FROM users WHERE name='aidan' AND password='' OR ''='' ]]> </screen> <para> これでは、パスワードを知らなくても誰でもログインできてしまいます。 </para> </example> </para> <para> <example> <title>"うまいやり方" のクエリ</title> <para> それぞれの変数に <function>mysql_real_escape_string</function> を適用し、 SQL インジェクションを防ぎます。この例では、データベースにクエリを 送信する場合の "うまいやり方" を示します。これは、 <link linkend="security.magicquotes">マジッククオート</link> の設定に依存しません。 </para> <programlisting role="php"> <![CDATA[ <?php // 安全性を確保するために変数をクオートする function quote_smart($value) { // Stripslashes if (get_magic_quotes_gpc()) { $value = stripslashes($value); } // 数値以外をクオートする if (!is_numeric($value)) { $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; } // 接続 $link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password') OR die(mysql_error()); // 安全なクエリの生成 $query = sprintf("SELECT * FROM users WHERE user=%s AND password=%s", quote_smart($_POST['username']), quote_smart($_POST['password'])); mysql_query($query); ?> ]]> </programlisting> <para> これでクエリは正しく実行され、SQL インジェクション攻撃が機能しなくなります。 </para> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; <note> <para> <function>mysql_real_escape_string</function> を利用する前に、MySQL 接続が確立されている必要があります。もし存在しなければ、 <literal>E_WARNING</literal> レベルのエラーが生成され、&false; が返されます。<parameter>link_identifier</parameter> が指定されなかった場合は、 直近の MySQL 接続が用いられます。 </para> </note> <note> <para> <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> が有効な場合は、 まず最初に <function>stripslashes</function> を適用します。そうしないと、 すでにエスケープされているデータに対してさらにエスケープ処理を してしまうことになります。 </para> </note> <note> <para> この関数を用いてデータをエスケープしなければ、クエリは <link linkend="security.database.sql-injection">SQL インジェクション攻撃</link> に対しての脆弱性を持ったものになります。 </para> </note> <note> <simpara> <function>mysql_real_escape_string</function> は <literal>%</literal> や <literal>_</literal> をエスケープしません。 MySQL では、これらの文字を <literal>LIKE</literal>, <literal>GRANT</literal>, または <literal>REVOKE</literal> とともに用いることでワイルドカードを 表現します。 </simpara> </note> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_client_encoding</function></member> <member><function>addslashes</function></member> <member><function>stripslashes</function></member> <member>The <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link> ディレクティブ</member> <member>The <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link> ディレクティブ</member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-ping.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-ping.xml +++ phpdoc-ja/reference/mysql/functions/mysql-ping.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.8 Maintainer: takagi Status: ready --> <refentry id="function.mysql-ping"> <refnamediv> <refname>mysql_ping</refname> <refpurpose>サーバとの接続状況を調べ、接続されていない場合は再接続する</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>bool</type><methodname>mysql_ping</methodname> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> サーバとの接続が有効かどうかを調べます。 もし接続が切れていた場合、自動的に再接続が試みられます。 この関数は、アイドル期間が長いスクリプトで利用し、 サーバが接続を切断したかどうかを確認するために用いられます。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> MySQL サーバとの接続が有効な場合に &true; そうでない場合に &false; を返します。 </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mysql_ping</function> の例</title> <programlisting role="php"> <![CDATA[ <?php set_time_limit(0); $conn = mysql_connect('localhost', 'mysqluser', 'mypass'); $db = mysql_select_db('mydb'); /* このクエリは非常に時間がかかるものと仮定する */ $result = mysql_query($sql); if (!$result) { echo 'Query #1 failed, exiting.'; exit; } /* 接続が有効かどうかを確かめる。切断されていたら再接続する */ if (!mysql_ping($conn)) { echo 'Lost connection, exiting after query #1'; exit; } mysql_free_result($result); /* 接続が有効であることが確かめられたので、別のクエリを実行する */ $result2 = mysql_query($sql2); ?> ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_thread_id</function></member> <member><function>mysql_list_processes</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-list-processes.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-list-processes.xml +++ phpdoc-ja/reference/mysql/functions/mysql-list-processes.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.9 Maintainer: takagi Status: ready --> <refentry id="function.mysql-list-processes"> <refnamediv> <refname>mysql_list_processes</refname> <refpurpose>MySQL プロセスのリストを得る</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>resource</type><methodname>mysql_list_processes</methodname> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> カレントの MySQL サーバのスレッドを取得します。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> 成功した場合に結果ポインタ <type>resource</type> 、 失敗した場合に &false; を返します。 </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mysql_list_processes</function> の例</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $result = mysql_list_processes($link); while ($row = mysql_fetch_assoc($result)){ printf("%s %s %s %s %s\n", $row["Id"], $row["Host"], $row["db"], $row["Command"], $row["Time"]); } mysql_free_result($result); ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ 1 localhost test Processlist 0 4 localhost mysql sleep 5 ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_thread_id</function></member> <member><function>mysql_stat</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-info.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-info.xml +++ phpdoc-ja/reference/mysql/functions/mysql-info.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.9 Maintainer: takagi Status: ready --> <refentry id="function.mysql-info"> <refnamediv> <refname>mysql_info</refname> <refpurpose>直近のクエリについての情報を得る</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>mysql_info</methodname> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> 直近のクエリについての詳細な情報を返します。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> 成功した場合に文についての情報、失敗した場合に &false; を返します。 どんな文が情報を返し、またそれがどのように見えるのかについては、以下の 例を参照ください。ここに挙げられていない文では &false; が返されます。 </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title>該当する MySQL 文</title> <para> 情報を返す文の例です。数値はあくまで説明用の例で、実際の値は クエリの内容によって変わります。 </para> <programlisting role="mysql"> <![CDATA[ INSERT INTO ... SELECT ... String format: Records: 23 Duplicates: 0 Warnings: 0 INSERT INTO ... VALUES (...),(...),(...)... String format: Records: 37 Duplicates: 0 Warnings: 0 LOAD DATA INFILE ... String format: Records: 42 Deleted: 0 Skipped: 0 Warnings: 0 ALTER TABLE String format: Records: 60 Duplicates: 0 Warnings: 0 UPDATE String format: Rows matched: 65 Changed: 65 Warnings: 0 ]]> </programlisting> </example> </para> </refsect1> <refsect1 role="notes"> &reftitle.notes; <note> <para> INSERT ... VALUES 文で <function>mysql_info</function> が非 &false; 値を 返すのは、文中で複数の値のリストが指定された場合に限ります。 </para> </note> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_affected_rows</function></member> <member><function>mysql_insert_id</function></member> <member><function>mysql_stat</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/functions/mysql-client-encoding.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/functions/mysql-client-encoding.xml +++ phpdoc-ja/reference/mysql/functions/mysql-client-encoding.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.9 Maintainer: takagi Status: ready --> <refentry id="function.mysql-client-encoding"> <refnamediv> <refname>mysql_client_encoding</refname> <refpurpose>文字セット名を返す</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; <methodsynopsis> <type>string</type><methodname>mysql_client_encoding</methodname> <methodparam choice="opt"><type>resource</type><parameter>link_identifier</parameter></methodparam> </methodsynopsis> <para> MySQL の <literal>character_set</literal> 変数の値を取得します。 </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> &mysql.linkid.description; </variablelist> </para> </refsect1> <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> カレントの接続から、デフォルトの文字セット名を返します。 </para> </refsect1> <refsect1 role="examples"> &reftitle.examples; <para> <example> <title><function>mysql_client_encoding</function> の例</title> <programlisting role="php"> <![CDATA[ <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); $charset = mysql_client_encoding($link); echo "カレントの文字セットは: $charset\n"; ?> ]]> </programlisting> &example.outputs.similar; <screen> <![CDATA[ カレントの文字セットは: latin1 ]]> </screen> </example> </para> </refsect1> <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>mysql_real_escape_string</function></member> </simplelist> </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/co.php/phpdoc-ja/reference/mysql/constants.xml?r=1.1&p=1 Index: phpdoc-ja/reference/mysql/constants.xml +++ phpdoc-ja/reference/mysql/constants.xml <?xml version="1.0" encoding="utf-8"?> <!-- $Revision: 1.1 $ --> <!-- EN-Revision: 1.7 Maintainer: takagi Status: ready --> <section id="mysql.constants"> &reftitle.constants; &extension.constants; <para> PHP 4.3.0 以降では、<function>mysql_connect</function> や <function>mysql_pconnect</function> で追加のクライアントフラグを 指定できるようになりました。以下の定数が定義されています。 <table> <title>MySQL クライアント定数</title> <tgroup cols="2"> <thead> <row> <entry>定数</entry> <entry>説明</entry> </row> </thead> <tbody> <row> <entry>MYSQL_CLIENT_COMPRESS</entry> <entry>圧縮プロトコルを利用します。</entry> </row> <row> <entry>MYSQL_CLIENT_IGNORE_SPACE</entry> <entry>関数名の後のスペースを許可します。</entry> </row> <row> <entry>MYSQL_CLIENT_INTERACTIVE</entry> <entry>interactive_timeout で指定された秒数(wait_timeout のかわり) の無通信が続くまで接続を閉じません。</entry> </row> <row> <entry>MYSQL_CLIENT_SSL</entry> <entry>SSL による暗号化を使用します。このフラグは、バージョン 4.x 以降の MySQL クライアントライブラリを利用している場合にのみ有効です。 PHP 4 や、Windows 版の PHP 5 にバンドルされているのは、バージョン 3.23.x のライブラリです。 </entry> </row> </tbody> </tgroup> </table> </para> <para> <function>mysql_fetch_array</function> 関数は、結果の配列の形式を 指定するための定数を使用します。以下の定数が定義されています。 <table> <title>MySQL フェッチ定数</title> <tgroup cols="2"> <thead> <row> <entry>定数</entry> <entry>説明</entry> </row> </thead> <tbody> <row> <entry>MYSQL_ASSOC</entry> <entry> カラムは、フィールド名を添字とする配列形式で返されます。 </entry> </row> <row> <entry>MYSQL_BOTH</entry> <entry> カラムは、数値の添字とフィールド名の添字のどちらでもアクセスできる 配列形式で返されます。 </entry> </row> <row> <entry>MYSQL_NUM</entry> <entry> カラムは、数値の添字を持つ配列形式で返されます。添字は 0 からはじまり、 結果の最初のフィールドです。 </entry> </row> </tbody> </tgroup> </table> </para> </section> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.doc.ja (#1107) next »