function StatementWrapper::execute

Same name in other branches
  1. 10 core/lib/Drupal/Core/Database/StatementWrapper.php \Drupal\Core\Database\StatementWrapper::execute()

Overrides StatementInterface::execute

File

core/lib/Drupal/Core/Database/StatementWrapper.php, line 128

Class

StatementWrapper
Implementation of StatementInterface encapsulating PDOStatement.

Namespace

Drupal\Core\Database

Code

public function execute($args = [], $options = []) {
    if (isset($options['fetch'])) {
        if (is_string($options['fetch'])) {
            // \PDO::FETCH_PROPS_LATE tells __construct() to run before properties
            // are added to the object.
            $this->setFetchMode(\PDO::FETCH_CLASS | \PDO::FETCH_PROPS_LATE, $options['fetch']);
        }
        else {
            $this->setFetchMode($options['fetch']);
        }
    }
    $logger = $this->connection
        ->getLogger();
    if (!empty($logger)) {
        $query_start = microtime(TRUE);
    }
    $return = $this->clientStatement
        ->execute($args);
    if (!empty($logger)) {
        $query_end = microtime(TRUE);
        $logger->log($this, $args, $query_end - $query_start, $query_start);
    }
    return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.