ibase_set_event_handler

(PHP 5, PHP 7)

ibase_set_event_handlerRegister a callback function to be called when events are posted

说明

ibase_set_event_handler ( callable $event_handler , string $event_name1 [, string $... ] ) : resource
ibase_set_event_handler ( resource $connection , callable $event_handler , string $event_name1 [, string $... ] ) : resource

This function registers a PHP user function as event handler for the specified events.

参数

event_handler

The callback is called with the event name and the link resource as arguments whenever one of the specified events is posted by the database.

The callback must return FALSE if the event handler should be canceled. Any other return value is ignored. This function accepts up to 15 event arguments.

event_name1

An event name.

...

At most 15 events allowed.

返回值

The return value is an event resource. This resource can be used to free the event handler using ibase_free_event_handler().

范例

Example #1 ibase_set_event_handler() example

<?php

function event_handler($event_name$link)
{
    if (
$event_name == "NEW ORDER") {
        
// process new order
        
ibase_query($link"UPDATE orders SET status='handled'");
    } else if (
$event_name == "DB_SHUTDOWN") {
        
// free event handler
        
return false;
    }
}

ibase_set_event_handler($link"event_handler""NEW_ORDER""DB_SHUTDOWN");
?>

参见

相关文章
php gupnp 函数 sets a function to be called at regular intervalsphp firebird/interbase 函数 add a user to a security databasephp firebird/interbase 函数 return the number of rows that were affected by the previous queryphp firebird/interbase 函数 initiates a backup task in the service manager and returns immediatelyphp firebird/interbase 函数 request statistics about a databasephp firebird/interbase 函数 delete a user from a security databasephp firebird/interbase 函数 drops a databasephp firebird/interbase 函数 assigns a name to a result setphp firebird/interbase 函数 get the number of fields in a result setphp firebird/interbase 函数 return the number of parameters in a prepared queryphp firebird/interbase 函数 register a callback function to be called when events are postedphp firebird/interbase 函数 wait for an event to be posted by the databasephp newt 函数 set a callback function which gets invoked when user presses the suspend keyphp tidy 函数 ob start callback function to repair the bufferphp oci8 函数 register a user defined callback function for oracle database tafphp uopz 函数 sets hook to execute when entering a function or methodphp gearmanclient callback function when there is a data packet for a task deprecated php mongolog sets a callback function to be invoked for eventsphp swoole server shutdown the master server process this function can be called in worker processes.php swoole websocket server register event callback function
关注编程学问公众号