1
0
mirror of https://github.com/php/doc-it.git synced 2026-03-25 16:12:17 +01:00
Files
archived-doc-it/reference/pgsql/functions/pg-get-notify.xml
2024-10-24 16:47:41 +01:00

128 lines
3.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: cfeb14a38b666f6a3fc73da70f4a90fbe115e53f Maintainer: pastore Status: ready -->
<refentry xml:id="function.pg-get-notify" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_get_notify</refname>
<refpurpose>Ottiene il messaggio 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> riceve notifiche generate da un
comando SQL <literal>NOTIFY</literal>. Per ricevere le notifiche,
è necessario eseguire il comando SQL
<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 <type>array</type> contenente il nome del messaggio <literal>NOTIFY</literal> e il PID di backend.
Se supportato dal server, l'array contiene anche la versione del server e il payload.
Altrimenti se non è in attesa alcuna <literal>NOTIFY</literal>, allora viene restituito &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>Messaggio NOTIFY di PostgreSQL</title>
<programlisting role="php">
<![CDATA[
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "Si è verificato un errore.\n";
exit;
}
// Ascolta il messaggio 'author_updated' da altri processi
pg_query($conn, 'LISTEN author_updated;');
$notify = pg_get_notify($conn);
if (!$notify) {
echo "Nessun messaggio\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
-->