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

Public Member Functions

 seek ($rownum=0)
 Seek to a specific row in a result set. More...
 
 valid ()
 Check if the end of the result set has been reached. More...
 
 numRows ()
 Returns the number of rows in a result object. More...
 
- Public Member Functions inherited from MDB2_Result_mysql
fetchRow ($fetchmode=MDB2_FETCHMODE_DEFAULT, $rownum=null)
 Fetch a row and insert the data into an existing array. More...
 
 _getColumnNames ()
 Retrieve the names of columns returned by the DBMS in a query result. More...
 
 numCols ()
 Count the number of columns returned by the DBMS in a query result. More...
 
 free ()
 Free the internal resources associated with result. More...
 
- Public Member Functions inherited from MDB2_Result_Common
 __construct ($db, $result, $limit=0, $offset=0)
 Constructor. More...
 
 fetch ($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 fetchObject ()
 
 fetchAssoc ()
 
 MDB2_Result_Common ($db, $result, $limit=0, $offset=0)
 PHP 4 Constructor. More...
 
 setResultTypes ($types)
 Define the list of types to be associated with the columns of a given result set. More...
 
 seek ($rownum=0)
 Seek to a specific row in a result set. More...
 
fetchRow ($fetchmode=MDB2_FETCHMODE_DEFAULT, $rownum=null)
 Fetch and return a row of data. More...
 
 fetchOne ($colnum=0, $rownum=null)
 fetch single column from the next row from a result set More...
 
 fetchCol ($colnum=0)
 Fetch and return a column from the current row pointer position. More...
 
 fetchAll ($fetchmode=MDB2_FETCHMODE_DEFAULT, $rekey=false, $force_array=false, $group=false)
 Fetch and return all rows from the current row pointer position. More...
 
 rowCount ()
 Returns the actual row number that was last fetched (count from 0) More...
 
 numRows ()
 Returns the number of rows in a result object. More...
 
 nextResult ()
 Move the internal result pointer to the next available result. More...
 
 getColumnNames ($flip=false)
 Retrieve the names of columns returned by the DBMS in a query result or from the cache. More...
 
 _getColumnNames ()
 Retrieve the names of columns returned by the DBMS in a query result. More...
 
 numCols ()
 Count the number of columns returned by the DBMS in a query result. More...
 
 getResource ()
 return the resource associated with the result object More...
 
 bindColumn ($column, &$value, $type=null)
 Set bind variable to a column. More...
 
 _assignBindColumns ($row)
 Bind a variable to a value in the result row. More...
 
 free ()
 Free the internal resources associated with result. More...
 
 execute ($a_data=null)
 
- Public Member Functions inherited from ilDBStatement
 fetchRow ($fetch_mode)
 

Additional Inherited Members

- Data Fields inherited from MDB2_Result_Common
 $db
 
 $result
 
 $rownum = -1
 
 $types = array()
 
 $values = array()
 
 $offset
 
 $offset_count = 0
 
 $limit
 
 $column_names
 

Detailed Description

Definition at line 1284 of file mysql.php.

Member Function Documentation

◆ numRows()

MDB2_BufferedResult_mysql::numRows ( )

Returns the number of rows in a result object.

Returns
mixed MDB2 Error Object or the number of rows public

Implements ilDBStatement.

Definition at line 1339 of file mysql.php.

References $rows, and MDB2_ERROR_NEED_MORE_DATA.

1340  {
1341  $rows = @mysql_num_rows($this->result);
1342  if (is_null($rows)) {
1343  if ($this->result === false) {
1344  return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1345  'resultset has already been freed', __FUNCTION__);
1346  } elseif (is_null($this->result)) {
1347  return 0;
1348  }
1349  return $this->db->raiseError(null, null, null,
1350  'Could not get row count', __FUNCTION__);
1351  }
1352  return $rows;
1353  }
const MDB2_ERROR_NEED_MORE_DATA
Definition: MDB2.php:92
$rows
Definition: xhr_table.php:10

◆ seek()

MDB2_BufferedResult_mysql::seek (   $rownum = 0)

Seek to a specific row in a result set.

Parameters
int$rownumnumber of the row where the data can be found
Returns
mixed MDB2_OK on success, a MDB2 error on failure public

Definition at line 1296 of file mysql.php.

References MDB2_ERROR_INVALID, MDB2_ERROR_NEED_MORE_DATA, and MDB2_OK.

1297  {
1298  if ($this->rownum != ($rownum - 1) && !@mysql_data_seek($this->result, $rownum)) {
1299  if ($this->result === false) {
1300  return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1301  'resultset has already been freed', __FUNCTION__);
1302  } elseif (is_null($this->result)) {
1303  return MDB2_OK;
1304  }
1305  return $this->db->raiseError(MDB2_ERROR_INVALID, null, null,
1306  'tried to seek to an invalid row number ('.$rownum.')', __FUNCTION__);
1307  }
1308  $this->rownum = $rownum - 1;
1309  return MDB2_OK;
1310  }
const MDB2_OK(!class_exists('PEAR'))
The method mapErrorCode in each MDB2_dbtype implementation maps native error codes to one of these...
Definition: MDB2.php:72
const MDB2_ERROR_INVALID
Definition: MDB2.php:80
const MDB2_ERROR_NEED_MORE_DATA
Definition: MDB2.php:92

◆ valid()

MDB2_BufferedResult_mysql::valid ( )

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

Returns
mixed true or false on sucess, a MDB2 error on failure public

Definition at line 1321 of file mysql.php.

References PEAR\isError().

1322  {
1323  $numrows = $this->numRows();
1324  if (PEAR::isError($numrows)) {
1325  return $numrows;
1326  }
1327  return $this->rownum < ($numrows - 1);
1328  }
numRows()
Returns the number of rows in a result object.
Definition: mysql.php:1339
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:280
+ Here is the call graph for this function:

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