mirror of
https://github.com/php/doc-es.git
synced 2026-04-26 08:38:05 +02:00
156 lines
3.7 KiB
XML
156 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.pg-field-name" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_field_name</refname>
|
|
<refpurpose>
|
|
Devuelve el nombre de un campo PostgreSQL
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>pg_field_name</methodname>
|
|
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>field</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_field_name</function> devuelve el nombre del campo que ocupa la
|
|
columna número <parameter>field</parameter> en el
|
|
resultado <parameter>result</parameter>. La numeración
|
|
de los campos comienza en 0.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Anteriormente, esta función se llamaba <function>pg_fieldname</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>
|
|
Número del campo, comenzando en 0.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
El nombre del campo.
|
|
</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>Obtención de información de los campos</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$dbconn = pg_connect("dbname=publisher") or die("Conexión imposible");
|
|
|
|
$res = pg_query($dbconn, "select * from autores where autor = 'Orwell'");
|
|
$i = pg_num_fields($res);
|
|
for ($j = 0; $j < $i; $j++) {
|
|
echo "columna $j\n";
|
|
$fieldname = pg_field_name($res, $j);
|
|
echo "Campo: $fieldname\n";
|
|
echo "Tamaño mostrado: ".pg_field_prtlen($res, $fieldname)." caracteres\n";
|
|
echo "Tamaño de almacenamiento: ".pg_field_size($res, $j)." bytes\n";
|
|
echo "Tipo de campo: ".pg_field_type($res, $j)." \n\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
columna 0
|
|
Campo: autor
|
|
Tamaño mostrado: 6 caracteres
|
|
Tamaño de almacenamiento: -1 bytes
|
|
Tipo de campo: varchar
|
|
|
|
columna 1
|
|
Campo: año
|
|
Tamaño mostrado: 4 caracteres
|
|
Tamaño de almacenamiento: 2 bytes
|
|
Tipo de campo: int2
|
|
|
|
columna 2
|
|
Campo: título
|
|
Tamaño mostrado: 24 caracteres
|
|
Tamaño de almacenamiento: -1 bytes
|
|
Tipo de campo: varchar
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_field_num</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
|
|
-->
|