ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
MDB2_Iterator Class Reference
+ Inheritance diagram for MDB2_Iterator:
+ Collaboration diagram for MDB2_Iterator:

Public Member Functions

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

Protected Attributes

 $fetchmode
 $result
 $row

Detailed Description

Definition at line 54 of file Iterator.php.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 65 of file Iterator.php.

References $fetchmode, and $result.

{
$this->result = $result;
$this->fetchmode = $fetchmode;
}
MDB2_Iterator::__destruct ( )

Destructor.

Definition at line 194 of file Iterator.php.

References free().

{
$this->free();
}

+ Here is the call graph for this function:

Member Function Documentation

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().

{
if (is_null($this->row)) {
$row = $this->result->fetchRow($this->fetchmode);
$row = false;
}
$this->row = $row;
}
return $this->row;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
if ($this->result) {
return $this->result->free();
}
$this->result = false;
$this->row = null;
return false;
}

+ Here is the caller graph for this function:

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.

{
if ($this->result) {
return $this->result->rowCount();
}
return false;
}
MDB2_Iterator::next ( )

Fetch next row of data.

Returns
void public

Definition at line 99 of file Iterator.php.

{
$this->row = null;
}
MDB2_Iterator::rewind ( )

Seek to the first row in a result set.

Returns
void public

Reimplemented in MDB2_BufferedIterator.

Definition at line 184 of file Iterator.php.

{
}
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().

{
$this->row = null;
if ($this->result) {
$this->result->seek($rownum);
}
}

+ Here is the caller graph for this function:

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

Reimplemented in MDB2_BufferedIterator.

Definition at line 134 of file Iterator.php.

References current().

{
return (bool)$this->current();
}

+ Here is the call graph for this function:

Field Documentation

MDB2_Iterator::$fetchmode
protected

Definition at line 56 of file Iterator.php.

Referenced by __construct().

MDB2_Iterator::$result
protected

Definition at line 57 of file Iterator.php.

Referenced by __construct().

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: