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