You are here

public static function Utils::BindExpressions in Drupal driver for SQL Server and SQL Azure 8

Summary of BindExpressions

Parameters

PDOStatement $stmt:

array $values:

array $remove_from:

1 call to Utils::BindExpressions()
Update::execute in drivers/lib/Drupal/Driver/Database/sqlsrv/Update.php
Executes the UPDATE query.

File

drivers/lib/Drupal/Driver/Database/sqlsrv/Utils.php, line 35

Class

Utils

Namespace

Drupal\Driver\Database\sqlsrv

Code

public static function BindExpressions(\PDOStatement $stmt, array &$values, array &$remove_from) {
  foreach ($values as $key => $value) {
    unset($remove_from[$key]);
    if (empty($value['arguments'])) {
      continue;
    }
    if (is_array($value['arguments'])) {
      foreach ($value['arguments'] as $placeholder => $argument) {

        // We assume that an expression will never happen on a BLOB field,
        // which is a fairly safe assumption to make since in most cases
        // it would be an invalid query anyway.
        $stmt
          ->bindParam($placeholder, $value['arguments'][$placeholder]);
      }
    }
    else {
      $stmt
        ->bindParam($key, $value['arguments'], PDO::PARAM_STR);
    }
  }
}