function Statement::execute

Same name in this branch
  1. 9 core/modules/sqlite/src/Driver/Database/sqlite/Statement.php \Drupal\sqlite\Driver\Database\sqlite\Statement::execute()
Same name and namespace in other branches
  1. 11.x core/modules/sqlite/src/Driver/Database/sqlite/Statement.php \Drupal\sqlite\Driver\Database\sqlite\Statement::execute()
  2. 11.x core/modules/mysqli/src/Driver/Database/mysqli/Statement.php \Drupal\mysqli\Driver\Database\mysqli\Statement::execute()
  3. 10 core/modules/sqlite/src/Driver/Database/sqlite/Statement.php \Drupal\sqlite\Driver\Database\sqlite\Statement::execute()
  4. 8.9.x core/lib/Drupal/Core/Database/Driver/sqlite/Statement.php \Drupal\Core\Database\Driver\sqlite\Statement::execute()
  5. 8.9.x core/lib/Drupal/Core/Database/Statement.php \Drupal\Core\Database\Statement::execute()

File

core/lib/Drupal/Core/Database/Statement.php, line 57

Class

Statement
Default implementation of StatementInterface.

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->dbh
    ->getLogger();
  if (!empty($logger)) {
    $query_start = microtime(TRUE);
  }
  $return = parent::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.