That's a good point. Using the PDO adapters should be transparent, and the Zend_Db classes should throw exceptions that extend Zend_Db_Exception in all cases. So we need to catch PDOException in the PDO adapters and re-throw as a more appropriate exception.
Can you please log a bug on this in JIRA, and I'll fix it. If you have time to help me out, can you please identify the places in the PDO adapter code where usage of PDO methods may throw PDOException and need to be caught and re-thrown. I'll also make unit tests as part of the fix. Regards, Bill Karwin > -----Original Message----- > From: Ralph Schindler [mailto:[EMAIL PROTECTED] > Sent: Friday, March 09, 2007 9:58 AM > To: Zend Framework General > Cc: Bill Karwin > Subject: [fw-general] Zend_Db Exception throwing? > > Bill et. al., > > Out of curiosity, if I am using Zend_Db(_Adapter_Abstract) to execute a > select object (query), should I be getting a Zend_Db_Exception or > derivative thereof when invalid sql is queried? Ie., i cannot catch the > following: > > > > try { > $s = $database_connection->select(); > $s->from('valid_table') > ->where('not_valid_column = ?', 'value'); > $database_connection->fetchAll($s); > } catch (Zend_Db_Exception $e) { > echo "<pre>"; > print_r($e); > die(); > } > > Currently, I see the database connection is throwing a PDOException when > there is invalid sql.. like the above (not a valid column) > > Is this the proper behavior? > > Thanks, > Ralph
