function DatabaseStatementPrefetch::fetchCol

Overrides DatabaseStatementInterface::fetchCol

File

includes/database/prefetch.inc, line 454

Class

DatabaseStatementPrefetch
An implementation of DatabaseStatementInterface that prefetches all data.

Code

public function fetchCol($index = 0) {
    if (isset($this->columnNames[$index])) {
        $column = $this->columnNames[$index];
        $result = array();
        // Traverse the array as PHP would have done.
        while (isset($this->currentRow)) {
            $result[] = $this->currentRow[$this->columnNames[$index]];
            $this->next();
        }
        return $result;
    }
    else {
        return array();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.