function DatabaseStatementPrefetch::fetchAllKeyed
Overrides DatabaseStatementInterface::fetchAllKeyed
File
-
includes/
database/ prefetch.inc, line 470
Class
- DatabaseStatementPrefetch
- An implementation of DatabaseStatementInterface that prefetches all data.
Code
public function fetchAllKeyed($key_index = 0, $value_index = 1) {
if (!isset($this->columnNames[$key_index]) || !isset($this->columnNames[$value_index])) {
return array();
}
$key = $this->columnNames[$key_index];
$value = $this->columnNames[$value_index];
$result = array();
// Traverse the array as PHP would have done.
while (isset($this->currentRow)) {
$result[$this->currentRow[$key]] = $this->currentRow[$value];
$this->next();
}
return $result;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.