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