Annotation of embedaddon/php/ext/interbase/tests/008.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: InterBase: event handling
                      3: --SKIPIF--
                      4: <?php 
                      5: if (PHP_OS == "WINNT") echo "skip";
                      6: include("skipif.inc"); 
                      7: ?>
                      8: --FILE--
1.1.1.2 ! misho       9: <?php /* $Id$ */
1.1       misho      10: 
                     11: require("interbase.inc");
                     12: 
                     13: $count = 0;
                     14: 
                     15: function event_callback($event)
                     16: {
                     17:        global $count;
                     18:        if ($event == 'TEST1') echo "FAIL TEST1\n";
                     19:        return (++$count < 5); /* cancel event */
                     20: }
                     21: 
                     22: $link = ibase_connect($test_base);
                     23: 
                     24: ibase_query("CREATE PROCEDURE pevent AS BEGIN POST_EVENT 'TEST1'; POST_EVENT 'TEST2'; END");
                     25: ibase_commit();
                     26: 
                     27: $e = ibase_set_event_handler('event_callback','TEST1');
                     28: ibase_free_event_handler($e);
                     29: 
                     30: ibase_set_event_handler('event_callback','TEST2');
                     31: 
                     32: usleep(5E+5);
                     33: 
                     34: for ($i = 0; $i < 8; ++$i) {
                     35:        ibase_query("EXECUTE PROCEDURE pevent");
                     36:        ibase_commit();
                     37: 
                     38:        usleep(3E+5);
                     39: }
                     40: 
                     41: usleep(5E+5);
                     42: 
                     43: if (!$count || $count > 5) echo "FAIL ($count)\n";
                     44: echo "end of test\n";
                     45: 
                     46: ?>
                     47: --EXPECT--
                     48: end of test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>