key

  1. drupal
    1. drupal7
Versionen
drupal7 public MergeQuery::key(array $fields, array $values = array())

Set the key field(s) to be used to insert or update into the table.

This method should only be called once. It may be called either with a single associative array or two indexed arrays. If called with an associative array, the keys are taken to be the fields and the values are taken to be the corresponding values to set. If called with two arrays, the first array is taken as the fields and the second array is taken as the corresponding values.

These fields are the "pivot" fields of the query. Typically they will be the fields of the primary key. If the record does not yet exist, they will be inserted into the table along with the values set in the fields() method. If the record does exist, these fields will be used in the WHERE clause to select the record to update.

Übergabeparameter

$fields An array of fields to set.

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

Rückgabewert

The called object.

Verwandte Themen

Code

includes/database/query.inc, line 589

<?php
public function key(array $fields, array $values = array()) {
  if ($values) {
    $fields = array_combine($fields, $values);
  }
  $this->keyFields = $fields;

  return $this;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen