function __construct($dsn, $username = '', $password = '', $driver_options = array())
{
if (is_array($dsn)) {
$args = $dsn;
if (isset($args[0])) {
$dsn = $args[0];
}
if (isset($args[1])) {
$username = $args[1];
}
if (isset($args[2])) {
$password = $args[2];
}
if (isset($args[3])) {
$driver_options = $args[3];
}
}
try {
parent::__construct($dsn, $username, $password, $driver_options);
parent::setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $exception) {
throw new DataSourceCouldNotConnectException($exception->getMessage(), get_defined_vars());
}
$this->cachePrefix = self::CACHE_PREFIX . $dsn . '::*::';
$this->provider = $this->instantiateProvider();
}