Update.php in Drupal driver for SQL Server and SQL Azure 4.1.x
File
src/Driver/Database/sqlsrv/Update.php
View source
<?php
namespace Drupal\sqlsrv\Driver\Database\sqlsrv;
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\SelectInterface;
use Drupal\Core\Database\Query\Update as QueryUpdate;
class Update extends QueryUpdate {
public function execute() {
$options = $this->queryOptions;
$schema = $this->connection
->schema();
$columnInformation = $schema
->queryColumnInformation($this->table);
$stmt = $this->connection
->prepareStatement((string) $this, []);
$fields = $this->fields;
foreach ($this->expressionFields as $field => $data) {
if (!empty($data['arguments'])) {
foreach ($data['arguments'] as $placeholder => $argument) {
$stmt
->getClientStatement()
->bindParam($placeholder, $data['arguments'][$placeholder]);
}
}
if ($data['expression'] instanceof SelectInterface) {
$data['expression']
->compile($this->connection, $this);
$select_query_arguments = $data['expression']
->arguments();
foreach ($select_query_arguments as $placeholder => $argument) {
$stmt
->getClientStatement()
->bindParam($placeholder, $select_query_arguments[$placeholder]);
}
}
unset($fields[$field]);
}
$blobs = [];
Utils::bindValues($stmt, $fields, $blobs, ':db_update_placeholder_', $columnInformation);
if (count($this->condition)) {
$this->condition
->compile($this->connection, $this);
$arguments = $this->condition
->arguments();
Utils::bindArguments($stmt, $arguments);
}
$options = $this->queryOptions;
$options['already_prepared'] = TRUE;
$options['return'] = Database::RETURN_AFFECTED;
return $this->connection
->query($stmt, [], $options);
}
}