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

Public Member Functions

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

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 1052 of file pgsql.php.

Member Function Documentation

MDB2_Result_pgsql::_getColumnNames ( )

Retrieve the names of columns returned by the DBMS in a query result.

Returns
mixed Array variable that holds the names of columns as keys or an MDB2 error on failure. Some DBMS may not return any columns when the result set does not contain any rows. private

Reimplemented from MDB2_Result_Common.

Definition at line 1137 of file pgsql.php.

References $columns, PEAR\isError(), MDB2_PORTABILITY_FIX_CASE, and numCols().

{
$columns = array();
$numcols = $this->numCols();
if (PEAR::isError($numcols)) {
return $numcols;
}
for ($column = 0; $column < $numcols; $column++) {
$column_name = @pg_field_name($this->result, $column);
$columns[$column_name] = $column;
}
if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
$columns = array_change_key_case($columns, $this->db->options['field_case']);
}
return $columns;
}

+ Here is the call graph for this function:

& MDB2_Result_pgsql::fetchRow (   $fetchmode = MDB2_FETCHMODE_DEFAULT,
  $rownum = null 
)

Fetch a row and insert the data into an existing array.

Parameters
int$fetchmodehow the array data should be indexed
int$rownumnumber of the row where the data can be found
Returns
int data array on success, a MDB2 error on failure public

Reimplemented from MDB2_Result_Common.

Definition at line 1065 of file pgsql.php.

References $row, MDB2_Result_Common\$rownum, MDB2_Result_Common\_assignBindColumns(), PEAR\isError(), MDB2_ERROR_NEED_MORE_DATA, MDB2_FETCHMODE_ASSOC, MDB2_FETCHMODE_DEFAULT, MDB2_FETCHMODE_OBJECT, MDB2_PORTABILITY_EMPTY_TO_NULL, MDB2_PORTABILITY_FIX_CASE, MDB2_PORTABILITY_RTRIM, and MDB2_Result_Common\seek().

{
if (!is_null($rownum)) {
$seek = $this->seek($rownum);
if (PEAR::isError($seek)) {
return $seek;
}
}
if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
$fetchmode = $this->db->fetchmode;
}
if ($fetchmode & MDB2_FETCHMODE_ASSOC) {
$row = @pg_fetch_array($this->result, null, PGSQL_ASSOC);
if (is_array($row)
&& $this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE
) {
$row = array_change_key_case($row, $this->db->options['field_case']);
}
} else {
$row = @pg_fetch_row($this->result);
}
if (!$row) {
if ($this->result === false) {
$err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}
$null = null;
return $null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;
if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
if (empty($this->types)) {
} else {
$rtrim = true;
}
}
if ($mode) {
$this->db->_fixResultArrayValues($row, $mode);
}
if (!empty($this->types)) {
$row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
}
if (!empty($this->values)) {
}
if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
$object_class = $this->db->options['fetch_class'];
if ($object_class == 'stdClass') {
$row = (object) $row;
} else {
$row = &new $object_class($row);
}
}
return $row;
}

+ Here is the call graph for this function:

MDB2_Result_pgsql::free ( )

Free the internal resources associated with result.

Returns
boolean true on success, false if result is invalid public

Reimplemented from MDB2_Result_Common.

Definition at line 1211 of file pgsql.php.

References MDB2_OK.

{
if (is_resource($this->result) && $this->db->connection) {
$free = @pg_free_result($this->result);
if ($free === false) {
return $this->db->raiseError(null, null, null,
'Could not free result', __FUNCTION__);
}
}
$this->result = false;
return MDB2_OK;
}
MDB2_Result_pgsql::nextResult ( )

Move the internal result pointer to the next available result.

Returns
true on success, false if there is no more result set or an error object on failure public

Reimplemented from MDB2_Result_Common.

Definition at line 1189 of file pgsql.php.

References PEAR\isError(), and MDB2_OK.

{
$connection = $this->db->getConnection();
if (PEAR::isError($connection)) {
return $connection;
}
if (!($this->result = @pg_get_result($connection))) {
return false;
}
return MDB2_OK;
}

+ Here is the call graph for this function:

MDB2_Result_pgsql::numCols ( )

Count the number of columns returned by the DBMS in a query result.

public

Returns
mixed integer value with the number of columns, a MDB2 error on failure

Reimplemented from MDB2_Result_Common.

Definition at line 1164 of file pgsql.php.

References MDB2_ERROR_NEED_MORE_DATA.

Referenced by _getColumnNames().

{
$cols = @pg_num_fields($this->result);
if (is_null($cols)) {
if ($this->result === false) {
return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
} elseif (is_null($this->result)) {
return count($this->types);
}
return $this->db->raiseError(null, null, null,
'Could not get column count', __FUNCTION__);
}
return $cols;
}

+ Here is the caller graph for this function:


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