Example #1
0
 /**
  * Executes a prepared statement.
  *
  * @link http://php.net/manual/en/pdostatement.execute.php
  *
  * @param array $input_parameters (optional)
  *
  * @return bool
  */
 public function execute($input_parameters = [])
 {
     $start = microtime(true);
     if (func_num_args() === 0) {
         $result = parent::execute();
     } else {
         $result = parent::execute($input_parameters);
     }
     $statement = (string) $this->queryString;
     $executedIn = microtime(true) - $start;
     if ($this->database->logger->limit === -1 || $this->database->logger->count < $this->database->logger->limit) {
         // Only interpolate the query if it's going to be logged.
         $params = count($input_parameters) === 0 ? $this->params : $input_parameters;
         $statement = $this->interpolate($statement, $params);
     }
     $this->database->logger->append($statement, array('duration' => $executedIn));
     if ($result === false) {
         $this->database->reportError($statement, $this->errorInfo());
     } else {
         $this->database->checkWarnings($statement);
     }
     return $result;
 }