Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5317

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the last notice message from PostgreSQL server</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.pg-last-error.html">pg_last_error</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.pg-last-oid.html">pg_last_oid</a></div>
 <div class="up"><a href="ref.pgsql.html">PostgreSQL Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><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)</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">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>pg_last_notice</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection</code></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
   <em><code class="parameter">connection</code></em>. The PostgreSQL server sends notice
   messages in several cases, for instance when creating a <em>SERIAL</em>
   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
   <em>pgsql.ignore_notice</em> in <var class="filename">php.ini</var>.
  </p>
  <p class="para">
   Notice message logging can be set to optional by setting 0 for
   <em>pgsql.log_notice</em> in <var class="filename">php.ini</var>.
   Unless <em>pgsql.ignore_notice</em> 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">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">connection</code></em></span>
     <dd>

      <p class="para">
       PostgreSQL database connection resource.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.pg-last-notice-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   A <span class="type"><a href="language.types.string.html" class="type string">string</a></span> containing the last notice on the 
   given <em><code class="parameter">connection</code></em>, or <strong><code>FALSE</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.pg-last-notice-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>4.3.0</td>
       <td>
        This function is now fully implemented. Earlier versions ignores
        database connection parameter.
       </td>
      </tr>

      <tr>
       <td>4.3.0</td>
       <td>
        The <em>pgsql.ignore_notice</em> and 
        <em>pgsql.log_notice</em> <var class="filename">php.ini</var> directives were added.
       </td>
      </tr>

      <tr>
       <td>4.0.6</td>
       <td>
        PHP 4.0.6 has problem with notice message handling. Use of the
        PostgreSQL module with PHP 4.0.6 is not recommended even if you are
        not using  <span class="function"><strong>pg_last_notice()</strong></span>.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.pg-last-notice-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-2086">
    <p><strong>Example #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 />&nbsp;&nbsp;$pgsql_conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=mark&nbsp;host=localhost"</span><span style="color: #007700">);<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$res&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"CREATE&nbsp;TABLE&nbsp;test&nbsp;(id&nbsp;SERIAL)"</span><span style="color: #007700">);<br />&nbsp;&nbsp;<br />&nbsp;&nbsp;</span><span style="color: #0000BB">$notice&nbsp;</span><span style="color: #007700">=&nbsp;</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 />&nbsp;&nbsp;<br />&nbsp;&nbsp;echo&nbsp;</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>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
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">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.pg-query.html" class="function" rel="rdfs-seeAlso">pg_query()</a> - Execute a query</span></li>
    <li class="member"> <span class="function"><a href="function.pg-last-error.html" class="function" rel="rdfs-seeAlso">pg_last_error()</a> - Get the last error message string of a connection</span></li>
   </ul>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.pg-last-error.html">pg_last_error</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.pg-last-oid.html">pg_last_oid</a></div>
 <div class="up"><a href="ref.pgsql.html">PostgreSQL Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>