123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace Doctrine\DBAL\Driver\PDOOracle;
- use Doctrine\DBAL\Driver\AbstractOracleDriver;
- use Doctrine\DBAL\Driver\PDO;
- use Doctrine\DBAL\Exception;
- use Doctrine\Deprecations\Deprecation;
- use PDOException;
- /**
- * PDO Oracle driver.
- *
- * @deprecated Use {@link PDO\OCI\Driver} instead.
- */
- class Driver extends AbstractOracleDriver
- {
- /**
- * {@inheritdoc}
- */
- public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
- {
- try {
- return new PDO\Connection(
- $this->constructPdoDsn($params),
- $username,
- $password,
- $driverOptions
- );
- } catch (PDOException $e) {
- throw Exception::driverException($this, $e);
- }
- }
- /**
- * Constructs the Oracle PDO DSN.
- *
- * @param mixed[] $params
- *
- * @return string The DSN.
- */
- private function constructPdoDsn(array $params)
- {
- $dsn = 'oci:dbname=' . $this->getEasyConnectString($params);
- if (isset($params['charset'])) {
- $dsn .= ';charset=' . $params['charset'];
- }
- return $dsn;
- }
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- Deprecation::trigger(
- 'doctrine/dbal',
- 'https://github.com/doctrine/dbal/issues/3580',
- 'Driver::getName() is deprecated'
- );
- return 'pdo_oracle';
- }
- }
|