There isn't a method to make Zend_Db be more specific.  Ideally it would
pass the SQLCODE to the exception so you could distinguish numerically
between different causes.  Right now the code doesn't do that, but we
can develop that in the future.
 
Logged as
http://framework.zend.com/issues/browse/ZF-1768
 
Regards,
Bill Karwin


________________________________

        From: Ryan Graciano [mailto:[EMAIL PROTECTED] 
        Sent: Wednesday, July 25, 2007 2:24 PM
        To: fw-general@lists.zend.com
        Subject: [fw-general] Error Handling w/ Zend DB
        
        
        I'm trying to handle errors appropriately after an insert into
MySQL with Zend_DB and the MySQLi plugin, but I'm having a rough time
determining the cause of the error.
        
        For example, I'd like my application to catch the exception,
determine if the exception occurred due to a unique key violation, and
then if so, identify the column that is causing the violation.  I
noticed that the type of the exception returned is
Zend_Db_Statement_Mysqli_Exception, and here's all of the information I
could get out of it - 
        
        getCode(): 0
        getFile():
D:\Apache224\htdocs\CK\library\Zend\Db\Statement\Mysqli.php
        getLine(): 237
        getMessage(): Mysqli statement execute error : Duplicate entry
'1' for key 1
        
        Does this mean that I need to parse the message to determine
exactly what caused the exception, or is there some other way for me to
perform error handling w/ Zend DB? 
        
        Thanks,
        - Ryan
        

Reply via email to