ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
MDB2_BufferedResult_pgsql Class Reference
+ Inheritance diagram for MDB2_BufferedResult_pgsql:
+ Collaboration diagram for MDB2_BufferedResult_pgsql:

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_pgsql
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...
 
 nextResult ()
 Move the internal result pointer to the next available 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 1232 of file pgsql.php.

Member Function Documentation

◆ numRows()

MDB2_BufferedResult_pgsql::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 1286 of file pgsql.php.

References MDB2_ERROR_NEED_MORE_DATA.

1287  {
1288  $rows = @pg_num_rows($this->result);
1289  if (is_null($rows)) {
1290  if ($this->result === false) {
1291  return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1292  'resultset has already been freed', __FUNCTION__);
1293  } elseif (is_null($this->result)) {
1294  return 0;
1295  }
1296  return $this->db->raiseError(null, null, null,
1297  'Could not get row count', __FUNCTION__);
1298  }
1299  return $rows;
1300  }
const MDB2_ERROR_NEED_MORE_DATA
Definition: MDB2.php:92

◆ seek()

MDB2_BufferedResult_pgsql::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 1243 of file pgsql.php.

References MDB2_ERROR_INVALID, MDB2_ERROR_NEED_MORE_DATA, and MDB2_OK.

1244  {
1245  if ($this->rownum != ($rownum - 1) && !@pg_result_seek($this->result, $rownum)) {
1246  if ($this->result === false) {
1247  return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1248  'resultset has already been freed', __FUNCTION__);
1249  } elseif (is_null($this->result)) {
1250  return MDB2_OK;
1251  }
1252  return $this->db->raiseError(MDB2_ERROR_INVALID, null, null,
1253  'tried to seek to an invalid row number ('.$rownum.')', __FUNCTION__);
1254  }
1255  $this->rownum = $rownum - 1;
1256  return MDB2_OK;
1257  }
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_pgsql::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 1268 of file pgsql.php.

References PEAR\isError().

1269  {
1270  $numrows = $this->numRows();
1271  if (PEAR::isError($numrows)) {
1272  return $numrows;
1273  }
1274  return $this->rownum < ($numrows - 1);
1275  }
numRows()
Returns the number of rows in a result object.
Definition: pgsql.php:1286
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: