OCI8Types.php

Go to the documentation of this file.
00001 <?php 00002 00003 /* 00004 * $Id: OCI8Types.php,v 1.8 2004/03/20 04:16:50 hlellelid Exp $ 00005 * 00006 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00007 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00008 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00009 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00010 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00011 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00012 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00013 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00014 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00015 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00016 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00017 * 00018 * This software consists of voluntary contributions made by many individuals 00019 * and is licensed under the LGPL. For more information please see 00020 * <http://creole.phpdb.org>. 00021 */ 00022 00023 require_once 'creole/CreoleTypes.php'; 00024 00033 class OCI8Types extends CreoleTypes { 00034 00036 private static $typeMap = array( 00037 'char' => CreoleTypes::CHAR, 00038 'varchar2' => CreoleTypes::VARCHAR, 00039 'long' => CreoleTypes::LONGVARCHAR, 00040 'number' => CreoleTypes::NUMERIC, 00041 'float' => CreoleTypes::FLOAT, 00042 'integer' => CreoleTypes::INTEGER, 00043 'smallint' => CreoleTypes::SMALLINT, 00044 'double' => CreoleTypes::DOUBLE, 00045 'raw' => CreoleTypes::VARBINARY, 00046 'longraw' => CreoleTypes::LONGVARBINARY, 00047 'date' => CreoleTypes::TIMESTAMP, 00048 'blob' => CreoleTypes::BLOB, 00049 'clob' => CreoleTypes::CLOB, 00050 'varray' => CreoleTypes::ARR, 00051 ); 00052 00054 private static $reverseMap = null; 00055 00062 public static function getType($nativeType) 00063 { 00064 $t = strtolower($nativeType); 00065 if (isset(self::$typeMap[$t])) { 00066 return self::$typeMap[$t]; 00067 } else { 00068 return CreoleTypes::OTHER; 00069 } 00070 } 00071 00080 public static function getNativeType($creoleType) 00081 { 00082 if (self::$reverseMap === null) { 00083 self::$reverseMap = array_flip(self::$typeMap); 00084 } 00085 return @self::$reverseMap[$creoleType]; 00086 } 00087 00088 }

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


Copyright © 2004 Hans Lellelid  
Creole[php5] CVS