1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-24 15:52:13 +01:00
Files
archived-doc-ru/reference/pdo_pgsql/pdo/pgsql/setnoticecallback.xml
Mikhail Alferov ef4b9f7302 Update Pdo to En (#1029)
* Update cubrid-schema.xml infostyle

* Update reference.xml to En

* Update reference.xml to En

* Update lobunlink.xml infostyle

* Update setnoticecallback.xml Infostyle

* Update reference.xml to En

* Update reference.xml Sync the Rev ID

* Update reference.xml to En

* Update reference.xml to En

* Update reference.xml to En

* Update reference.xml to En

* Update reference.xml to En

* Update reference.xml to En

* Update reference.xml to En

* Update reference.xml to En
2025-01-04 03:05:54 +03:00

118 lines
4.2 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 9ec2c28f9400490fe1b70fb88e50e23de97905f1 Maintainer: sergey Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="pdo-pgsql.setnoticecallback" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>Pdo\Pgsql::setNoticeCallback</refname>
<refpurpose>Устанавливает callback-функцию для обработки уведомлений и предупреждений бэкенда</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis role="Pdo\\Pgsql">
<modifier>public</modifier> <type>void</type><methodname>Pdo\Pgsql::setNoticeCallback</methodname>
<methodparam><type class="union"><type>callable</type><type>null</type></type><parameter>callback</parameter></methodparam>
</methodsynopsis>
<simpara>
Метод устанавливает callback-функцию для обработки сообщений с уведомлениями и предупреждениями, которые генерирует бэкенд.
К этим сообщениям относятся уведомления и предупреждения, которые выдаёт сама СУБД PostgreSQL,
и сообщения, которые выдают пользовательские SQL-функции через команду <literal>RAISE</literal>.
Обратите внимание, что фактическое получение сообщений зависит
от параметра <literal>client_min_messages</literal> в настройках бэкенда.
</simpara>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>callback</parameter></term>
<listitem>
<simpara>
При передаче значения &null; обработчик сбрасывается в состояние по умолчанию.
</simpara>
<para>
В остальных случаях обработчиком будет callback-функция со следующей сигнатурой:
<methodsynopsis>
<type>void</type><methodname><replaceable>handler</replaceable></methodname>
<methodparam><type>string</type><parameter>message</parameter></methodparam>
</methodsynopsis>
<variablelist role="function_parameters">
<varlistentry>
<term><parameter>message</parameter></term>
<listitem>
<simpara>
Сообщение, которое сгенерировал бэкенд.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
&return.void;
</simpara>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example xml:id="pdo-pgsql.setnoticecallback.example.basic">
<title>
Пример установки функции обратного вызова для обработки уведомлений
и предупреждений бэкенда методом <methodname>Pdo\Pgsql::setNoticeCallback</methodname>
</title>
<programlisting role="php">
<![CDATA[
<?php
$pdo = new Pdo\Pgsql('pgsql:dbname=test host=localhost', $user, $pass);
$pdo->exec('CREATE TABLE parent(id int primary key)');
$pdo->exec('CREATE TABLE child(id int references parent)');
$pdo->setNoticeCallback(function ($message) {
echo $message;
});
$pdo->exec('TRUNCATE parent CASCADE');
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
NOTICE: truncate cascades to table "child"
]]>
</screen>
</example>
</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
-->