芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/.trash/libraries.8/vendor/joomla/database/src/DatabaseIterator.php
setFetchMode($fetchMode); } else { $statement->setFetchMode($fetchMode, $class); } } $this->statement = $statement; $this->class = $class; $this->column = $column; $this->fetched = 0; $this->next(); } /** * Database iterator destructor. * * @since 1.0 */ public function __destruct() { if ($this->statement) { $this->freeResult(); } } /** * Get the number of rows in the result set for the executed SQL given by the cursor. * * @return integer The number of rows in the result set. * * @see Countable::count() * @since 1.0 */ public function count() { if ($this->statement) { return $this->statement->rowCount(); } return 0; } /** * The current element in the iterator. * * @return object * * @see Iterator::current() * @since 1.0 */ public function current() { return $this->current; } /** * The key of the current element in the iterator. * * @return scalar * * @see Iterator::key() * @since 1.0 */ public function key() { return $this->key; } /** * Moves forward to the next result from the SQL query. * * @return void * * @see Iterator::next() * @since 1.0 */ public function next() { // Set the default key as being the number of fetched object $this->key = $this->fetched; // Try to get an object $this->current = $this->fetchObject(); // If an object has been found if ($this->current) { // Set the key as being the indexed column (if it exists) if ($this->column && isset($this->current->{$this->column})) { $this->key = $this->current->{$this->column}; } // Update the number of fetched object $this->fetched++; } } /** * Rewinds the iterator. * * This iterator cannot be rewound. * * @return void * * @see Iterator::rewind() * @since 1.0 */ public function rewind() { } /** * Checks if the current position of the iterator is valid. * * @return boolean * * @see Iterator::valid() * @since 1.0 */ public function valid() { return (boolean) $this->current; } /** * Method to fetch a row from the result set cursor as an object. * * @return mixed Either the next row from the result set or false if there are no more rows. * * @since 1.0 */ protected function fetchObject() { if ($this->statement) { return $this->statement->fetch(); } return false; } /** * Method to free up the memory used for the result set. * * @return void * * @since 1.0 */ protected function freeResult() { if ($this->statement) { $this->statement->closeCursor(); } } }