function UpdateQuery_mysql::__toString

Implements PHP magic __toString method to convert the query to a string.

Return value

string The prepared statement.

Overrides UpdateQuery::__toString

File

includes/database/mysql/query.inc, line 105

Class

UpdateQuery_mysql

Code

public function __toString() {
  if (method_exists($this->connection, 'escapeField')) {
    if (!is_array($this->fields)) {
      if (version_compare(PHP_VERSION, '7.4', '>=')) {
        throw new UnexpectedValueException();
      }
      else {
        drupal_trigger_fatal_error('Unexpected Value');
      }
    }
    $escapedFields = array();
    foreach ($this->fields as $field => $data) {
      $field = $this->connection
        ->escapeField($field);
      $escapedFields[$field] = $data;
    }
    $this->fields = $escapedFields;
  }
  return parent::__toString();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.