Server IP : 1.179.227.78 / Your IP : 10.104.4.41 Web Server : Apache System : Linux afdc-mdu34 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 User : www ( 1001) PHP Version : 7.4.30 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/afdc-mdu34.rtarf.mi.th/joomla/libraries/joomla/database/ |
Upload File : |
<?php /** * @package Joomla.Platform * @subpackage Database * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * Joomla Platform Database Driver Class * * @since 3.0.0 */ abstract class JDatabaseIterator implements Countable, Iterator { /** * The database cursor. * * @var mixed * @since 3.0.0 */ protected $cursor; /** * The class of object to create. * * @var string * @since 3.0.0 */ protected $class; /** * The name of the column to use for the key of the database record. * * @var mixed * @since 3.0.0 */ private $_column; /** * The current database record. * * @var mixed * @since 3.0.0 */ private $_current; /** * A numeric or string key for the current database record. * * @var int|string * @since 3.0.0 */ private $_key; /** * The number of fetched records. * * @var integer * @since 3.0.0 */ private $_fetched = 0; /** * Database iterator constructor. * * @param mixed $cursor The database cursor. * @param string $column An option column to use as the iterator key. * @param string $class The class of object that is returned. * * @throws InvalidArgumentException */ public function __construct($cursor, $column = null, $class = 'stdClass') { if (!class_exists($class)) { throw new InvalidArgumentException(sprintf('new %s(*%s*, cursor)', get_class($this), gettype($class))); } $this->cursor = $cursor; $this->class = $class; $this->_column = $column; $this->_fetched = 0; $this->next(); } /** * Database iterator destructor. * * @since 3.0.0 */ public function __destruct() { if ($this->cursor) { $this->freeResult($this->cursor); } } /** * The current element in the iterator. * * @return object * * @see Iterator::current() * @since 3.0.0 */ public function current() { return $this->_current; } /** * The key of the current element in the iterator. * * @return int|string * * @see Iterator::key() * @since 3.0.0 */ public function key() { return $this->_key; } /** * Moves forward to the next result from the SQL query. * * @return void * * @see Iterator::next() * @since 3.0.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 (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 3.0.0 */ public function rewind() { } /** * Checks if the current position of the iterator is valid. * * @return boolean * * @see Iterator::valid() * @since 3.0.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 3.0.0 */ abstract protected function fetchObject(); /** * Method to free up the memory used for the result set. * * @return void * * @since 3.0.0 */ abstract protected function freeResult(); }