Guest User

Show the full SQL query when you get Magento SQL errors

a guest
Jan 1st, 2013
738
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             // Modified the next line and added the subequent lines to show the full SQL query and params:
  2.             //throw new Zend_Db_Statement_Exception($e->getMessage(), (int) $e->getCode(), $e);
  3.             $msg = "SQL ERROR: ". $e->getMessage() . "\n";
  4.             $msg .= "SQL QUERY: <span style='color: maroon;'>" . $this->_stmt->queryString."</span>\n";
  5.             if(!empty($params)) {
  6.                 $msg .= "SQL PARAMS: ('". implode("','", $params) ."')\n";
  7.             }
  8.             $dbsEx = new Zend_Db_Statement_Exception($msg, (int) $e->getCode(), $e);
  9.             throw $dbsEx;
RAW Paste Data