/** * Added handling any errors caused by queries send from DataObjects to database * * @param string $string Query * @return PEAR_Error or mixed none */ function _query($string) { $production = empty($GLOBALS['_MAX']['CONF']['debug']['production']) ? false : true; if ($production) { // supress any PEAR errors if in production PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN); } // execute query $ret = parent::_query($string); if ($production) { PEAR::staticPopErrorHandling(); } if (PEAR::isError($ret)) { if (!$production) { $GLOBALS['_MAX']['ERRORS'][] = $ret; } if ($this->triggerSqlDie && function_exists('phpAds_sqlDie')) { $GLOBALS['phpAds_last_query'] = $string; if (empty($GLOBALS['_MAX']['PAN']['DB'])) { $GLOBALS['_MAX']['PAN']['DB'] = $GLOBALS['_DB_DATAOBJECT']['CONNECTIONS'][$this->_database_dsn_md5]; } phpAds_sqlDie(); } } return $ret; }
function _query($string) { if (!defined('MDB2_UTF8_NAMES_SET')) { $db = $this->getDatabaseConnection(); $db->_doQuery('set names utf8', false, $db->getConnection(), $db->database_name); define('MDB2_UTF8_NAMES_SET', true); } return parent::_query($string); }