Hi Ryan,
I had a similar issue to this where I wanted more verbose error messages
from sql failures. I discussed about the solution I took here
http://www.zfforums.com/zend-framework-components-13/databases-20/reporting-sql-errors-zend_db-105.html
The wrapper code I wrote looked like this
class NC_Db_Adaptor extends Zend_Db_Adapter_Pdo_Mysql {
/**
* Wrapper function for query function to allow for nicer debugging
*
* @param string|Zend_Db_Select $sql The SQL statement with placeholders.
* @param array $bind An array of data to bind to the placeholders.
* @return Zend_Db_Pdo_Statement
* @throws Exception To re-throw PDOException.
*/
public function query($sql, $bind = array()) {
try {
return parent::query($sql, $bind);
} catch (Exception $e) {
//check if website is live or local. if live, email and supress
error, if
//local then spit out error message including the sql and bind params
throw new Exception($e);
}
}
}
Jude A.
On Thu, 19 Jul 2007 11:15:04 +0800, Ryan Graciano <[EMAIL PROTECTED]>
wrote:
I'm getting the following error message from the mysqli adapter, and I'd
like to know how to gain access to the real error message -
Fatal error: Exception thrown without a stack frame in Unknown on line 0
In this case, the exact offending code was trying to insert an
alphanumeric
string into a column with type integer -
$myquery = "INSERT INTO {$this->_name} VALUES ('thisisgoingtobreak')";
$var = $this->getAdapter()->query($myquery);
I simplified this example a great deal to demonstrate the problem, but
this
was originally a tough bug to find because I'm not getting a meaningful
error message from the adapter. Is there a way to get some more verbose
error handling? I feel like this should have been a very simple bug to
track down if only I was given the error message.
Thanks,
- Ryan
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/