mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-25 17:32:07 +01:00
175 lines
4.7 KiB
XML
175 lines
4.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<refentry xml:id="function.pg-field-prtlen" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_field_prtlen</refname>
|
|
<refpurpose>
|
|
Retourne la taille imprimée
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>pg_field_prtlen</methodname>
|
|
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>row_number</parameter></methodparam>
|
|
<methodparam><type>mixed</type><parameter>field_name_or_number</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>pg_field_prtlen</methodname>
|
|
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
|
|
<methodparam><type>mixed</type><parameter>field_name_or_number</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_field_prtlen</function> retourne la taille imprimée
|
|
(nombre de caractères) d'une valeur donnée dans un
|
|
résultat PostgreSQL. La numérotation des lignes commence
|
|
à 0. <function>pg_field_prtlen</function> retourne &false; en cas d'erreur.
|
|
</para>
|
|
<para>
|
|
Le paramètre <parameter>field_name_or_number</parameter> peut être passé
|
|
soit en tant qu'&integer;, soit en tant que &string;.
|
|
S'il est passé en tant qu'&integer;, PHP l'identifie comme le numéro d'un champ,
|
|
sinon, comme le nom d'un champ.
|
|
</para>
|
|
<para>
|
|
Voir l'exemple donné à la page de la documentation de la fonction
|
|
<function>pg_field_name</function>.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Auparavant, cette fonction s'appelait <function>pg_fieldprtlen</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>
|
|
Numéro de la ligne dans le résultat. Les lignes sont numérotées à
|
|
partir de 0 en montant. Si ce paramètre n'est pas fourni, la ligne en
|
|
cours est récupérée.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Le nombre de caractères imprimés.
|
|
</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>Récupération d'informations à propos des champs</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$dbconn = pg_connect("dbname=editeur") or die("Connexion impossible");
|
|
|
|
$res = pg_query($dbconn, "select * from auteurs where auteur = 'Orwell'");
|
|
$i = pg_num_fields($res);
|
|
for ($j = 0; $j < $i; $j++) {
|
|
echo "colonne $j\n";
|
|
$fieldname = pg_field_name($res, $j);
|
|
echo "nom champ : $fieldname\n";
|
|
echo "taille affichage : " . pg_field_prtlen($res, $fieldname) . " caractères\n";
|
|
echo "taille enregistrement : " . pg_field_size($res, $j) . " octets\n";
|
|
echo "type champ : " . pg_field_type($res, $j) . " \n\n";
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
colonne 0
|
|
nom champ : auteur
|
|
taille affichage : 6 caractères
|
|
taille enregistrement : -1 octets
|
|
type champ : varchar
|
|
|
|
colonne 1
|
|
nom champ : annee
|
|
taille affichage : 4 caractères
|
|
taille enregistrement : 2 octets
|
|
type champ : int2
|
|
|
|
colonne 2
|
|
nom champ : titre
|
|
taille affichage : 24 caractères
|
|
taille enregistrement : -1 octets
|
|
type champ : varchar
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_field_size</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
|
|
-->
|