1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 00:32:15 +01:00
Files
archived-doc-ru/reference/pgsql/functions/pg-field-is-null.xml

147 lines
4.6 KiB
XML
Raw 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: 39bb8a868935a56cfce438b0169e13c02c93211c Maintainer: mch Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.pg-field-is-null" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>pg_field_is_null</refname>
<refpurpose>Проверяет поля на значение SQL <literal>NULL</literal></refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>pg_field_is_null</methodname>
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
<methodparam><type class="union"><type>string</type><type>false</type><type>null</type></type><parameter>row</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<methodsynopsis>
<type>int</type><methodname>pg_field_is_null</methodname>
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
<methodparam><type>mixed</type><parameter>field</parameter></methodparam>
</methodsynopsis>
<para>
Функция <function>pg_field_is_null</function> проверяет,
содержит ли ячейка экземпляра класса <classname>PgSql\Result</classname>
значение SQL <literal>NULL</literal>.
</para>
<note>
<para>
Прежнее название функции: <function>pg_fieldisnull</function>.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>result</parameter></term>
<listitem>
&pgsql.parameter.result;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>row</parameter></term>
<listitem>
<para>
Номер строки результата запроса с нужным полем. Нумерация строк начинается с нуля.
Функция выбирает текущую строку, если аргумент не задали.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>field</parameter></term>
<listitem>
<para>
Номер поля в виде целого числа (<type>int</type>), начиная с нуля,
или имя поля в виде строки (<type>string</type>).
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Функция возвращает значение <literal>1</literal>, если выбранное значение SQL — <literal>NULL</literal>,
<literal>0</literal> для других значений. Функция вернёт значение &false;, если номер строки будет вне
допустимого диапазона, и при прочих ошибках.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.3.0</entry>
<entry>
Параметр <parameter>row</parameter> теперь принимает значение &null;.
</entry>
</row>
&pgsql.changelog.result-object;
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования функции <function>pg_field_is_null</function></title>
<programlisting role="php">
<![CDATA[
<?php
$dbconn = pg_connect("dbname=publisher") or die ("Не удалось соединиться с базой");
$res = pg_query($dbconn, "SELECT * FROM authors WHERE author = 'Orwell'");
if ($res) {
if (pg_field_is_null($res, 0, "year") == 1) {
echo "Значение поля year — null.\n";
}
if (pg_field_is_null($res, 0, "year") == 0) {
echo "Значение поля year не null.\n";
}
}
?>
]]>
</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:"~/.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
-->