You are here

public function UpdateQuery_mysql::__toString in Drupal 7

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 97
Query code for MySQL embedded database engine.

Class

UpdateQuery_mysql

Code

public function __toString() {
  if (method_exists($this->connection, 'escapeField')) {
    $escapedFields = array();
    foreach ($this->fields as $field => $data) {
      $field = $this->connection
        ->escapeField($field);
      $escapedFields[$field] = $data;
    }
    $this->fields = $escapedFields;
  }
  return parent::__toString();
}