OCI8ResultSet.php

Go to the documentation of this file.
00001 <?php 00002 /* 00003 * $Id: OCI8ResultSet.php,v 1.10 2004/03/20 04:16:50 hlellelid Exp $ 00004 * 00005 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00006 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00007 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00008 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00009 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00010 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00011 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00012 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00013 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00014 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00015 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00016 * 00017 * This software consists of voluntary contributions made by many individuals 00018 * and is licensed under the LGPL. For more information please see 00019 * <http://creole.phpdb.org>. 00020 */ 00021 00022 require_once 'creole/ResultSet.php'; 00023 require_once 'creole/common/ResultSet.php'; 00024 00033 class OCI8ResultSet extends ResultSetCommon implements ResultSet { 00034 00038 function seek($rownum) 00039 { 00040 if ($rownum < $this->cursorPos) { 00041 // this will effectively disable previous(), first() and some calls to relative() or absolute() 00042 throw new SQLException("Oracle ResultSet is FORWARD-ONLY"); 00043 } 00044 00045 // Oracle has no seek function imulate it here 00046 while ($this->cursorPos < $rownum) { 00047 $this->next(); 00048 } 00049 $this->cursorPos = $rownum; 00050 return true; 00051 } 00052 00053 00057 function next() 00058 { 00059 $moredata = OCIFetchInto($this->result, $arr, $this->fetchmode + OCI_RETURN_NULLS + OCI_RETURN_LOBS); 00060 $this->fields = $arr; // intentional, because we know $array started from empty, whereas ->$fields already had contents 00061 if (!$this->ignoreAssocCase) { 00062 $this->fields = array_change_key_case($arr, CASE_LOWER); 00063 } 00064 00065 if (!$moredata) { 00066 // Check for an Error Here?? 00067 // We've advanced beyond end of recordset. 00068 $this->afterLast(); 00069 return false; 00070 } 00071 00072 // Advance cursor position 00073 $this->cursorPos++; 00074 return true; 00075 } 00076 00077 00081 function getRecordCount() 00082 { 00083 $rows = @ocirowcount($this->result); 00084 if ($rows === null) { 00085 throw new SQLException("Error fetching num rows"); 00086 } 00087 return (int) $rows; 00088 00089 } 00090 00091 00095 function close() 00096 { 00097 $ret = @OCIFreeStatement($this->result); 00098 parent::close(); 00099 } 00100 00101 }

This file is part of the Creole[php5] library.


Copyright © 2004 Hans Lellelid  
Creole[php5] CVS