Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Problem: If I run a stored procedure which produces an error *internally*, php does *not* report this error in ibase_errmsg, but simply returns an empty result set. For example: create procedure phptest(id integer) returns (status varchar(100)) as declare i integer; begin i = 1/0; status = 'ok'; suspend; end; call this SP: select status from php…
<?php
/*
You need to create the procedure this way in flamerobin / isql-fb
SET TERM ^ ;
create procedure phptest(id integer)
returns (status varchar(100))
as
declare i integer;
begin
i = 1/0;
status = 'ok';
suspend;
end^
SET TERM ; ^
*/
$host = 'localhost:/tmp/test.fdb';
$username ='sysdba';
$password ='masterkey';
$dbh = ibase_connect($host, $username, $password);
$stmt = 'select status from phptest(1)';
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {
echo $row;
}
echo ibase_errmsg();
ibase_free_result($sth);
ibase_close($dbh);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment