mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Dericize example :-)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@139461 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
d09e5e57d2
commit
bdb7c8328a
1 changed files with 15 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.1 $ -->
|
||||
<!-- $Revision: 1.2 $ -->
|
||||
<refentry id="function.ibase-set-event-handler">
|
||||
<refnamediv>
|
||||
<refname>ibase_set_event_handler</refname>
|
||||
|
@ -22,22 +22,26 @@
|
|||
events. 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.
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?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;
|
||||
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");
|
||||
ibase_set_event_handler($link,"event_handler","NEW_ORDER","DB_SHUTDOWN");
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
|
Loading…
Reference in a new issue