/**
  * @param Host $_host
  * @param string $_database
  * @param Credential $_credential
  * @param Logger $_logger
  */
 function __construct(Host $_host, $_database, Credential $_credential, Logger $_logger = null)
 {
     $this->logger = $_logger;
     $this->connection = mysql_connect($_host->getHost(), $_credential->getUsername(), $_credential->getPassword(), true);
     if (!$this->connection) {
         throw new DatabaseException(mysql_error($this->connection));
     }
     /* ## LOGGER ## */
     if (isset($this->logger)) {
         $this->logger->DEBUG('mysql_connect: ' . $_host->getHost());
     }
     $selected = mysql_select_db($_database, $this->connection);
     if (!$selected) {
         throw new DatabaseException(mysql_error($this->connection));
     }
     /* ## LOGGER ## */
     if (isset($this->logger)) {
         $this->logger->DEBUG('mysql_select_db: ' . $_database);
     }
 }