/** * 数据库错误信息 * 并显示当前的SQL语句 * @access public * @return string */ public function error() { $this->error = mysql_error($this->_linkID); if ('' != $this->queryStr) { $this->error .= "\n [ SQL语句 ] : " . $this->queryStr; } Debug::trace($this->error, '', 'ERR'); return $this->error; }
/** * 数据库调试 记录当前SQL * @access protected */ protected function debug() { $this->modelSql[$this->model] = $this->queryStr; $this->model = '_think_'; // 记录操作结束时间 if (C('DB_SQL_LOG')) { Debug::mark('queryEndTime'); Debug::trace($this->queryStr . ' [ RunTime:' . Debug::mark('queryStartTime', 'queryEndTime', 6) . 's ]', '', 'SQL'); } }