OCI8ResultSet.php

Go to the documentation of this file.
00001 <?php 00002 /* 00003 * $Id: OCI8ResultSet.php,v 1.1 2004/05/09 21:36:46 micha 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 00034 class OCI8ResultSet extends ResultSetCommon 00035 { 00039 function seek($rownum) 00040 { 00041 if ($rownum < $this->cursorPos) { 00042 // this will effectively disable previous(), first() and some calls to relative() or absolute() 00043 return new SQLException(CREOLE_ERROR, "Oracle ResultSet is FORWARD-ONLY"); 00044 } 00045 00046 // Oracle has no seek function imulate it here 00047 while ($this->cursorPos < $rownum) { 00048 $this->next(); 00049 } 00050 $this->cursorPos = $rownum; 00051 return true; 00052 } 00053 00054 00058 function next() 00059 { 00060 $moredata = OCIFetchInto($this->result, $arr, $this->fetchmode + OCI_RETURN_NULLS + OCI_RETURN_LOBS); 00061 $this->fields = $arr; // intentional, because we know $array started from empty, whereas ->$fields already had contents 00062 if (!$this->ignoreAssocCase) { 00063 $this->fields = array_change_key_case($arr, CASE_LOWER); 00064 } 00065 00066 if (!$moredata) { 00067 // Check for an Error Here?? 00068 // We've advanced beyond end of recordset. 00069 $this->afterLast(); 00070 return false; 00071 } 00072 00073 // Advance cursor position 00074 $this->cursorPos++; 00075 return true; 00076 } 00077 00078 00082 function getRecordCount() 00083 { 00084 $rows = @ocirowcount($this->result); 00085 if ($rows === null) { 00086 return new SQLException(CREOLE_ERROR, "Error fetching num rows"); 00087 } 00088 return (int) $rows; 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[php4] library.


Copyright © 2004 Hans Lellelid  
Creole[php4] CVS