Commit f27a56a2 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-543' into 2.4

parents df00bd4b 1f94b7d6
......@@ -135,6 +135,8 @@ pdo\_oci / oci8
- ``host`` (string): Hostname of the database to connect to.
- ``port`` (integer): Port of the database to connect to.
- ``dbname`` (string): Name of the database/schema to connect to.
- ``pooled`` (boolean): Whether to enable database resident
connection pooling.
- ``charset`` (string): The charset used when connecting to the
database.
......
......@@ -64,15 +64,18 @@ class Driver implements \Doctrine\DBAL\Driver
$dsn .= '(PORT=1521)';
}
$database = 'SID=' . $params['dbname'];
$pooled = '';
if (isset($params['service']) && $params['service'] == true) {
$dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $params['dbname'] . '))';
} else {
$dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . '))';
$database = 'SERVICE_NAME=' . $params['dbname'];
}
if (isset($params['pooled']) && $params['pooled'] == true) {
$dsn .= '(SERVER=POOLED)';
$pooled = '(SERVER=POOLED)';
}
$dsn .= ')';
$dsn .= '))(CONNECT_DATA=(' . $database . ')' . $pooled . '))';
} else {
$dsn .= $params['dbname'];
}
......
......@@ -53,10 +53,11 @@ class Driver implements \Doctrine\DBAL\Driver
*/
private function _constructPdoDsn(array $params)
{
$dsn = 'oci:';
$dsn = 'oci:dbname=';
if (isset($params['host']) && $params['host'] != '') {
$dsn .= 'dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
'(HOST=' . $params['host'] . ')';
$dsn .= '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)' .
'(HOST=' . $params['host'] . ')';
if (isset($params['port'])) {
$dsn .= '(PORT=' . $params['port'] . ')';
......@@ -64,13 +65,20 @@ class Driver implements \Doctrine\DBAL\Driver
$dsn .= '(PORT=1521)';
}
$database = 'SID=' . $params['dbname'];
$pooled = '';
if (isset($params['service']) && $params['service'] == true) {
$dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $params['dbname'] . ')))';
} else {
$dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . ')))';
$database = 'SERVICE_NAME=' . $params['dbname'];
}
if (isset($params['pooled']) && $params['pooled'] == true) {
$pooled = '(SERVER=POOLED)';
}
$dsn .= '))(CONNECT_DATA=(' . $database . ')' . $pooled . '))';
} else {
$dsn .= 'dbname=' . $params['dbname'];
$dsn .= $params['dbname'];
}
if (isset($params['charset'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment