ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
MDB2_Iterator Class Reference
+ Inheritance diagram for MDB2_Iterator:
+ Collaboration diagram for MDB2_Iterator:

Public Member Functions

 __construct ($result, $fetchmode=MDB2_FETCHMODE_DEFAULT)
 Constructor. More...
 
 seek ($rownum)
 Seek forward to a specific row in a result set. More...
 
 next ()
 Fetch next row of data. More...
 
 current ()
 return a row of data More...
 
 valid ()
 Check if the end of the result set has been reached. More...
 
 free ()
 Free the internal resources associated with result. More...
 
 key ()
 Returns the row number. More...
 
 rewind ()
 Seek to the first row in a result set. More...
 
 __destruct ()
 Destructor. More...
 

Protected Attributes

 $fetchmode
 
 $result
 
 $row
 

Detailed Description

Definition at line 54 of file Iterator.php.

Constructor & Destructor Documentation

◆ __construct()

MDB2_Iterator::__construct (   $result,
  $fetchmode = MDB2_FETCHMODE_DEFAULT 
)

Constructor.

Definition at line 65 of file Iterator.php.

References $fetchmode, and $result.

66  {
67  $this->result = $result;
68  $this->fetchmode = $fetchmode;
69  }

◆ __destruct()

MDB2_Iterator::__destruct ( )

Destructor.

Definition at line 194 of file Iterator.php.

References free().

195  {
196  $this->free();
197  }
free()
Free the internal resources associated with result.
Definition: Iterator.php:148
+ Here is the call graph for this function:

Member Function Documentation

◆ current()

MDB2_Iterator::current ( )

return a row of data

Returns
void public

Definition at line 113 of file Iterator.php.

References $row, and PEAR\isError().

Referenced by valid().

114  {
115  if (is_null($this->row)) {
116  $row = $this->result->fetchRow($this->fetchmode);
117  if (PEAR::isError($row)) {
118  $row = false;
119  }
120  $this->row = $row;
121  }
122  return $this->row;
123  }
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ free()

MDB2_Iterator::free ( )

Free the internal resources associated with result.

Returns
bool|MDB2_Error true on success, false|MDB2_Error if result is invalid public

Definition at line 148 of file Iterator.php.

Referenced by __destruct().

149  {
150  if ($this->result) {
151  return $this->result->free();
152  }
153  $this->result = false;
154  $this->row = null;
155  return false;
156  }
+ Here is the caller graph for this function:

◆ key()

MDB2_Iterator::key ( )

Returns the row number.

Returns
int|bool|MDB2_Error true on success, false|MDB2_Error if result is invalid public

Definition at line 167 of file Iterator.php.

168  {
169  if ($this->result) {
170  return $this->result->rowCount();
171  }
172  return false;
173  }

◆ next()

MDB2_Iterator::next ( )

Fetch next row of data.

Returns
void public

Definition at line 99 of file Iterator.php.

100  {
101  $this->row = null;
102  }

◆ rewind()

MDB2_Iterator::rewind ( )

Seek to the first row in a result set.

Returns
void public

Definition at line 184 of file Iterator.php.

185  {
186  }

◆ seek()

MDB2_Iterator::seek (   $rownum)

Seek forward to a specific row in a result set.

Parameters
intnumber of the row where the data can be found
Returns
void public

Definition at line 82 of file Iterator.php.

Referenced by MDB2_BufferedIterator\rewind().

83  {
84  $this->row = null;
85  if ($this->result) {
86  $this->result->seek($rownum);
87  }
88  }
+ Here is the caller graph for this function:

◆ valid()

MDB2_Iterator::valid ( )

Check if the end of the result set has been reached.

Returns
bool true/false, false is also returned on failure public

Definition at line 134 of file Iterator.php.

References current().

135  {
136  return (bool)$this->current();
137  }
current()
return a row of data
Definition: Iterator.php:113
+ Here is the call graph for this function:

Field Documentation

◆ $fetchmode

MDB2_Iterator::$fetchmode
protected

Definition at line 56 of file Iterator.php.

Referenced by __construct().

◆ $result

MDB2_Iterator::$result
protected

Definition at line 57 of file Iterator.php.

Referenced by __construct().

◆ $row

MDB2_Iterator::$row
protected

Definition at line 58 of file Iterator.php.

Referenced by current().


The documentation for this class was generated from the following file: