| Total Complexity | 5 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 93.33% |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | class Driver extends AbstractOracleDriver |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * {@inheritdoc} |
||
| 22 | */ |
||
| 23 | 32 | public function connect(array $params, $username = null, $password = null, array $driverOptions = []) |
|
| 24 | { |
||
| 25 | try { |
||
| 26 | 32 | return new PDOConnection( |
|
| 27 | 32 | $this->constructPdoDsn($params), |
|
| 28 | 32 | $username, |
|
| 29 | 32 | $password, |
|
| 30 | 32 | $driverOptions |
|
| 31 | ); |
||
| 32 | 3 | } catch (PDOException $e) { |
|
| 33 | 3 | throw DBALException::driverException($this, $e); |
|
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Constructs the Oracle PDO DSN. |
||
| 39 | * |
||
| 40 | * @param mixed[] $params |
||
| 41 | * |
||
| 42 | * @return string The DSN. |
||
| 43 | */ |
||
| 44 | 32 | private function constructPdoDsn(array $params) |
|
| 45 | { |
||
| 46 | 32 | $dsn = 'oci:dbname=' . $this->getEasyConnectString($params); |
|
| 47 | |||
| 48 | 32 | if (isset($params['charset'])) { |
|
| 49 | $dsn .= ';charset=' . $params['charset']; |
||
| 50 | } |
||
| 51 | |||
| 52 | 32 | return $dsn; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | 27 | public function getName() |
|
| 61 | } |
||
| 62 | } |
||
| 63 |