public function DatabaseStatementPrefetch8b7c:f320:99b9:690f:4595:cd17:293a:c069urrent public DatabaseStatementPrefetch8b7c:f320:99b9:690f:4595:cd17:293a:c069urrent() Return the current row formatted according to the current fetch style. This is the core method of this class. It grabs the value at the current array position in $this->data and format it according to $this->fetchStyle and $this->fetchMode. Return value  The current row formatted as requested. File
 includes/database/prefetch.inc, line 271 Database interface code for engines that need complete control over their result sets. For example, SQLite will prefix some column names by the name of the table. We post-process the data, by renaming the column names using the same convention as…  Class
 
DatabaseStatementPrefetch  An implementation of DatabaseStatementInterface that prefetches all data.  Code public function current() {
  if (isset($this->currentRow)) {
    switch ($this->fetchStyle) {
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_ASSOC:
        return $this->currentRow;
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_BOTH:
        // PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_BOTH returns an array indexed by both the column name
        // and the column number.
        return $this->currentRow + array_values($this->currentRow);
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_NUM:
        return array_values($this->currentRow);
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_LAZY:
        // We do not do lazy as everything is fetched already. Fallback to
        // PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_OBJ.
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_OBJ:
        return (object) $this->currentRow;
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_CLASS | PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_CLASSTYPE:
        $class_name = array_unshift($this->currentRow);
        // Deliberate no break.
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_CLASS:
        if (!isset($class_name)) {
          $class_name = $this->fetchOptions['class'];
        }
        if (count($this->fetchOptions['constructor_args'])) {
          $reflector = new ReflectionClass($class_name);
          $result = $reflector->newInstanceArgs($this->fetchOptions['constructor_args']);
        }
        else {
          $result = new $class_name();
        }
        foreach ($this->currentRow as $k => $v) {
          $result->$k = $v;
        }
        return $result;
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_INTO:
        foreach ($this->currentRow as $k => $v) {
          $this->fetchOptions['object']->$k = $v;
        }
        return $this->fetchOptions['object'];
      case PDO8b7c:f320:99b9:690f:4595:cd17:293a:c069TCH_COLUMN:
        if (isset($this->columnNames[$this->fetchOptions['column']])) {
          return $this->currentRow[$k][$this->columnNames[$this->fetchOptions['column']]];
        }
        else {
          return;
        }
    }
  }
}


    
{'path': 'public/docs/drupal~7/includes-database-prefetch.inc/function/databasestatementprefetch-current/7.x.html', 'source': 'DevDocs.IO'}