mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Added new functions
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@100137 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
d006fd4494
commit
e41729aa5f
2 changed files with 135 additions and 0 deletions
72
reference/pgsql/functions/pg-get-notify.xml
Normal file
72
reference/pgsql/functions/pg-get-notify.xml
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<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 nofigy
|
||||
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
|
||||
-->
|
63
reference/pgsql/functions/pg-get-pid.xml
Normal file
63
reference/pgsql/functions/pg-get-pid.xml
Normal file
|
@ -0,0 +1,63 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<refentry id="function.pg-get-pid">
|
||||
<refnamediv>
|
||||
<refname>pg_get_pid</refname>
|
||||
<refpurpose>Ping database connection</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>int</type><methodname>pg_get_pid</methodname>
|
||||
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
<function>pg_get_pid</function> gets backend (database server
|
||||
process) PID. PID is useful to check if <literal>NOTIFY</literal>
|
||||
message is sent from other process or not.
|
||||
</para>
|
||||
<para>
|
||||
See also <function>pg_get_notify</function>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>PostgreSQL backend PID</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$conn = pg_pconnect ("dbname=publisher");
|
||||
if (!$conn) {
|
||||
echo "An error occured.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
// Backend process PID. Use PID with pg_get_notify()
|
||||
$pid = pg_get_pid($conn);
|
||||
?>
|
||||
]]>
|
||||
</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
|
||||
-->
|
Loading…
Reference in a new issue