| 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.
$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.
The called object.
includes/
<?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