/**
  * @param array $config
  *
  * @return \Pimf\Database
  */
 public function connect(array $config)
 {
     $dsn = "mysql:host={$config['host']};dbname={$config['database']}";
     if (isset($config['port'])) {
         $dsn .= ";port={$config['port']}";
     }
     if (isset($config['unix_socket'])) {
         $dsn .= ";unix_socket={$config['unix_socket']}";
     }
     $connection = new \Pimf\Database($dsn, $config['username'], $config['password'], $this->options($config));
     // set to UTF-8 which should be fine for most scenarios.
     if (isset($config['charset'])) {
         $connection->prepare("SET NAMES '{$config['charset']}'")->execute();
     }
     return $connection;
 }
 /**
  * @param array $config
  *
  * @return \Pimf\Database
  */
 public function connect(array $config)
 {
     $dsn = "pgsql:host={$config['host']};dbname={$config['database']}";
     if (isset($config['port'])) {
         $dsn .= ";port={$config['port']}";
     }
     $connection = new \Pimf\Database($dsn, $config['username'], $config['password'], $this->options($config));
     // set to UTF-8 which should be fine for most scenarios.
     if (isset($config['charset'])) {
         $connection->prepare("SET NAMES '{$config['charset']}'")->execute();
     }
     // If a schema has been specified
     if (isset($config['schema'])) {
         $connection->prepare("SET search_path TO '{$config['schema']}'")->execute();
     }
     return $connection;
 }