<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.pdo-pgsql.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'pdo-pgsql.setnoticecallback.php',
    1 => 'Pdo\\Pgsql::setNoticeCallback',
    2 => 'Set a callback to handle notice and warning messages generated by the backend',
  ),
  'up' => 
  array (
    0 => 'class.pdo-pgsql.php',
    1 => 'Pdo\\Pgsql',
  ),
  'prev' => 
  array (
    0 => 'pdo-pgsql.lobunlink.php',
    1 => 'Pdo\\Pgsql::lobUnlink',
  ),
  'next' => 
  array (
    0 => 'ref.pdo-sqlite.php',
    1 => 'SQLite PDO-Treiber',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pdo_pgsql/pdo/pgsql/setnoticecallback.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="pdo-pgsql.setnoticecallback" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Pdo\Pgsql::setNoticeCallback</h1>
  <p class="verinfo">(PHP 8 &gt;= 8.4.0)</p><p class="refpurpose"><span class="refname">Pdo\Pgsql::setNoticeCallback</span> &mdash; <span class="dc-title">Set a callback to handle notice and warning messages generated by the backend</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-pdo-pgsql.setnoticecallback-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Pdo\Pgsql::setNoticeCallback</strong></span>(<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.callable.php" class="type callable">callable</a></span></span> <code class="parameter">$callback</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

  <p class="simpara">
   Set a callback to handle notice and warning messages generated by the backend.
   This includes messages emitted by PostgreSQL itself,
   as well as those raised by user-defined SQL functions using <code class="literal">RAISE</code>.
   Please note that the actual receipt of these messages
   depends on the backend setting <code class="literal">client_min_messages</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-pdo-pgsql.setnoticecallback-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <dl>
   
    <dt><code class="parameter">callback</code></dt>
    <dd>
     <span class="simpara">
      If <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> is passed, the handler is reset to its default state.
     </span>
     <p class="para">
      Otherwise, the handler is a callback with the following signature:
      <div class="methodsynopsis dc-description">
       <span class="methodname"><span class="replaceable">handler</span></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$message</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>

      <dl>
       
        <dt><code class="parameter">message</code></dt>
        <dd>
         <span class="simpara">
          A message generated by the backend.
         </span>
        </dd>
       
      </dl>
     </p>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-pdo-pgsql.setnoticecallback-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="simpara">
   Es wird kein Wert zurückgegeben.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-pdo-pgsql.setnoticecallback-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="pdo-pgsql.setnoticecallback.example.basic">
   <p><strong>Beispiel #1 <span class="methodname"><strong>Pdo\Pgsql::setNoticeCallback()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$pdo </span><span style="color: #007700">= new </span><span style="color: #0000BB">Pdo\Pgsql</span><span style="color: #007700">(</span><span style="color: #DD0000">'pgsql:dbname=test host=localhost'</span><span style="color: #007700">, </span><span style="color: #0000BB">$user</span><span style="color: #007700">, </span><span style="color: #0000BB">$pass</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exec</span><span style="color: #007700">(</span><span style="color: #DD0000">'CREATE TABLE parent(id int primary key)'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exec</span><span style="color: #007700">(</span><span style="color: #DD0000">'CREATE TABLE child(id int references parent)'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setNoticeCallback</span><span style="color: #007700">(function (</span><span style="color: #0000BB">$message</span><span style="color: #007700">) {<br />    echo </span><span style="color: #0000BB">$message</span><span style="color: #007700">;<br />});<br /><br /></span><span style="color: #0000BB">$pdo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exec</span><span style="color: #007700">(</span><span style="color: #DD0000">'TRUNCATE parent CASCADE'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">NOTICE:  truncate cascades to table &quot;child&quot;</pre>
</div>
   </div>
  </div>
 </div>


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