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_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 244 of file oci8_result.php.

00245         {
00246                 return FALSE; // Not needed
00247         }

CI_DB_oci8_result::_fetch_assoc ( &$  row  ) 

Result - associative array.

Returns the result set as an array

private

Returns:
array

Definition at line 155 of file oci8_result.php.

00156         {
00157                 $id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
00158         
00159                 return ocifetchinto($id, $row, OCI_ASSOC + OCI_RETURN_NULLS);   
00160         }

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 172 of file oci8_result.php.

References result_array().

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

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 112 of file oci8_result.php.

References num_fields().

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

Here is the call graph for this function:

CI_DB_oci8_result::field_names (  ) 

Reimplemented from CI_DB_result.

Definition at line 97 of file oci8_result.php.

References list_fields().

00098         {
00099                 return $this->list_fields();
00100         }

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 136 of file oci8_result.php.

00137         {
00138                 if (is_resource($this->result_id))
00139                 {
00140                         ocifreestatement($this->result_id);                     
00141                         $this->result_id = FALSE;
00142                 }
00143         }

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 85 of file oci8_result.php.

References num_fields().

Referenced by field_names().

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

Here is the call graph for this function:

Here is the caller 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 62 of file oci8_result.php.

Referenced by field_data(), and list_fields().

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

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         if ($this->curs_id)
00048                 {
00049                         @ociexecute($this->curs_id);
00050                 }
00051         return $rowcount;
00052         }

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 214 of file oci8_result.php.

References CI_DB_result::_fetch_assoc().

Referenced by _fetch_object(), and num_rows().

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

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: