MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
Driver.php
Ir para a documentação deste ficheiro.
1<?php
2/*
3 * $Id$
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, see
19 * <http://www.doctrine-project.org>.
20 */
21
23
25
33{
34 public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
35 {
36 return new OCI8Connection(
37 $username,
38 $password,
39 $this->_constructDsn($params),
40 isset($params['charset']) ? $params['charset'] : null,
41 isset($params['sessionMode']) ? $params['sessionMode'] : OCI_DEFAULT
42 );
43 }
44
50 private function _constructDsn(array $params)
51 {
52 $dsn = '';
53 if (isset($params['host'])) {
54 $dsn .= '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
55 '(HOST=' . $params['host'] . ')';
56
57 if (isset($params['port'])) {
58 $dsn .= '(PORT=' . $params['port'] . ')';
59 } else {
60 $dsn .= '(PORT=1521)';
61 }
62
63 $dsn .= '))';
64 if (isset($params['dbname'])) {
65 $dsn .= '(CONNECT_DATA=(SID=' . $params['dbname'] . ')';
66 }
67 $dsn .= '))';
68 } else {
69 $dsn .= $params['dbname'];
70 }
71
72 return $dsn;
73 }
74
75 public function getDatabasePlatform()
76 {
77 return new \Doctrine\DBAL\Platforms\OraclePlatform();
78 }
79
80 public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
81 {
82 return new \Doctrine\DBAL\Schema\OracleSchemaManager($conn);
83 }
84
85 public function getName()
86 {
87 return 'oci8';
88 }
89
90 public function getDatabase(\Doctrine\DBAL\Connection $conn)
91 {
92 $params = $conn->getParams();
93 return $params['user'];
94 }
95}
getDatabase(\Doctrine\DBAL\Connection $conn)
Definição Driver.php:90
connect(array $params, $username=null, $password=null, array $driverOptions=array())
Definição Driver.php:34
getSchemaManager(\Doctrine\DBAL\Connection $conn)
Definição Driver.php:80