/** * runs a query and returns the result * * @param string $query query to run * @param object $link mysql link resource * @param integer $options query options * @param bool $cache_affected_rows whether to cache affected row * * @return mixed */ public function tryQuery($query, $link = null, $options = 0, $cache_affected_rows = true) { $debug = $GLOBALS['cfg']['DBG']['sql']; $link = $this->getLink($link); if ($link === false) { return false; } if ($debug) { $time = microtime(true); } $result = $this->_extension->realQuery($query, $link, $options); if ($cache_affected_rows) { $GLOBALS['cached_affected_rows'] = $this->affectedRows($link, false); } if ($debug) { $time = microtime(true) - $time; $this->_dbgQuery($query, $link, $result, $time); if ($GLOBALS['cfg']['DBG']['sqllog']) { openlog('phpMyAdmin', LOG_NDELAY | LOG_PID, LOG_USER); syslog(LOG_INFO, 'SQL[' . basename($_SERVER['SCRIPT_NAME']) . ']: ' . sprintf('%0.3f', $time) . ' > ' . $query); } } if (!empty($result) && Tracker::isActive()) { Tracker::handleQuery($query); } return $result; }
/** * runs a query and returns the result * * @param string $query query to run * @param object $link mysql link resource * @param integer $options query options * @param bool $cache_affected_rows whether to cache affected row * * @return mixed */ public function tryQuery($query, $link = null, $options = 0, $cache_affected_rows = true) { $link = $this->getLink($link); if ($link === false) { return false; } if ($GLOBALS['cfg']['DBG']['sql']) { $time = microtime(true); } $result = $this->_extension->realQuery($query, $link, $options); if ($cache_affected_rows) { $GLOBALS['cached_affected_rows'] = $this->affectedRows($link, false); } if ($GLOBALS['cfg']['DBG']['sql']) { $time = microtime(true) - $time; $this->_dbgQuery($query, $link, $result, $time); } if (!empty($result) && Tracker::isActive()) { Tracker::handleQuery($query); } return $result; }