pg_get_notify

(PHP 4 >= 4.3.0, PHP 5)

pg_get_notify -- Ping database connection

Opis

array pg_get_notify ( resource connection [, int result_type] )

pg_get_notify() gets notify message sent by NOTIFY SQL command. To receive notify messages, LISTEN SQL command must be issued. If there is notify message on the connection, array contains message name and backend PID is returned. If there is no message, FALSE is returned.

Przykłady

Przykład 1. PostgreSQL NOTIFY message

<?php
$conn
= pg_pconnect("dbname=publisher");
if (!
$conn) {
  echo
"An error occured.\n";
  exit;
}

// Listen 'author_updated' message from other processes
pg_query($conn, 'LISTEN author_updated;');
$notify = pg_get_notify($conn);
if (!
$notify) {
  echo
"No messages\n";
} else {
  
print_r($notify);
}
?>

Patrz także

pg_get_pid()

Hosting by: Hurra Communications Sp. z o.o.
Generated: 2007-01-26 18:02:53