[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 /* 3 * $Id: OCI8DatabaseInfo.php,v 1.11 2006/01/17 19:44:40 hlellelid Exp $ 4 * 5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 * 17 * This software consists of voluntary contributions made by many individuals 18 * and is licensed under the LGPL. For more information please see 19 * <http://creole.phpdb.org>. 20 */ 21 22 require_once 'creole/metadata/DatabaseInfo.php'; 23 24 /** 25 * Oracle (OCI8) implementation of DatabaseInfo. 26 * 27 * @author Hans Lellelid <hans@xmpl.org> 28 * @version $Revision: 1.11 $ 29 * @package creole.drivers.oracle.metadata 30 */ 31 class OCI8DatabaseInfo extends DatabaseInfo { 32 33 private $schema; 34 35 public function __construct(Connection $conn) { 36 parent::__construct($conn); 37 38 $dsn = $conn->getDSN(); 39 40 if (isset($dsn['schema'])) { 41 $this->schema = $dsn['schema']; 42 } else { 43 // For Changing DB/Schema in Meta Data Interface 44 $this->schema = $dsn['username']; 45 } 46 47 $this->schema = strtoupper( $this->schema ); 48 } 49 50 public function getSchema() { 51 return $this->schema; 52 } 53 54 /** 55 * @throws SQLException 56 * @return void 57 */ 58 protected function initTables() 59 { 60 include_once 'creole/drivers/oracle/metadata/OCI8TableInfo.php'; 61 62 $sql = "SELECT table_name 63 FROM all_tables 64 WHERE owner = '{$this->schema}'"; 65 66 $statement = @oci_parse($this->conn->getResource(),$sql); 67 68 $success = @oci_execute($statement,OCI_DEFAULT); 69 if (!$success) { 70 throw new SQLException("Could not get tables", $this->conn->getResource()->nativeError($statement)); 71 } 72 while ( $statement && $row = oci_fetch_assoc( $statement ) ) 73 { 74 $row = array_change_key_case($row,CASE_LOWER); 75 $this->tables[strtoupper($row['table_name'])] = new OCI8TableInfo($this,$row['table_name']); 76 } 77 } 78 79 /** 80 * Oracle supports sequences. 81 * 82 * @return void 83 * @throws SQLException 84 */ 85 protected function initSequences() 86 { 87 // throw new SQLException("MySQL does not support sequences natively."); 88 } 89 90 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |