OCI8ResultSet Class Reference

Inheritance diagram for OCI8ResultSet:

ResultSetCommon ResultSet

List of all members.

Public Member Functions

 seek ($rownum)
 next ()
 getRecordCount ()
 close ()


Detailed Description

Definition at line 33 of file OCI8ResultSet.php.


Member Function Documentation

OCI8ResultSet::close (  ) 

See also:
ResultSet::close()

Implements ResultSet.

Definition at line 126 of file OCI8ResultSet.php.

00127     {
00128     $this->fields     = array();
00129         @oci_free_statement( $this->result );
00130     }

OCI8ResultSet::getRecordCount (  ) 

See also:
ResultSet::getRecordCount()

Implements ResultSet.

Definition at line 109 of file OCI8ResultSet.php.

00110     {
00111         $rows         = oci_num_rows( $this->result );
00112 
00113         if ( $rows === false )
00114     {
00115             throw new SQLException( 'Error fetching num rows'
00116         , $this->conn->nativeError( $this->result )
00117       );
00118         }
00119 
00120         return ( int ) $rows;
00121     }

OCI8ResultSet::next (  ) 

See also:
ResultSet::next()

Implements ResultSet.

Definition at line 60 of file OCI8ResultSet.php.

References ResultSetCommon::afterLast(), and ResultSet::FETCHMODE_ASSOC.

Referenced by seek().

00061     {   
00062     // no specific result position available
00063 
00064     // Returns an array, which corresponds to the next result row or FALSE
00065     // in case of error or there is no more rows in the result.
00066         $this->fields     = oci_fetch_array( $this->result
00067                   , $this->fetchmode
00068                     + OCI_RETURN_NULLS
00069                     + OCI_RETURN_LOBS
00070                 );
00071 
00072     if ( ! $this->fields )
00073     {
00074       // grab error via array
00075       $error        = oci_error( $this->result );
00076 
00077       if ( ! $error )
00078       {
00079         // end of recordset
00080         $this->afterLast();
00081 
00082         return false;
00083       }
00084 
00085       else
00086       {
00087         throw new SQLException( 'Error fetching result'
00088           , $error[ 'code' ] . ': ' . $error[ 'message' ]
00089         );
00090       }
00091     }
00092 
00093     // Oracle returns all field names in uppercase and associative indices
00094     // in the result array will be uppercased too.
00095         if ($this->fetchmode === ResultSet::FETCHMODE_ASSOC && $this->lowerAssocCase)
00096     {
00097       $this->fields = array_change_key_case($this->fields, CASE_LOWER);
00098         }
00099         
00100         // Advance cursor position
00101         $this->cursorPos++;
00102 
00103         return true;
00104     }

OCI8ResultSet::seek ( rownum  ) 

See also:
ResultSet::seek()

Implements ResultSet.

Definition at line 38 of file OCI8ResultSet.php.

References next().

00039     {
00040         if ( $rownum < $this->cursorPos )
00041     {
00042             // this will effectively disable previous(), first() and some calls to relative() or absolute()
00043             throw new SQLException( 'Oracle ResultSet is FORWARD-ONLY' );
00044         }
00045         
00046         // Oracle has no seek function imulate it here
00047         while ( $this->cursorPos < $rownum )
00048     {
00049             $this->next();
00050         }
00051 
00052         $this->cursorPos    = $rownum;
00053 
00054         return true;
00055     }


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

Generated on Wed May 6 23:10:50 2009 for fareofficelib by  doxygen 1.5.8