<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pgsql.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.pg-field-type.php',
    1 => 'pg_field_type',
    2 => 'Retourne le type d\'un champ PostgreSQL donn&eacute; par index',
  ),
  'up' => 
  array (
    0 => 'ref.pgsql.php',
    1 => 'pg_cancel_query',
  ),
  'prev' => 
  array (
    0 => 'function.pg-field-table.php',
    1 => 'pg_field_table',
  ),
  'next' => 
  array (
    0 => 'function.pg-field-type-oid.php',
    1 => 'pg_field_type_oid',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/pgsql/functions/pg-field-type.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pg-field-type" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pg_field_type</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pg_field_type</span> &mdash; <span class="dc-title">
   Retourne le type d&#039;un champ PostgreSQL donné par index
  </span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pg-field-type-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pg_field_type</strong></span>(<span class="methodparam"><span class="type"><a href="class.pgsql-result.php" class="type PgSql\Result">PgSql\Result</a></span> <code class="parameter">$result</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$field</code></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>pg_field_type()</strong></span> retourne une chaîne contenant
   le type de base du champ donné par son index <code class="parameter">field</code>.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Si le champ utilise un domaine PostgreSQL (plutôt que d&#039;un type basique),
    c&#039;est le nom du domaine sous-jacent qui est retourné, plutôt que le nom du
    domaine en tant que tel.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Auparavant, cette fonction s&#039;appelait <span class="function"><strong>pg_fieldtype()</strong></span>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pg-field-type-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">result</code></dt>
     <dd>
      <p class="para">
 Une instance <span class="classname"><a href="class.pgsql-result.php" class="classname">PgSql\Result</a></span>, retourné par <span class="function"><a href="function.pg-query.php" class="function">pg_query()</a></span>,
 <span class="function"><a href="function.pg-query-params.php" class="function">pg_query_params()</a></span>, ou <span class="function"><a href="function.pg-execute.php" class="function">pg_execute()</a></span> (entre autres).
</p>
     </dd>
    
    
     <dt><code class="parameter">field</code></dt>
      <dd>
       <p class="para">
        Numéro du champ, commençant à 0.
       </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pg-field-type-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Une <span class="type"><a href="language.types.string.php" class="type string">string</a></span> contenant le nom de base du type de champ.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pg-field-type-changelog">
  <h3 class="title">Historique</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Version</th>
      <th>Description</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  Le paramètre <code class="parameter">result</code> attend désormais une instance de
  <span class="classname"><a href="class.pgsql-result.php" class="classname">PgSql\Result</a></span> ; auparavant, une <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> était attendu.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>

 
 <div class="refsect1 examples" id="refsect1-function.pg-field-type-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Récupération d&#039;informations des champs</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />  $dbconn </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=publisher"</span><span style="color: #007700">) or die(</span><span style="color: #DD0000">"Connexion impossible"</span><span style="color: #007700">);<br /><br />  </span><span style="color: #FF8000">// On assume que 'titre' est un type varchar<br />  </span><span style="color: #0000BB">$res </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$dbconn</span><span style="color: #007700">, </span><span style="color: #DD0000">"select titre from auteurs where auteur = 'Orwell'"</span><span style="color: #007700">);<br /><br />  echo </span><span style="color: #DD0000">"Type du champ titre : "</span><span style="color: #007700">, </span><span style="color: #0000BB">pg_field_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$res</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents"><p>L&#039;exemple ci-dessus va afficher :</p></div>
    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Type du champ titre : varchar</pre>
</div>
    </div>
   </div> 
  </p>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.pg-field-type-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.pg-field-prtlen.php" class="function" rel="rdfs-seeAlso">pg_field_prtlen()</a> - Retourne la taille imprim&eacute;e</span></li>
    <li><span class="function"><a href="function.pg-field-name.php" class="function" rel="rdfs-seeAlso">pg_field_name()</a> - Retourne le nom d'un champ PostgreSQL</span></li>
    <li><span class="function"><a href="function.pg-field-type-oid.php" class="function" rel="rdfs-seeAlso">pg_field_type_oid()</a> - Retourne le type ID (OID) pour le num&eacute;ro du champ correspondant</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>