1
0
mirror of https://github.com/php/doc-ru.git synced 2026-04-24 07:48:05 +02:00
Files
archived-doc-ru/reference/pgsql/functions/pg-last-notice.xml
T
Sergey Panteleev 6d43fd64d7 Исправление форматирования
[skip-spellcheck]
[skip-lint]
2022-12-27 03:42:36 +03:00

162 lines
5.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: mch Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.pg-last-notice" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_last_notice</refname>
<refpurpose>
Возвращает последнее уведомление от сервера PostgreSQL
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>string</type><type>bool</type></type><methodname>pg_last_notice</methodname>
<methodparam><type>PgSql\Connection</type><parameter>connection</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>mode</parameter><initializer><constant>PGSQL_NOTICE_LAST</constant></initializer></methodparam>
</methodsynopsis>
<para>
<function>pg_last_notice</function> возвращает последнее уведомление, сгенерированное
сервером PostgreSQL на заданном соединении <parameter>connection</parameter>.
В некоторых случаях сервер посылает уведомления, например при создании в таблице
колонки типа <literal>SERIAL</literal>.
</para>
<para>
Благодаря <function>pg_last_notice</function> не требуется делать
лишних запросов, чтобы узнать посылала ваша транзакция уведомления
или нет.
</para>
<para>
Можно отключить отслеживание уведомлений установкой в значение 1
параметра <literal>pgsql.ignore_notice</literal> в файле &php.ini;.
</para>
<para>
Можно отключить журналирование уведомлений установкой в значение 0 параметра
<literal>pgsql.log_notice</literal> в файле &php.ini;.
Пока этот параметр установлен в значение 0, уведомления невозможно записать в
журнал выполнения.
</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>
<para>
Одна из констант <constant>PGSQL_NOTICE_LAST</constant> (для возврата последнего уведомления),
<constant>PGSQL_NOTICE_ALL</constant> (для возврата всех уведомлений)
или <constant>PGSQL_NOTICE_CLEAR</constant> (для очистки уведомлений).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Строка, содержащая последнее уведомление на заданном соединении, если
задана опция <constant>PGSQL_NOTICE_LAST</constant>,
массив (<type>array</type>), если опция
<constant>PGSQL_NOTICE_ALL</constant> и
значение типа <type>bool</type> в случае опции
<constant>PGSQL_NOTICE_CLEAR</constant>.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
&pgsql.changelog.connection-object;
<row>
<entry>7.1.0</entry>
<entry>
Добавлен параметр <parameter>mode</parameter>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>pg_last_notice</function></title>
<programlisting role="php">
<![CDATA[
<?php
$pgsql_conn = pg_connect("dbname=mark host=localhost");
$res = pg_query("CREATE TABLE test (id SERIAL)");
$notice = pg_last_notice($pgsql_conn);
echo $notice;
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column "test.id"
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>pg_query</function></member>
<member><function>pg_last_error</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
-->