How to handle specific SQL Errors with Zend Framework 2?

For programming and general questions on Zend Framework

How to handle specific SQL Errors with Zend Framework 2?

Postby kerimov on Fri Jan 11, 2013 4:09 pm

Hello, friends!

I can't understand how correctly to handle different SQL errors in ZF2. I thought I should catch Exceptions, but how to understand what's going on in runtime? Mysql driver just pass string of error returned by mysqli_stmt and also it throws RuntimeException, but when the SAME error is happened in PostgreeSQL ZF2 throws a InvalidQueryException.

Different exceptions for one error!

That's horrible, I can't understand how to catch specific SQL error, just one error and handle it. Now I have just one way, it is parse error message string instead of using some simple error code... Any advice?
kerimov
 
Posts: 1
Joined: Fri Jan 11, 2013 3:58 pm

Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 12 guests