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

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

Member Function Documentation

MDB2_Result_mysql::_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 1211 of file mysql.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 = @mysql_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_mysql::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 1146 of file mysql.php.

References $err, $null, $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, 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 = @mysql_fetch_assoc($this->result);
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 = @mysql_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;
if ($mode) {
$this->db->_fixResultArrayValues($row, $mode);
}
if (!empty($this->types)) {
$row = $this->db->datatype->convertResultRow($this->types, $row, false);
}
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_mysql::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 1263 of file mysql.php.

References MDB2_OK.

{
if (is_resource($this->result) && $this->db->connection) {
$free = @mysql_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_mysql::numCols ( )

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

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

Reimplemented from MDB2_Result_Common.

Definition at line 1238 of file mysql.php.

References elseif(), and MDB2_ERROR_NEED_MORE_DATA.

Referenced by _getColumnNames().

{
$cols = @mysql_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 call graph for this function:

+ Here is the caller graph for this function:


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