CI_DB_oci8_result Class Reference

Inheritance diagram for CI_DB_oci8_result:
Collaboration diagram for CI_DB_oci8_result:

List of all members.


Public Member Functions

 num_rows ()
 Number of rows in the result set.
 num_fields ()
 Number of fields in the result set.
 list_fields ()
 Fetch Field Names.
 field_data ()
 Field data.
 free_result ()
 Free the result.
 _fetch_assoc (&$row)
 Result - associative array.
 _fetch_object ()
 Result - object.
 result_array ()
 Query result.
 _data_seek ($n=0)
 Data Seek.

Public Attributes

 $stmt_id
 $curs_id
 $limit_used

Detailed Description

Definition at line 27 of file oci8_result.php.


Member Function Documentation

CI_DB_oci8_result::_data_seek ( n = 0  ) 

Data Seek.

Moves the internal pointer to the desired offset. We call this internally before fetching results to make sure the result set starts at zero

private

Returns:
array

Definition at line 240 of file oci8_result.php.

00241         {
00242                 return FALSE; // Not needed
00243         }

CI_DB_oci8_result::_fetch_assoc ( &$  row  ) 

Result - associative array.

Returns the result set as an array

private

Returns:
array

Definition at line 151 of file oci8_result.php.

00152         {
00153                 $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
00154         
00155                 return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);   
00156         }

CI_DB_oci8_result::_fetch_object (  ) 

Result - object.

Returns the result set as an object

private

Returns:
object

Reimplemented from CI_DB_result.

Definition at line 168 of file oci8_result.php.

References result_array().

00169         {       
00170                 $result = array();
00171 
00172                 // If PHP 5 is being used we can fetch an result object
00173                 if (function_exists('oci_fetch_object'))
00174                 {
00175                         $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
00176                         
00177                         return @oci_fetch_object($id);
00178                 }
00179                 
00180                 // If PHP 4 is being used we have to build our own result
00181                 foreach ($this->result_array() as $key => $val)
00182                 {
00183                         $obj = new stdClass();
00184                         if (is_array($val))
00185                         {
00186                                 foreach ($val as $k => $v)
00187                                 {
00188                                         $obj->$k = $v;
00189                                 }
00190                         }
00191                         else
00192                         {
00193                                 $obj->$key = $val;
00194                         }
00195                         
00196                         $result[] = $obj;
00197                 }
00198 
00199                 return $result;
00200         }

Here is the call graph for this function:

CI_DB_oci8_result::field_data (  ) 

Field data.

Generates an array of objects containing field meta-data

public

Returns:
array

Reimplemented from CI_DB_result.

Definition at line 108 of file oci8_result.php.

References num_fields().

00109         {
00110                 $retval = array();
00111                 $fieldCount = $this->num_fields();
00112                 for ($c = 1; $c <= $fieldCount; $c++)
00113                 {
00114                         $F                        = new stdClass();
00115                         $F->name                = ocicolumnname($this->stmt_id, $c);
00116                         $F->type                = ocicolumntype($this->stmt_id, $c);
00117                         $F->max_length  = ocicolumnsize($this->stmt_id, $c);
00118 
00119                         $retval[] = $F;
00120                 }
00121 
00122                 return $retval;
00123         }

Here is the call graph for this function:

CI_DB_oci8_result::free_result (  ) 

Free the result.

Returns:
null

Reimplemented from CI_DB_result.

Definition at line 132 of file oci8_result.php.

00133         {
00134                 if (is_resource($this->result_id))
00135                 {
00136                         ocifreestatement($this->result_id);                     
00137                         $this->result_id = FALSE;
00138                 }
00139         }

CI_DB_oci8_result::list_fields (  ) 

Fetch Field Names.

Generates an array of column names

public

Returns:
array

Reimplemented from CI_DB_result.

Definition at line 87 of file oci8_result.php.

References num_fields().

00088         {
00089                 $field_names = array();
00090                 $fieldCount = $this->num_fields();
00091                 for ($c = 1; $c <= $fieldCount; $c++)
00092                 {
00093                         $field_names[] = ocicolumnname($this->stmt_id, $c);
00094                 }
00095                 return $field_names;
00096         }

Here is the call graph for this function:

CI_DB_oci8_result::num_fields (  ) 

Number of fields in the result set.

public

Returns:
integer

Reimplemented from CI_DB_result.

Definition at line 64 of file oci8_result.php.

Referenced by field_data(), and list_fields().

00065         {
00066                 $count = @ocinumcols($this->stmt_id);
00067 
00068                 // if we used a limit we subtract it
00069                 if ($this->limit_used)
00070                 {
00071                         $count = $count - 1;
00072                 }
00073 
00074                 return $count;
00075         }

Here is the caller graph for this function:

CI_DB_oci8_result::num_rows (  ) 

Number of rows in the result set.

Oracle doesn't have a graceful way to retun the number of rows so we have to use what amounts to a hack.

public

Returns:
integer

Reimplemented from CI_DB_result.

Definition at line 43 of file oci8_result.php.

References result_array().

00044         {
00045                 $rowcount = count($this->result_array());
00046                 @ociexecute($this->stmt_id);
00047 
00048                 if ($this->curs_id)
00049                 {
00050                         @ociexecute($this->curs_id);
00051                 }
00052 
00053                 return $rowcount;
00054         }

Here is the call graph for this function:

CI_DB_oci8_result::result_array (  ) 

Query result.

"array" version.

public

Returns:
array

Reimplemented from CI_DB_result.

Definition at line 210 of file oci8_result.php.

References CI_DB_result::_fetch_assoc().

Referenced by _fetch_object(), and num_rows().

00211         {
00212                 if (count($this->result_array) > 0)
00213                 {
00214                         return $this->result_array;
00215                 }
00216 
00217                 // oracle's fetch functions do not return arrays.
00218                 // The information is returned in reference parameters
00219                 $row = NULL;
00220                 while ($this->_fetch_assoc($row))
00221                 {
00222                         $this->result_array[] = $row;
00223                 }
00224 
00225                 return $this->result_array;
00226         }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

CI_DB_oci8_result::$curs_id

Definition at line 30 of file oci8_result.php.

CI_DB_oci8_result::$limit_used

Definition at line 31 of file oci8_result.php.

CI_DB_oci8_result::$stmt_id

Definition at line 29 of file oci8_result.php.


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