Firebird 2.0
PHP5 Programming
Manual

FBIRD_FREE_EVENT_HANDLER

Purpose

Use the fbird_free_event_handler function to unregister an event handler callback function.

Syntax

<free_event_handler> ::=
   fbird_free_event_handler( event_hndl )


Element 
Type
Description
event_hndl
resouce
A valid event handle
<return>
bool
True on success, False on failure

Semantics

The fbird_free_event_handler function causes the registered event handler specified by the event handle to be cancelled. The assoicated callback function will no longer be called for the events it was registered to handle.

The fucntion returns True on success or False on failure.

Example

The below example shows how an event handler can unregister itself when a db shutdown event is received.

function event_handler($event_name, $conn)
{
  global $ev_hndl;

  if ($event_name=="NEW ORDER") {
     $sql = "UPDATE orders SET status='handled' WHERE IS NULL status";
     fbird_query($conn, );
  } else if ($event_name=="DB_SHUTDOWN") {
     fbird_free_event_handler($ev_hndl);
     return false;
  }
}

$ev_hndl = fbird_set_event_handler("event_handler", "NEW_ORDER",
                                   "DB_SHUTDOWN");



See also

fbird_set_event_handler


previous page goto index next page

Legal information