Esempio n. 1
0
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     $profile = $this->getQueryProfile($queryId);
     $this->_totalElapsedTime += $profile->getElapsedSecs();
     $this->_logger->info(implode(' ', array((string) round($profile->getElapsedSecs(), 5), $profile->getQuery(), ($params = $profile->getQueryParams()) ? implode(' ', $params) : null)));
 }
Esempio n. 2
0
 /**
  * Roll back a transaction and return to autocommit mode.
  *
  * @return Zend_Db_Adapter_Abstract
  */
 public function rollBack()
 {
     $this->_connect();
     $q = $this->_profiler->queryStart('rollback', Zend_Db_Profiler::TRANSACTION);
     $this->_rollBack();
     $this->_profiler->queryEnd($q);
     return $this;
 }
Esempio n. 3
0
 /**
  * Intercept the query end and log the profiling data.
  *
  * @param  integer $queryId
  * @throws Zend_Db_Profiler_Exception
  * @return void
  */
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     if (!$this->getEnabled() || $state == self::IGNORED) {
         return;
     }
     $profile = $this->getQueryProfile($queryId);
     echo (string) round($profile->getElapsedSecs(), 5) . PHP_EOL . $profile->getQuery() . PHP_EOL . (($params = $profile->getQueryParams()) ? $params : null) . PHP_EOL;
 }
Esempio n. 4
0
 /**
  * Intercept the query end and log the profiling data.
  *
  * @param  integer $queryId
  * @throws \Zend_Db_Profiler_Exception
  * @return void
  */
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     if (!$this->getEnabled() || $state == self::IGNORED) {
         return;
     }
     $profile = $this->getQueryProfile($queryId);
     $this->_totalElapsedTime += $profile->getElapsedSecs();
     $this->_totalQueries++;
     $logEntry = $profile->getQuery() . " | " . implode(",", $profile->getQueryParams());
     \Logger::debug($logEntry, ["connection" => $this->getConnectionId(), "queryNum" => $this->_totalQueries, "time" => (string) round($profile->getElapsedSecs(), 5)]);
     $this->queries[] = array("time" => $profile->getElapsedSecs(), "query" => $profile->getQuery() . " | " . implode(",", $profile->getQueryParams()));
 }
Esempio n. 5
0
 /**
  * Intercept the query end and log the profiling data.
  *
  * @param  integer $queryId
  * @throws Zend_Db_Profiler_Exception
  * @return void
  */
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     if (!$this->getEnabled() || $state == self::IGNORED) {
         return;
     }
     // get profile of the current query
     $profile = $this->getQueryProfile($queryId);
     // update totalElapsedTime counter
     $this->_totalElapsedTime += $profile->getElapsedSecs();
     // create the message to be logged
     $message = "\nElapsed Secs: " . round($profile->getElapsedSecs(), 5) . "\n";
     $message .= "Query: " . $profile->getQuery() . "\n";
     // log the message as INFO message
     $this->_log->info($message);
 }
Esempio n. 6
0
 /**
  * Obsluga zakonczenia kwerendy.
  *
  * @param  integer $queryId
  * @throws Zend_Db_Profiler_Exception
  * @return void
  */
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     if (!$this->getEnabled() || $state == self::IGNORED) {
         //do nothing ... ignore log
     } else {
         // get profile of the current query
         $profile = $this->getQueryProfile($queryId);
         // update totalElapsedTime counter
         $this->_totalElapsedTime += $profile->getElapsedSecs();
         // create the message to be logged
         $message = sprintf("TIME(%s): %f\n", $queryId, $profile->getElapsedSecs());
         // log the message as INFO message
         $this->_log->info($message);
     }
     return $state;
 }
 public function queryEnd($queryId)
 {
     $result = parent::queryEnd($queryId);
     if ($result == self::STORED) {
         $profile = $this->getLastQueryProfile();
         /* @var $profile Zend_Db_Profiler_Query */
         if (!isset($this->_types[$profile->getQueryType()])) {
             $this->_types[$profile->getQueryType()] = 0;
         }
         $this->_types[$profile->getQueryType()]++;
         $query = $profile->getQuery();
         $data = array('query' => $query, 'elapsed' => $profile->getElapsedSecs(), 'params' => $profile->getQueryParams());
         $data = json_encode($data);
         $queue = Mage::getStoreConfig(Eschrade_PubSubLogger_Model_Observer::SYSTEM_CONFIG_ENDPOINT) . '_pslogger_sql';
         $this->_observer->publish($queue, $data);
     }
 }
Esempio n. 8
0
 /**
  * Intercept the query end and log the profiling data.
  *
  * @param  integer $queryId
  * @throws Zend_Db_Profiler_Exception
  * @return void
  */
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     if (!$this->getEnabled() || $state == self::IGNORED) {
         return;
     }
     $profile = $this->getQueryProfile($queryId);
     $this->_totalElapsedTime += $profile->getElapsedSecs();
     $logEntry = "DB Query: " . (string) round($profile->getElapsedSecs(), 5) . " | " . $profile->getQuery() . " | " . implode(",", $profile->getQueryParams());
     Logger::debug($logEntry);
     if (!empty($_REQUEST["pimcore_dbprofile"])) {
         if (!is_resource($this->logFile)) {
             $logFile = dirname(PIMCORE_LOG_DEBUG) . "/dbprofile-" . $_REQUEST["pimcore_dbprofile"] . ".log";
             file_put_contents($logFile, "");
             $this->logFile = fopen($logFile, "a+");
         }
         fwrite($this->logFile, $logEntry . "\n");
     }
 }
Esempio n. 9
0
 /**
  * Intercept the query end and log the profiling data.
  *
  * @param  integer $queryId
  * @throws Zend_Db_Profiler_Exception
  * @return void
  */
 public function queryEnd($queryId)
 {
     $state = parent::queryEnd($queryId);
     if (!$this->getEnabled() || $state == self::IGNORED) {
         return;
     }
     $this->_message->setDestroy(false);
     $profile = $this->getQueryProfile($queryId);
     $this->_totalElapsedTime += $profile->getElapsedSecs();
     $this->_message->addRow(array((string) round($profile->getElapsedSecs(), 5), $profile->getQuery(), ($params = $profile->getQueryParams()) ? $params : null));
     $this->updateMessageLabel();
 }
Esempio n. 10
0
 /**
  * Ends a query. Pass it the handle that was returned by queryStart().
  *
  * @param int $queryId
  * @return string|void
  */
 public function queryEnd($queryId)
 {
     $this->_lastQueryId = null;
     return parent::queryEnd($queryId);
 }