mirror of
https://github.com/php/doc-ja.git
synced 2026-04-25 17:08:10 +02:00
0f4367701a
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@329358 c90b9560-bf6c-de11-be94-00142212c4b1
126 lines
3.7 KiB
XML
126 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 04b11e621f6ccf857368d90262f051a8d40c865d Maintainer: hirokawa Status: ready -->
|
|
<!-- CREDITS: takagi -->
|
|
<refentry xml:id="function.pg-get-notify" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_get_notify</refname>
|
|
<refpurpose>SQL NOTIFY メッセージを取得する</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>pg_get_notify</methodname>
|
|
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
|
<methodparam choice="opt"><type>int</type><parameter>result_type</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_get_notify</function>は、<literal>NOTIFY</literal> SQL
|
|
コマンドにより送信された通知メッセージを取得します。
|
|
通知メッセージを取得するには、<literal>LISTEN</literal> SQL
|
|
コマンドを発行する必要があります。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
PostgreSQL データベースの接続リソース。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>result_type</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
<parameter>result_type</parameter> は、返り値の形式を制御する
|
|
オプションのパラメータです。<parameter>result_type</parameter>
|
|
は定数であり、次の値のどれかとすることが可能です。
|
|
<constant>PGSQL_ASSOC</constant>、<constant>PGSQL_NUM</constant>
|
|
および <constant>PGSQL_BOTH</constant>。
|
|
<constant>PGSQL_NUM</constant> を使用すると、<function>pg_get_notify</function>
|
|
は数値添字の配列を返します。また、<constant>PGSQL_ASSOC</constant>
|
|
を使用すると連想配列形式で返します。<constant>PGSQL_BOTH</constant>
|
|
がデフォルト設定で、これは数値添字の配列と連想配列の両方を返します。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
<literal>NOTIFY</literal> メッセージ名とバックエンドの PID を含む
|
|
配列を返します。もし待ち受ける <literal>NOTIFY</literal> が存在しない
|
|
場合は then &false; を返します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>PostgreSQL NOTIFY メッセージ</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = pg_pconnect("dbname=publisher");
|
|
if (!$conn) {
|
|
echo "An error occurred.\n";
|
|
exit;
|
|
}
|
|
|
|
// 他のプロセスからの 'author_updated' メッセージを監視する
|
|
pg_query($conn, 'LISTEN author_updated;');
|
|
$notify = pg_get_notify($conn);
|
|
if (!$notify) {
|
|
echo "No messages\n";
|
|
} else {
|
|
print_r($notify);
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_get_pid</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
|
|
-->
|