mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-25 13:28:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@118393 c90b9560-bf6c-de11-be94-00142212c4b1
72 lines
1.9 KiB
XML
72 lines
1.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<refentry id="function.pg-get-notify">
|
|
<refnamediv>
|
|
<refname>pg_get_notify</refname>
|
|
<refpurpose>Ping database connection</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<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> gets notify message sent by
|
|
<literal>NOTIFY</literal> SQL command. To recieve notify
|
|
messages, <literal>LISTEN</literal> SQL command must be
|
|
issued. If there is notify message on the connection, array
|
|
contains message name and backend PID is returned. If there is no
|
|
message, &false; is returned.
|
|
</para>
|
|
<para>
|
|
See also <function>pg_get_pid</function>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>PostgreSQL NOTIFY message</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = pg_pconnect ("dbname=publisher");
|
|
if (!$conn) {
|
|
echo "An error occured.\n";
|
|
exit;
|
|
}
|
|
|
|
// Listen 'author_updated' message from other processes
|
|
pq_query($conn, 'LISTEN author_updated;');
|
|
$notify = pg_get_notify($conn);
|
|
if (!$notify)
|
|
print("No messages\n");
|
|
else
|
|
print_r($notify);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</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
|
|
-->
|