mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-29 11:43:08 +02:00
54819ad3e3
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@271990 c90b9560-bf6c-de11-be94-00142212c4b1
205 lines
5.1 KiB
XML
205 lines
5.1 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.11 $ -->
|
|
<!-- EN-Revision: 1.9 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.maxdb-fetch-fields">
|
|
<refnamediv>
|
|
<refname>maxdb_fetch_fields</refname>
|
|
<refname>result->fetch_fields</refname>
|
|
<refpurpose>Retourne un tableau de ressource représentant
|
|
les champs dans un jeu de résultats</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<para>Style procédural :</para>
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>maxdb_fetch_fields</methodname>
|
|
<methodparam><type>resource</type><parameter>result</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>Style orienté objet (méthode) :</para>
|
|
<classsynopsis>
|
|
<ooclass><classname>result</classname></ooclass>
|
|
<methodsynopsis>
|
|
<type>mixed</type>
|
|
<methodname>fetch_fields</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
</classsynopsis>
|
|
<para>
|
|
Cette fonction est identique à la fonction
|
|
<function>maxdb_fetch_field</function> avec la seule
|
|
différence qu'au lieu de retourner une ressource à la fois
|
|
pour chaque champ, les colonnes sont retournées en tant
|
|
que tableau de ressources.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne un tableau de ressources qui contient les informations
|
|
de définitions des champs ou &false; s'il n'y a plus d'informations
|
|
de champs de disponibles.
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>Propriétés de l'objet</title>
|
|
<tgroup cols='2'>
|
|
<thead>
|
|
<row>
|
|
<entry>Propriété</entry>
|
|
<entry>Description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>name</entry>
|
|
<entry>Le nom de la colonne</entry>
|
|
</row>
|
|
<row>
|
|
<entry>max_length</entry>
|
|
<entry>La largeur maximale d'un champ dans le jeu de
|
|
résultats</entry>
|
|
</row>
|
|
<row>
|
|
<entry>type</entry>
|
|
<entry>Le type de données utilisé pour ce champ</entry>
|
|
</row>
|
|
<row>
|
|
<entry>decimals</entry>
|
|
<entry>Le nombre de décimales utilisées (pour les champs
|
|
entiers)</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Style orienté objet</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
|
|
|
|
/* Vérification de la connexion */
|
|
if (maxdb_connect_errno()) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
|
|
|
|
if ($result = $maxdb->query($query)) {
|
|
|
|
/* Récupération des informations pour toutes les colonnes */
|
|
$finfo = $result->fetch_fields();
|
|
|
|
foreach ($finfo as $val) {
|
|
printf("Nom : %s\n", $finfo[$i]->name);
|
|
printf("Table : %s\n", $finfo[$i]->table);
|
|
printf("Longueur max. : %d\n", $finfo[$i]->max_length);
|
|
printf("Flags : %d\n", $finfo[$i]->flags);
|
|
printf("Type : %d\n\n", $finfo[$i]->type);
|
|
}
|
|
$result->close();
|
|
}
|
|
|
|
/* Fermeture de la connexion */
|
|
$maxdb->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Style procédural</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
|
|
|
|
/* Vérification de la connexion */
|
|
if (maxdb_connect_errno()) {
|
|
printf("Echec de la connexion : %s\n", maxdb_connect_error());
|
|
exit();
|
|
}
|
|
|
|
$query = "SELECT name, cno from hotel.customer ORDER BY cno";
|
|
|
|
if ($result = maxdb_query($link, $query)) {
|
|
|
|
/* Récupération des informations pour toutes les colonnes */
|
|
$finfo = maxdb_fetch_fields($result);
|
|
|
|
foreach ($finfo as $val) {
|
|
printf("Nom : %s\n", $finfo[$i]->name);
|
|
printf("Table : %s\n", $finfo[$i]->table);
|
|
printf("Longueur max. : %d\n", $finfo[$i]->max_length);
|
|
printf("Flags : %d\n", $finfo[$i]->flags);
|
|
printf("Type : %d\n\n", $finfo[$i]->type);
|
|
}
|
|
maxdb_free_result($result);
|
|
}
|
|
|
|
/* Fermeture de la connexion */
|
|
maxdb_close($link);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Nom : NAME
|
|
Table :
|
|
Longueur max. : 10
|
|
Flags : -1
|
|
Type : 2
|
|
|
|
Nom : CNO
|
|
Table :
|
|
Longueur max. : 4
|
|
Flags : -1
|
|
Type : 0
|
|
]]>
|
|
</screen>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>maxdb_num_fields</function></member>
|
|
<member><function>maxdb_fetch_field</function></member>
|
|
<member><function>maxdb_fetch_field_direct</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:"../../../../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
|
|
--> |