Subject Using events with php
Author
I have the following trigger:

CREATE TRIGGER TRIG_RAW_IPLINK_EVENT FOR RAW_IPLINK ACTIVE
AFTER INSERT OR UPDATE POSITION 1
AS
DECLARE VARIABLE iplink char(4);
DECLARE VARIABLE received varchar(40);
DECLARE VARIABLE eventstring varchar(44);
BEGIN
iplink = cast(new.IPLINK as char(4));

eventstring = 'RAW:' || iplink;
post_event eventstring;
END^

So, what I THINK happens - is on any insert or update (and on this table
it's only inserts) I should be generating events named RAW:1116, or
whatever iplink happens to be. new.iplink is a smallint that is always
4 digits.

Assuming I've got that part right - over in php land I have the
following. Obviously I'm doing something wrong - I just have no clue
what yet. The output of the below gives me my two sanity checks - but
nothing from the loop.

$iplink_node = 1116;
$dbh = ibase_connect( 'test.fdb', 'SYSDBA', 'masterkey', 'ASCII' );

echo "Database handler $dbh\n";

$evs = "RAW:$iplink_node";
echo "Event is $evs\n";

while ( $handler = ibase_wait_event( $dbh, "raw_line_handler" ) ) {
// just keep looping...just keep looping...
echo "$handler looped\n";
flush();
sleep(1);
}

function raw_line_handler( $event_name, $dbh ) {
$iplink_node = substr( $event_name, 4, 4 );

echo "iplink is $iplink_node\n";

$qs = "select first RAWLINE from RAW_IPLINK where IPLINK=? order by
RECEIVED desc";

$qh = ibase_query( $dbh, $qs, $iplink_node );

if ( $qh ) {
while ( $row = ibase_fetch_row( $qh ) ) {
echo $row[0];
}
}
return true;
}

--
Daniel