public static driverException ( Doctrine\DBAL\Driver $driver, Exception $driverEx ) : |
||
$driver | Doctrine\DBAL\Driver | |
$driverEx | Exception | |
return |
/** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { try { $pdo = new PDOConnection($this->_constructPdoDsn($params), $username, $password, $driverOptions); if (PHP_VERSION_ID >= 50600 && (!isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) || true === $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])) { $pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); } return $pdo; } catch (PDOException $e) { throw DBALException::driverException($this, $e); } }
/** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { try { return new MysqliConnection($params, $username, $password, $driverOptions); } catch (MysqliException $e) { throw DBALException::driverException($this, $e); } }
/** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { try { return new PDOConnection($this->constructPdoDsn($params), $username, $password, $driverOptions); } catch (\PDOException $e) { throw DBALException::driverException($this, $e); } }
/** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { try { return new OCI8Connection($username, $password, $this->_constructDsn($params), isset($params['charset']) ? $params['charset'] : null, isset($params['sessionMode']) ? $params['sessionMode'] : OCI_DEFAULT, isset($params['persistent']) ? $params['persistent'] : false); } catch (OCI8Exception $e) { throw DBALException::driverException($this, $e); } }
/** * {@inheritdoc} * * @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection. */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { try { return new SQLAnywhereConnection($this->buildDsn(isset($params['host']) ? $params['host'] : null, isset($params['port']) ? $params['port'] : null, isset($params['server']) ? $params['server'] : null, isset($params['dbname']) ? $params['dbname'] : null, $username, $password, $driverOptions), isset($params['persistent']) ? $params['persistent'] : false); } catch (SQLAnywhereException $e) { throw DBALException::driverException($this, $e); } }
/** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { try { $conn = new \Doctrine\DBAL\Driver\PDOConnection($this->_constructPdoDsn($params), $username, $password, $driverOptions); } catch (PDOException $e) { throw DBALException::driverException($this, $e); } return $conn; }
/** * {@inheritdoc} */ public function connect(array $params, $username = NULL, $password = NULL, array $driverOptions = []) { try { // create our special driver $conn = new PDOConnection($this->constructPdoDsn($params), $username, $password, $driverOptions); } catch (PDOException $e) { throw DBALException::driverException($this, $e); } return $conn; }
/** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { if (isset($driverOptions['userDefinedFunctions'])) { $this->_userDefinedFunctions = array_merge($this->_userDefinedFunctions, $driverOptions['userDefinedFunctions']); unset($driverOptions['userDefinedFunctions']); } try { $pdo = new PDOConnection($this->_constructPdoDsn($params), $username, $password, $driverOptions); } catch (PDOException $ex) { throw DBALException::driverException($this, $ex); } foreach ($this->_userDefinedFunctions as $fn => $data) { $pdo->sqliteCreateFunction($fn, $data['callback'], $data['numArgs']); } return $pdo; }
/** * {@inheritdoc} * * @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection. * @throws SQLAnywhereException if a mandatory connection parameter is missing. */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { if (!isset($params['host'])) { throw new SQLAnywhereException("Missing 'host' in configuration for sqlanywhere driver."); } if (!isset($params['server'])) { throw new SQLAnywhereException("Missing 'server' in configuration for sqlanywhere driver."); } if (!isset($params['dbname'])) { throw new SQLAnywhereException("Missing 'dbname' in configuration for sqlanywhere driver."); } try { return new SQLAnywhereConnection($this->buildDsn($params['host'], isset($params['port']) ? $params['port'] : null, $params['server'], $params['dbname'], $username, $password, $driverOptions), isset($params['persistent']) ? $params['persistent'] : false); } catch (SQLAnywhereException $e) { throw DBALException::driverException($this, $e); } }
/** * {@inheritdoc} */ public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) { try { $pdo = new PDOConnection($this->_constructPdoDsn($params), $username, $password, $driverOptions); if (defined('PDO::PGSQL_ATTR_DISABLE_PREPARES') && (!isset($driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES]) || true === $driverOptions[PDO::PGSQL_ATTR_DISABLE_PREPARES])) { $pdo->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); } /* defining client_encoding via SET NAMES to avoid inconsistent DSN support * - the 'client_encoding' connection param only works with postgres >= 9.1 * - passing client_encoding via the 'options' param breaks pgbouncer support */ if (isset($params['charset'])) { $pdo->query('SET NAMES \'' . $params['charset'] . '\''); } return $pdo; } catch (PDOException $e) { throw DBALException::driverException($this, $e); } }
/** * Constructs the Informix PDO DSN. * * @param array $params * @return string The DSN. * @throws \Doctrine\DBAL\DBALException * @see \Doctrine\DBAL\Driver::connect */ private function constructPdoDsn(array $params) { if (empty($params['dbname'])) { throw DBALException::driverException($this, new \Exception("Missing 'dbname' in configuration for informix driver")); } if (empty($params['host'])) { throw DBALException::driverException($this, new \Exception("Missing 'host' in configuration for informix driver")); } if (empty($params['protocol'])) { throw DBALException::driverException($this, new \Exception("Missing 'protocol' in configuration for informix driver")); } if (empty($params['server'])) { throw DBALException::driverException($this, new \Exception("Missing 'server' in configuration for informix driver")); } $dsn = 'informix:' . 'host=' . $params['host'] . ';' . 'server=' . $params['server'] . ';' . 'database=' . $params['dbname'] . ';' . 'protocol=' . $params['protocol'] . ';'; if (!empty($params['port'])) { $dsn .= 'service=' . $params['port'] . ';'; } return $dsn; }