public function Statement::execute in Drupal driver for SQL Server and SQL Azure 8.2
Same name in this branch
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/Statement.php \Drupal\Driver\Database\sqlsrv\Statement::execute()
- 8.2 drivers/lib/Drupal/Driver/Database/sqlsrv/PDO/Statement.php \Drupal\Driver\Database\sqlsrv\PDO\Statement::execute()
Same name and namespace in other branches
- 8 drivers/lib/Drupal/Driver/Database/sqlsrv/Statement.php \Drupal\Driver\Database\sqlsrv\Statement::execute()
Execute a statement.
Parameters
array $args:
Overrides Statement::execute
File
- drivers/
lib/ Drupal/ Driver/ Database/ sqlsrv/ Statement.php, line 42 - Definition of Drupal\Driver\Database\sqlsrv\Statement
Class
Namespace
Drupal\Driver\Database\sqlsrvCode
public function execute($args = [], $options = []) {
if (isset($options['fetch'])) {
if (is_string($options['fetch'])) {
// Default to an object. Note: db fields will be added to the object
// before the constructor is run. If you need to assign fields after
// the constructor is run, see http://drupal.org/node/315092.
$this
->setFetchMode(PDO::FETCH_CLASS, $options['fetch']);
}
else {
$this
->setFetchMode($options['fetch']);
}
}
$logger = $this->dbh
->getLogger();
$query_start = microtime(true);
// If parameteres have already been binded
// to the statement and we pass an empty array here
// we will get a PDO Exception.
if (empty($args)) {
$args = null;
}
// Execute the query. Bypass parent override
// and directly call PDOStatement implementation.
$return = $this
->doExecute($args);
// Bind column types properly.
$this
->fixColumnBindings();
if (!empty($logger)) {
$query_end = microtime(true);
$logger
->log($this, $args, $query_end - $query_start);
}
return $return;
}