public function MergeQuery::expression

public MergeQuery::expression($field, $expression, array $arguments = NULL)

Specifies fields to be updated as an expression.

Expression fields are cases such as counter = counter + 1. This method takes precedence over MergeQuery::updateFields() and it's wrappers, MergeQuery::key() and MergeQuery::fields().

Parameters

$field: The field to set.

$expression: The field will be set to the value of this expression. This parameter may include named placeholders.

$arguments: If specified, this is an array of key/value pairs for named placeholders corresponding to the expression.

Return value

MergeQuery The called object.

File

includes/database/query.inc, line 1397
Non-specific Database query code. Used by all engines.

Class

MergeQuery
General class for an abstracted MERGE query operation.

Code

public function expression($field, $expression, array $arguments = NULL) {
  $this->expressionFields[$field] = array(
    'expression' => $expression,
    'arguments' => $arguments,
  );
  $this->needsUpdate = TRUE;
  return $this;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!database!query.inc/function/MergeQuery::expression/7.x