<?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-last-notice.php',
    1 => 'pg_last_notice',
    2 => 'Retourne la derni&egrave;re note du serveur PostgreSQL',
  ),
  'up' => 
  array (
    0 => 'ref.pgsql.php',
    1 => 'pg_cancel_query',
  ),
  'prev' => 
  array (
    0 => 'function.pg-last-error.php',
    1 => 'pg_last_error',
  ),
  'next' => 
  array (
    0 => 'function.pg-last-oid.php',
    1 => 'pg_last_oid',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/pgsql/functions/pg-last-notice.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.pg-last-notice" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">pg_last_notice</h1> 
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">pg_last_notice</span> &mdash; <span class="dc-title">
   Retourne la dernière note du serveur PostgreSQL
  </span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.pg-last-notice-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>pg_last_notice</strong></span>(<span class="methodparam"><span class="type"><a href="class.pgsql-connection.php" class="type PgSql\Connection">PgSql\Connection</a></span> <code class="parameter">$connection</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-last">PGSQL_NOTICE_LAST</a></code></strong></span></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>pg_last_notice()</strong></span> retourne la dernière note du
   serveur PostgreSQL sur la connexion <code class="parameter">connection</code>
   spécifiée. Le serveur PostgreSQL envoie des notes dans plusieurs cas, 
   par exemple lors de création d&#039;une colonne <code class="literal">SERIAL</code> dans
   une table.
  </p>
  <p class="para">
   Avec <span class="function"><strong>pg_last_notice()</strong></span>, il est possible d&#039;éviter des requêtes
   inutiles en vérifiant si des notes sont liées ou pas à la transaction.
  </p>
  <p class="para">
   Le suivi des notes peut être rendu optionnel en mettant à 1 la
   directive de configuration <code class="literal">pgsql.ignore_notice</code> du 
   fichier <var class="filename">php.ini</var>.
  </p>
  <p class="para">
   L&#039;enregistrement des notes peut être rendu optionnel en mettant la directive
   de configuration <code class="literal">pgsql.log_notice</code> du <var class="filename">php.ini</var> à 0.
   À moins que <code class="literal">pgsql.ignore_notice</code> ne soit à 0, les notes
   ne seront pas enregistrées.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pg-last-notice-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">connection</code></dt>
     <dd>
      <p class="para">Une instance <span class="classname"><a href="class.pgsql-connection.php" class="classname">PgSql\Connection</a></span>.</p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       L&#039;un de <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-last">PGSQL_NOTICE_LAST</a></code></strong> (pour retourner la dernière note),
       <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-all">PGSQL_NOTICE_ALL</a></code></strong> (pour retourner toutes les notes),
       ou <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-clear">PGSQL_NOTICE_CLEAR</a></code></strong> (pour effacer les notes).
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pg-last-notice-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Une <a href="language.types.string.php" class="link">chaîne de caractères</a> contenant la dernière note sur la connexion
   <code class="parameter">connection</code> avec
   <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-last">PGSQL_NOTICE_LAST</a></code></strong>,
   un <a href="language.types.array.php" class="link">tableau</a> avec <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-all">PGSQL_NOTICE_ALL</a></code></strong>,
   un <a href="language.types.boolean.php" class="link">booléen</a> avec <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-clear">PGSQL_NOTICE_CLEAR</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pg-last-notice-changelog">
  <h3 class="title">Historique</h3>
  <p class="para">
   <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">connection</code> attend désormais une instance de
  <span class="classname"><a href="class.pgsql-connection.php" class="classname">PgSql\Connection</a></span> ; auparavant, une <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> était attendu.
 </td>
</tr>

      <tr>
       <td>7.1.0</td>
       <td>
        Le paramètre <code class="parameter">mode</code> a été ajouté.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.pg-last-notice-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>pg_last_notice()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$pgsql_conn </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=mark host=localhost"</span><span style="color: #007700">);<br /><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: #DD0000">"CREATE TABLE test (id SERIAL)"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$notice </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_last_notice</span><span style="color: #007700">(</span><span style="color: #0000BB">$pgsql_conn</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">$notice</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">CREATE TABLE will create implicit sequence &quot;test_id_seq&quot; for &quot;serial&quot; column &quot;test.id&quot;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.pg-last-notice-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.pg-query.php" class="function" rel="rdfs-seeAlso">pg_query()</a> - Ex&eacute;cute une requ&ecirc;te PostgreSQL</span></li>
    <li><span class="function"><a href="function.pg-last-error.php" class="function" rel="rdfs-seeAlso">pg_last_error()</a> - Lit le dernier message d'erreur sur la connexion</span></li>
   </ul>
  </p>
 </div>

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