View Single Post
  #4 (permalink)  
Old 07-05-2007, 07:06 AM
santouras santouras is offline
Junior Member
 
Join Date: Jun 2007
Location: perth, australia
Posts: 10
Default

My final solution to this turned out quite nicely, and I hope this will be of some use to other people. I extended the DB adaptor for the db object I was using to contain automatic try/catch error reporting. Here's snippets of the relevant code

PHP Code:
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);
  }
}

Hope some people find this useful
Reply With Quote