<?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 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.pg-last-notice.php',
    1 => 'pg_last_notice',
    2 => 'Returns the last notice message from PostgreSQL server',
  ),
  'up' => 
  array (
    0 => 'ref.pgsql.php',
    1 => 'PostgreSQL Функції',
  ),
  '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' => 'en',
    '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">
   Returns the last notice message from PostgreSQL server
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.pg-last-notice-description">
  <h3 class="title">Опис</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> returns the last notice
   message from the PostgreSQL server on the specified
   <code class="parameter">connection</code>. The PostgreSQL server sends notice
   messages in several cases, for instance when creating a <code class="literal">SERIAL</code>
   column in a table.
  </p>
  <p class="para">
   With <span class="function"><strong>pg_last_notice()</strong></span>, you can avoid issuing useless
   queries by checking whether or not the notice is related to your transaction.
  </p>
  <p class="para">
   Notice message tracking can be set to optional by setting 1 for
   <code class="literal">pgsql.ignore_notice</code> in <var class="filename">php.ini</var>.
  </p>
  <p class="para">
   Notice message logging can be set to optional by setting 0 for
   <code class="literal">pgsql.log_notice</code> in <var class="filename">php.ini</var>.
   Unless <code class="literal">pgsql.ignore_notice</code> is set
   to 0, notice message cannot be logged.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.pg-last-notice-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">connection</code></dt>
     <dd>
      <p class="para">Примірник
<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">
       One of <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-last">PGSQL_NOTICE_LAST</a></code></strong> (to return last notice),
       <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-all">PGSQL_NOTICE_ALL</a></code></strong> (to return all notices),
       or <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-clear">PGSQL_NOTICE_CLEAR</a></code></strong> (to clear notices).
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pg-last-notice-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   A <span class="type"><a href="language.types.string.php" class="type string">string</a></span> containing the last notice on the 
   given <code class="parameter">connection</code> with
   <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-last">PGSQL_NOTICE_LAST</a></code></strong>,
   an <span class="type"><a href="language.types.array.php" class="type array">array</a></span> with <strong><code><a href="pgsql.constants.php#constant.pgsql-notice-all">PGSQL_NOTICE_ALL</a></code></strong>,
   a <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span> with <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">Журнал змін</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Версія</th>
       <th>Опис</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
 <td>8.1.0</td>
 <td>
  Тепер параметр <code class="parameter">connection</code> має бути примірником
  <span class="classname"><a href="class.pgsql-connection.php" class="classname">PgSql\Connection</a></span>. Раніше очікувався <a href="language.types.resource.php" class="link">resource</a>.
 </td>
</tr>

      <tr>
       <td>7.1.0</td>
       <td>
        The <code class="parameter">mode</code> parameter was added.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.pg-last-notice-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 <span class="function"><strong>pg_last_notice()</strong></span> example</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>Поданий вище приклад
виведе:</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">Прогляньте також</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> - Execute a query</span></li>
    <li><span class="function"><a href="function.pg-last-error.php" class="function" rel="rdfs-seeAlso">pg_last_error()</a> - Get the last error message string of a connection</span></li>
   </ul>
  </p>
 </div>


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