You are here

public function StatementBase::execute in Drupal driver for SQL Server and SQL Azure 8.2

Executes a prepared statement

Parameters

$args: An array of values with as many elements as there are bound parameters in the SQL statement being executed. This can be NULL.

$options: An array of options for this query.

Return value

TRUE on success, or FALSE on failure.

Overrides StatementInterface::execute

File

drivers/lib/Drupal/Driver/Database/sqlsrv/StatementBase.php, line 47
Contains \Drupal\Core\Database\Statement.

Class

StatementBase
Default implementation of StatementInterface.

Namespace

Drupal\Driver\Database\sqlsrv

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);
  }
  return $return;
}