You are here

public function MergeQuery::insertFields in Drupal 7

Adds a set of field->value pairs to be inserted.

Parameters

$fields: An array of fields on which to insert. This array may be indexed or associative. If indexed, the array is taken to be the list of fields. If associative, the keys of the array are taken to be the fields and the values are taken to be corresponding values to insert. If a $values argument is provided, $fields must be indexed.

$values: An array of fields to insert into the database. The values must be specified in the same order as the $fields array.

Return value

MergeQuery The called object.

File

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

Class

MergeQuery
General class for an abstracted MERGE query operation.

Code

public function insertFields(array $fields, array $values = array()) {
  if ($values) {
    $fields = array_combine($fields, $values);
  }
  $this->insertFields = $fields;
  return $this;
}