Skip to content

Instantly share code, notes, and snippets.

@mariuz
Created December 18, 2012 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mariuz/4326672 to your computer and use it in GitHub Desktop.
Save mariuz/4326672 to your computer and use it in GitHub Desktop.
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