Commit b1347806 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Patch by milokment to fix charset configuration and allow to change oci session mode.

parent a3becb14
...@@ -36,7 +36,9 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -36,7 +36,9 @@ class Driver implements \Doctrine\DBAL\Driver
return new OCI8Connection( return new OCI8Connection(
$username, $username,
$password, $password,
$this->_constructDsn($params) $this->_constructDsn($params),
isset($params['charset']) ? $params['charset'] : null,
isset($params['sessionMode']) ? $params['sessionMode'] : OCI_DEFAULT
); );
} }
...@@ -67,10 +69,6 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -67,10 +69,6 @@ class Driver implements \Doctrine\DBAL\Driver
$dsn .= $params['dbname']; $dsn .= $params['dbname'];
} }
if (isset($params['charset'])) {
$dsn .= ';charset=' . $params['charset'];
}
return $dsn; return $dsn;
} }
......
...@@ -37,13 +37,13 @@ class OCI8Connection implements \Doctrine\DBAL\Driver\Connection ...@@ -37,13 +37,13 @@ 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) public function __construct($username, $password, $db, $charset = null, $sessionMode = OCI_DEFAULT)
{ {
if (!defined('OCI_NO_AUTO_COMMIT')) { if (!defined('OCI_NO_AUTO_COMMIT')) {
define('OCI_NO_AUTO_COMMIT', 0); define('OCI_NO_AUTO_COMMIT', 0);
} }
$this->_dbh = @oci_connect($username, $password, $db); $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