00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 require_once 'creole/ResultSet.php';
00023 require_once 'creole/common/ResultSetCommon.php';
00024
00033 class OCI8ResultSet extends ResultSetCommon implements ResultSet
00034 {
00038 function seek($rownum)
00039 {
00040 if ( $rownum < $this->cursorPos )
00041 {
00042
00043 throw new SQLException( 'Oracle ResultSet is FORWARD-ONLY' );
00044 }
00045
00046
00047 while ( $this->cursorPos < $rownum )
00048 {
00049 $this->next();
00050 }
00051
00052 $this->cursorPos = $rownum;
00053
00054 return true;
00055 }
00056
00060 function next()
00061 {
00062
00063
00064
00065
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
00075 $error = oci_error( $this->result );
00076
00077 if ( ! $error )
00078 {
00079
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
00094
00095 if ($this->fetchmode === ResultSet::FETCHMODE_ASSOC && $this->lowerAssocCase)
00096 {
00097 $this->fields = array_change_key_case($this->fields, CASE_LOWER);
00098 }
00099
00100
00101 $this->cursorPos++;
00102
00103 return true;
00104 }
00105
00109 function getRecordCount()
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 }
00122
00126 function close()
00127 {
00128 $this->fields = array();
00129 @oci_free_statement( $this->result );
00130 }
00131 }