예제 #1
0
 /**
  * Call this method to disable the SQL query profiler
  */
 public function disableProfiler()
 {
     $this->profiling = false;
     Piwik_LogStats_Db::disableProfiling();
 }
예제 #2
0
 static function disconnectDb()
 {
     if (isset(self::$db)) {
         self::$db->disconnect();
     }
 }
예제 #3
0
파일: Db.php 프로젝트: Doluci/tomatocart
 /**
  * When destroyed, if SQL profiled enabled, logs the SQL profiling information
  */
 public function recordProfiling()
 {
     if (is_null($this->connection)) {
         return;
     }
     // turn off the profiler so we don't profile the following queries
     self::$profiling = false;
     foreach ($this->queriesProfiling as $query => $info) {
         $time = $info['sum_time_ms'];
         $count = $info['count'];
         $queryProfiling = "INSERT INTO " . $this->prefixTable('log_profiling') . "\n\t\t\t\t\t\t(query,count,sum_time_ms) VALUES (?,{$count},{$time})\n\t\t\t\t\t\tON DUPLICATE KEY \n\t\t\t\t\t\t\tUPDATE count=count+{$count},sum_time_ms=sum_time_ms+{$time}";
         $this->query($queryProfiling, array($query));
     }
     // turn back on profiling
     self::$profiling = true;
 }