Exemple #1
0
 /**
  * Retrieves connection identifier
  *
  * @param DSN $dsn
  * @return mixed
  */
 public function connect(DSN $dsn)
 {
     $connection = mysql_connect($dsn->getHost(), $dsn->getUserName(), $dsn->getPassword());
     if (!$connection) {
         throw new ConnectionErrorException(mysql_error());
     }
     return $connection;
 }
Exemple #2
0
 /**
  * Constructor
  *
  * @param string|DSN $dsn
  */
 public function __construct($dsn)
 {
     $dsn = new DSN($dsn);
     $this->_adapter = Factory::createAdapter($dsn->getType());
     $this->_connection = $this->_adapter->connect($dsn);
 }