OCI8DatabaseInfo.php

Go to the documentation of this file.
00001 <?php 00002 /* 00003 * $Id: OCI8DatabaseInfo.php,v 1.8 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/metadata/DatabaseInfo.php'; 00023 00031 class OCI8DatabaseInfo extends DatabaseInfo { 00032 00033 private $schema; 00034 00035 public function __construct(Connection $conn) { 00036 parent::__construct($conn); 00037 00038 $dsn = $conn->getDSN(); 00039 00040 // For Changing DB/Schema in Meta Data Interface 00041 $this->schema = $dsn['database']; 00042 // For Oracle Type DBs 00043 if (!$this->schema) { 00044 $this->schema = strtoupper($dsn['username']); 00045 } 00046 } 00047 00048 public function getSchema() { 00049 return $this->schema; 00050 } 00051 00056 protected function initTables() 00057 { 00058 include_once 'creole/drivers/oracle/metadata/OCI8TableInfo.php'; 00059 00060 $sql = "SELECT table_name 00061 FROM all_tables 00062 WHERE owner = '{$this->schema}' "; 00063 00064 $statement = @OCIParse($this->dblink,$sql); 00065 00066 $success = @OCIExecute($statement,OCI_DEFAULT); 00067 if (!$success) { 00068 throw new SQLException("Could not get tables", $this->dblink->nativeError($statement)); 00069 } 00070 00071 $row = array(); 00072 while (OCIFetchInto($statement, $row, OCI_ASSOC)) { 00073 $row = array_change_key_case($row,CASE_LOWER); 00074 $this->tables[strtoupper($row['table_name'])] = new OCI8TableInfo($this,$row['table_name']); 00075 } 00076 } 00077 00084 protected function initSequences() 00085 { 00086 // throw new SQLException("MySQL does not support sequences natively."); 00087 } 00088 00089 }

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


Copyright © 2004 Hans Lellelid  
Creole[php5] CVS