Exemplo n.º 1
0
 /**
  * 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'];
         $time = Common::forceDotAsSeparatorForDecimalPoint($time);
         $count = $info['count'];
         $queryProfiling = "INSERT INTO " . Common::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 UPDATE count=count+{$count},sum_time_ms=sum_time_ms+{$time}";
         $this->query($queryProfiling, array($query));
     }
     // turn back on profiling
     self::$profiling = true;
 }
Exemplo n.º 2
0
 /**
  * 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;
     $LogProfiling = Factory::getDAO('log_profiling', $this->connection);
     foreach ($this->queriesProfiling as $query => $info) {
         $time = $info['sum_time_ms'];
         $time = Common::forceDotAsSeparatorForDecimalPoint($time);
         $count = $info['count'];
         $LogProfiling->recordProfiling($query, $count, $time);
     }
     // turn back on profiling
     self::$profiling = true;
 }