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/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 if (isset($dsn['schema'])) {
00041 $this->schema = $dsn['schema'];
00042 } else {
00043
00044 $this->schema = $dsn['username'];
00045 }
00046
00047 $this->schema = strtoupper( $this->schema );
00048 }
00049
00050 public function getSchema() {
00051 return $this->schema;
00052 }
00053
00058 protected function initTables()
00059 {
00060 include_once 'creole/drivers/oracle/metadata/OCI8TableInfo.php';
00061
00062 $sql = "SELECT table_name
00063 FROM all_tables
00064 WHERE owner = '{$this->schema}'";
00065
00066 $statement = @oci_parse($this->conn->getResource(),$sql);
00067
00068 $success = @oci_execute($statement,OCI_DEFAULT);
00069 if (!$success) {
00070 throw new SQLException("Could not get tables", $this->conn->getResource()->nativeError($statement));
00071 }
00072 while ( $statement && $row = oci_fetch_assoc( $statement ) )
00073 {
00074 $row = array_change_key_case($row,CASE_LOWER);
00075 $this->tables[strtoupper($row['table_name'])] = new OCI8TableInfo($this,$row['table_name']);
00076 }
00077 }
00078
00085 protected function initSequences()
00086 {
00087
00088 }
00089
00090 }