mirror of
https://github.com/php/doc-ru.git
synced 2026-03-26 16:52:12 +01:00
157 lines
4.0 KiB
XML
157 lines
4.0 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
||
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: mch Status: ready -->
|
||
<!-- Reviewed: no -->
|
||
<refentry xml:id="function.pg-field-size" xmlns="http://docbook.org/ns/docbook">
|
||
<refnamediv>
|
||
<refname>pg_field_size</refname>
|
||
<refpurpose>
|
||
Возвращает размер поля
|
||
</refpurpose>
|
||
</refnamediv>
|
||
|
||
<refsect1 role="description">
|
||
&reftitle.description;
|
||
<methodsynopsis>
|
||
<type>int</type><methodname>pg_field_size</methodname>
|
||
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
|
||
<methodparam><type>int</type><parameter>field</parameter></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
<function>pg_field_size</function> возвращает объем памяти (в
|
||
байтах), занимаемый значением поля результата запроса PostgreSQL
|
||
<parameter>result</parameter>.
|
||
</para>
|
||
<note>
|
||
<para>
|
||
Прежнее название функции: <function>pg_fieldsize</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>field</parameter></term>
|
||
<listitem>
|
||
<para>
|
||
Порядковый номер поля результата запроса, начиная с нуля.
|
||
</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="returnvalues">
|
||
&reftitle.returnvalues;
|
||
<para>
|
||
Требуемый объем памяти (в байтах) для хранения значения поля.
|
||
-1 указывает на переменный размер поля.
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="changelog">
|
||
&reftitle.changelog;
|
||
<informaltable>
|
||
<tgroup cols="2">
|
||
<thead>
|
||
<row>
|
||
<entry>&Version;</entry>
|
||
<entry>&Description;</entry>
|
||
</row>
|
||
</thead>
|
||
<tbody>
|
||
&pgsql.changelog.result-object;
|
||
</tbody>
|
||
</tgroup>
|
||
</informaltable>
|
||
</refsect1>
|
||
|
||
<refsect1 role="examples">
|
||
&reftitle.examples;
|
||
<para>
|
||
<example>
|
||
<title>Получение информации о полях выборки</title>
|
||
<programlisting role="php">
|
||
<![CDATA[
|
||
<?php
|
||
$dbconn = pg_connect("dbname=publisher") or die("Невозможно соединиться с базой");
|
||
|
||
$res = pg_query($dbconn, "select * from authors where author = 'Orwell'");
|
||
$i = pg_num_fields($res);
|
||
for ($j = 0; $j < $i; $j++) {
|
||
echo "column $j\n";
|
||
$fieldname = pg_field_name($res, $j);
|
||
echo "fieldname: $fieldname\n";
|
||
echo "printed length: " . pg_field_prtlen($res, $fieldname) . " characters\n";
|
||
echo "storage length: " . pg_field_size($res, $j) . " bytes\n";
|
||
echo "field type: " . pg_field_type($res, $j) . " \n\n";
|
||
}
|
||
?>
|
||
]]>
|
||
</programlisting>
|
||
&example.outputs;
|
||
<screen>
|
||
<![CDATA[
|
||
column 0
|
||
fieldname: author
|
||
printed length: 6 characters
|
||
storage length: -1 bytes
|
||
field type: varchar
|
||
|
||
column 1
|
||
fieldname: year
|
||
printed length: 4 characters
|
||
storage length: 2 bytes
|
||
field type: int2
|
||
|
||
column 2
|
||
fieldname: title
|
||
printed length: 24 characters
|
||
storage length: -1 bytes
|
||
field type: varchar
|
||
]]>
|
||
</screen>
|
||
</example>
|
||
</para>
|
||
</refsect1>
|
||
|
||
<refsect1 role="seealso">
|
||
&reftitle.seealso;
|
||
<para>
|
||
<simplelist>
|
||
<member><function>pg_field_prtlen</function></member>
|
||
<member><function>pg_field_type</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
|
||
-->
|