1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-24 07:22:16 +01:00
Files
archived-doc-es/reference/pgsql/functions/pg-get-notify.xml

130 lines
3.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: cfeb14a38b666f6a3fc73da70f4a90fbe115e53f Maintainer: PhilDaiguille Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.pg-get-notify" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_get_notify</refname>
<refpurpose>
Lee el mensaje SQL NOTIFY
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>false</type></type><methodname>pg_get_notify</methodname>
<methodparam><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>PGSQL_ASSOC</constant></initializer></methodparam>
</methodsynopsis>
<para>
<function>pg_get_notify</function> recibe el mensaje de NOTIFY enviado
por un comando SQL <literal>NOTIFY</literal>. Para leer el mensaje
asociado, se debe utilizar el comando <literal>LISTEN</literal>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
&pgsql.parameter.connection;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode</parameter></term>
<listitem>
&pgsql.parameter.mode;
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Un &array; que contiene el nombre del mensaje <literal>NOTIFY</literal>.
Si el servidor lo soporta, el array contiene también la versión del servidor y la carga útil (payload).
De lo contrario, si no hay ningún <literal>NOTIFY</literal> pendiente, se devolverá &false;.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&pgsql.changelog.connection-object;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Ejemplo con <function>pg_get_notify</function></title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "Se ha producido un error.\n";
exit;
}
// escucha el mensaje 'author_updated' de otros procesos
pg_query($conn, 'LISTEN author_updated;');
$notify = pg_get_notify($conn);
if (!$notify) {
echo "Ningún mensaje\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
-->