0
My script PHP
is not receiving the message from exceptions
which are generated by Firebird
. I have a class that connects to BD, runs sql and disconnects.
Debugging the script, I saw that the exception
is being generated as the script is interrupted, but the message is not being received by PHP
. To receive the exception
am using ibase_errmsg()
. The function of the class responsible for the execution of the sql
is this:
function sql($host, $user, $pass, $query, $charset){
$this->connect($host, $user, $pass, $charset);
if ($this->conectou) {
try {
if ($this->result=ibase_query($query)){
$this->disconnect($type);
return $this->result;
} else {
$errmsg = ibase_errmsg();
//Debug
echo $errmsg; //Nada esta mostrando aqui!!!
$this->disconnect($type);
throw new Exception($errmsg);
}
}
catch (Exception $e) {
echo $e->getMessage();
}
}
}
At first I thought the problem might be in ibase_errmsg()
, but, the most intriguing is that running the same script with Apache, Exception is shown normally.
- Server: Debian
- Firebird: 2.5 superclassic
- Web Server: Nginx
- PHP: 5.4.45
- PHP process: php-fpm
Change
echo $errmsg;
forvar_dump($errmsg);
to test.– Guilherme Nascimento
changed but still no message. Thanks for the tip!
– Carlos Andrade
But something returns?
NULL
orFALSE
orSTRING ""
, Please be more clear, if I don’t have to ask you things punched, it complicates too much like this ;)– Guilherme Nascimento
It does not return, actually goes straight through the block of the true condition, as if it had not occurred to
exception
.– Carlos Andrade
As I suspected :D ... has nothing to do with generating Exception, the problem is in
ibase_query($query)
, Tell me what to return if you add a var_dump like this$this->result = ibase_query($query);
var_dump($this->result);
if ($this->result !== false) {
?– Guilherme Nascimento
Returned this:
resource(8) of type (interbase result)
– Carlos Andrade
Carlos this means that the query is correct, I believe and so will not fire the
else
.– Guilherme Nascimento
@Guilhermenascimento, out of curiosity I discovered that the
exception
is only being generated if I make ainsert
,update
ordelete
inprocedure
. Makingselect
it does not generate theexception
, must be because ofsuspend
which it is necessary to have. As you quoted in the other answer, that theFirebird
must be returningtrue
even generating theexception
. This could be a failure ofFirebird
, Is there another way around this?– Carlos Andrade
Let’s go continue this discussion in chat
– Guilherme Nascimento