/** * 保存慢查询日志 * * @param float $start_time 由 `$this->_start_slow_query()` 返回的值 */ protected function _record_slow_query($start_time) { if (!$start_time) { return; } $end_time = microtime(1); $use_time = 1000 * ($end_time - $start_time); if (($min_time = Database::_get_slow_query_setting_time()) && $use_time > $min_time) { // 记录慢查询 Database::$slow_querys[] = array($start_time, $use_time, $this->driver->last_query()); } }
/** * 最后查询的SQL语句 * * @return string */ public function last_query() { return $this->driver->last_query(); }