Pdo\Pgsql::setNoticeCallback
Set a callback to handle notice and warning messages generated by the backend
&reftitle.description;
public voidPdo\Pgsql::setNoticeCallback
callablenullcallback
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 RAISE.
Please note that the actual receipt of these messages
depends on the backend setting client_min_messages.
&reftitle.parameters;
callback
If &null; is passed, the handler is reset to its default state.
Otherwise, the handler is a callback with the following signature:
voidhandler
stringmessage
message
A message generated by the backend.
&reftitle.returnvalues;
&return.void;
&reftitle.examples;
Pdo\Pgsql::setNoticeCallback example
exec('CREATE TABLE parent(id int primary key)');
$pdo->exec('CREATE TABLE child(id int references parent)');
$pdo->setNoticeCallback(function ($message) {
echo $message;
});
$pdo->exec('TRUNCATE parent CASCADE');
?>
]]>
&example.outputs.similar;