/**
  * Pass the given statement or result to the debugger.
  *
  * @param null|ResultDelegator $result The result (optional).
  *
  * @return void
  */
 protected function passToDebugger($result = null)
 {
     $arrData['query'] = $this->statement->strQuery;
     $arrData['realquery'] = $this->realQuery;
     $arrData['params'] = $this->parameters;
     $arrData['timeStart'] = $this->timeStart;
     $arrData['timeStop'] = $this->timeStop;
     $arrData['duration'] = $this->timeStop - $this->timeStart;
     if ($result === null || strncasecmp($this->statement->strQuery, 'SELECT', 6) !== 0) {
         if (strncasecmp($this->statement->strQuery, 'SHOW', 4) === 0) {
             $arrData['return_count'] = $this->statement->affectedRows;
             $arrData['returned'] = sprintf('%s row(s) returned', $this->statement->affectedRows);
         } else {
             $arrData['affected_count'] = $this->affectedRows;
             $arrData['affected'] = sprintf('%d row(s) affected', $this->statement->affectedRows);
         }
     } else {
         if (($arrExplain = $this->statement->explain()) != false) {
             $arrData['explain'] = $arrExplain;
         }
         $arrData['return_count'] = $result->numRows;
         $arrData['returned'] = sprintf('%s row(s) returned', $result->numRows);
     }
     $this->database->addStatement($arrData);
 }
Пример #2
0
 /**
  * Execute a database statement.
  *
  * @param string|Statement $statement The statement.
  *
  * @param array            $arguments The arguments.
  *
  * @return Result
  *
  * @SuppressWarnings(PHPMD.CamelCaseMethodName)
  * @codingStandardsIgnoreStart
  */
 public function _executeFilter($statement, array $arguments = array())
 {
     if ($statement instanceof Statement) {
         /** @var Statement $statement */
         return $statement->execute($arguments)->fetchAllAssoc();
     } else {
         return Database::getInstance()->execute($statement)->fetchAllAssoc();
     }
 }
Пример #3
0
 /**
  * @param $result
  * @param int $field_offset
  * @return bool|object
  */
 public function fetchField(\database\Statement $result, $field_offset = 0)
 {
     return $result->fetchColumn($field_offset);
 }