Commit 3bf071d8 authored by Gabriel Gayan's avatar Gabriel Gayan Committed by Benjamin Eberlei

added support for oracle connection pooling

parent 930d786a
......@@ -61,14 +61,17 @@ class Driver implements \Doctrine\DBAL\Driver
}
if (isset($params['service']) && $params['service'] == true) {
$dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $params['dbname'] . ')))';
$dsn .= '))(CONNECT_DATA=(SERVICE_NAME=' . $params['dbname'] . '))';
} else {
$dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . ')))';
$dsn .= '))(CONNECT_DATA=(SID=' . $params['dbname'] . '))';
}
if (isset($params['pooled']) && $params['pooled'] == true) {
$dsn .= '(SERVER=POOLED)';
}
$dsn .= ')';
} else {
$dsn .= $params['dbname'];
}
return $dsn;
}
......
......@@ -37,13 +37,18 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection
* @param string $password
* @param string $db
*/
public function __construct($username, $password, $db, $charset = null, $sessionMode = OCI_DEFAULT)
public function __construct($username, $password, $db, $charset = null, $sessionMode = OCI_DEFAULT, $pooled = false)
{
if (!defined('OCI_NO_AUTO_COMMIT')) {
define('OCI_NO_AUTO_COMMIT', 0);
}
if ($pooled) {
$this->_dbh = @oci_pconnect($username, $password, $db, $charset, $sessionMode);
} else {
$this->_dbh = @oci_connect($username, $password, $db, $charset, $sessionMode);
}
if ( ! $this->_dbh) {
throw OCI8Exception::fromErrorInfo(oci_error());
}
......
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