Пример #1
0
 /**
  * $viewType can be 'Select' or 'Explain'
  */
 protected function getSqlUrl(Zend_Db_Profiler_Query $query, $viewType = self::SQL_SELECT_ACTION)
 {
     $queryType = $query->getQueryType();
     if ($queryType == Zend_Db_Profiler::SELECT) {
         return Mage::getUrl('debug/index/' . $viewType, array('_query' => array('sql' => $query->getQuery(), 'params' => $query->getQueryParams())));
     } else {
         return '';
     }
 }
Пример #2
0
 /**
  * Executes a prepared statement.
  *
  * @param array $params OPTIONAL Values to bind to parameter placeholders.
  * @return bool
  */
 public function execute(array $params = null)
 {
     if ($this->_queryProfile) {
         if ($this->_queryProfile->hasEnded()) {
             $prof = $this->_adapter->getProfiler();
             $q = $prof->queryClone($this->_queryProfile);
             $this->_queryProfile = $prof->getQueryProfile($q);
         }
         if ($params !== null) {
             foreach ($params as $param => $variable) {
                 if (is_int($param)) {
                     $param++;
                 }
                 $this->_queryProfile->bindParam($param, $variable);
             }
         }
         $this->_queryProfile->start();
     }
     $retval = true;
     if ($params !== null) {
         $retval = $this->_execute($params);
     } else {
         $retval = $this->_execute();
     }
     if ($this->_queryProfile) {
         $this->_queryProfile->end();
     }
     return $retval;
 }
Пример #3
0
 /**
  * Executes a prepared statement.
  *
  * @param array $params OPTIONAL Values to bind to parameter placeholders.
  * @return bool
  * @throws Zend_Db_Statement_Exception
  */
 public function execute(array $params = array())
 {
     if ($this->_queryProfile !== null) {
         $this->_queryProfile->bindParams($params);
         $this->_queryProfile->end();
     }
     return true;
 }
Пример #4
0
 public function __construct($query, $queryType)
 {
     parent::__construct($query, $queryType);
     $this->_backtrace = array();
     foreach (debug_backtrace() as $bt) {
         if (!isset($bt['file'])) {
             continue;
         }
         $this->_backtrace[] = "{$bt['file']}:{$bt['line']}\n";
     }
 }