PHP Classes

Error handling

Recommend this page to a friend!

      ezSQL  >  All threads  >  Error handling  >  (Un) Subscribe thread alerts  
Subject:Error handling
Summary:Function query() raises an error with INSERT, UPDATE, DELETE
Messages:2
Author:ManuB
Date:2009-02-10 09:45:51
Update:2009-02-11 12:29:53
 

  1. Error handling   Reply   Report abuse  
Picture of ManuB ManuB - 2009-02-10 09:45:51
Hi,

first of all, thanks for this great package !
I have a question about error handling: I use a exception_error_handler function to trace the errors on a site and get an error each time I use a non-selecting query (INSERT, UPDATE or DELETE). This is due to the lines around 111 (mysql_num_fields), 121 (mysql_fetch_object), 130 (mysql_free_result), despite the '@' preceding the call.
This is a sample message I receive :

exception 'ErrorException' with message 'mysql_fetch_object(): supplied argument is not a valid MySQL result resource' in <PATH>ez_sql.php:121
Stack trace:
#0 [internal function]: exception_error_handler(true)
#1 <PATH>ez_sql.php(121): mysql_fetch_object('INSERT INTO fed...')
#2 <SCRIPT_WHERE_THE_FUNCTION_IS_CALLED>(88): Ez_sql->query()
...

Since I trace the errors through mail, my mailbox is full of this kind of messages and I would like to get only the really blocking errors for my app.

Thanks by advance for your answers.


  2. Re: Error handling   Reply   Report abuse  
Picture of ManuB ManuB - 2009-02-11 12:29:53 - In reply to message 1 from ManuB
OK, I've found a simple workaround for this problem.
Around line 105, I changed:
if ( $this->result )
into
if ( $this->result && $this->result !== true )
so that the following lines are skipped when the mysql request is a non-selective one.