1
0
mirror of https://github.com/php/doc-ja.git synced 2026-04-23 16:08:07 +02:00
Files
archived-doc-ja/reference/pgsql/functions/pg-result-status.xml
T
2025-09-03 19:43:10 +09:00

149 lines
4.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- splitted from ./ja/functions/pgsql.xml, last change in rev 1.31 -->
<!-- EN-Revision: 3c6c95fcfd7d9eaa603df40327693ea8dff89d53 Maintainer: hirokawa Status: ready -->
<!-- CREDITS: takagi -->
<refentry xml:id="function.pg-result-status" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_result_status</refname>
<refpurpose>
クエリ結果のステータスを取得する
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>string</type><type>int</type></type><methodname>pg_result_status</methodname>
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>PGSQL_STATUS_LONG</constant></initializer></methodparam>
</methodsynopsis>
<para>
<function>pg_result_status</function> は、
<classname>PgSql\Result</classname> インスタンスのステータス
あるいは結果に関するコマンド補完タグを返します。
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
&pgsql.parameter.result;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
<para>
<parameter>result</parameter> の数値ステータスを返す
<constant>PGSQL_STATUS_LONG</constant>、あるいは
<parameter>result</parameter> のコマンドタグを返す
<constant>PGSQL_STATUS_STRING</constant> のいずれかです。
指定しない場合は <constant>PGSQL_STATUS_LONG</constant> がデフォルトです。
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<constant>PGSQL_STATUS_LONG</constant> が指定された場合の戻り値は
以下のいずれかです。
<constant>PGSQL_EMPTY_QUERY</constant>,
<constant>PGSQL_COMMAND_OK</constant>, <constant>PGSQL_TUPLES_OK</constant>, <constant>PGSQL_TUPLES_CHUNK</constant>, <constant>PGSQL_COPY_OUT</constant>,
<constant>PGSQL_COPY_IN</constant>, <constant>PGSQL_BAD_RESPONSE</constant>, <constant>PGSQL_NONFATAL_ERROR</constant>, <constant>PGSQL_FATAL_ERROR</constant>
それ以外の場合は、PostgreSQL コマンドタグを含む文字列を返します。
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&pgsql.changelog.result-object;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>pg_result_status</function> の例</title>
<programlisting role="php">
<![CDATA[
<?php
// データベースに接続する
$conn = pg_pconnect("dbname=publisher");
// COPY を実行する
$result = pg_query($conn, "COPY authors FROM STDIN;");
// 結果ステータスを得る
$status = pg_result_status($result);
// ステータスの内容を調べる
if ($status == PGSQL_COPY_IN)
echo "Copy began.";
else
echo "Copy failed.";
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Copy began.
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_connection_status</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:"~/.phpdoc/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
-->