/**
  * Connect to a socket. If socket still open from last request (which
  * is the case when unread data is left on it by not reading the body,
  * e.g.), use the quick & dirty way: Close and reopen!
  *
  * @param  peer.Socket $s
  * @param  double $read Read timeout
  * @param  double $connect Connect timeout
  * @return peer.Socket
  */
 protected function connect($s, $read, $connect)
 {
     $s->isConnected() && $s->close();
     $s->setTimeout($read);
     $s->connect($connect);
     return $s;
 }
 /**
  * Constructor
  *
  * @param   rdbms.DSN dsn
  */
 public function __construct($dsn)
 {
     parent::__construct($dsn);
     $this->formatter = new StatementFormatter($this, $this->getDialect());
     $sock = new Socket($this->dsn->getHost(), $this->dsn->getPort(1433));
     $sock->setTimeout(-1);
     $this->handle = $this->getProtocol($sock);
 }
 /**
  * Constructor
  *
  * @param   rdbms.DSN dsn
  */
 public function __construct($dsn)
 {
     parent::__construct($dsn);
     $this->formatter = new StatementFormatter($this, new MysqlDialect());
     // Use local socket (unix socket on Un*x systems, named pipe on Windows)
     // if "." is supplied as hostname
     $host = $this->dsn->getHost();
     if ('.' === $host) {
         $sock = LocalSocket::forName(PHP_OS)->newInstance($this->dsn->getProperty('socket', null));
     } else {
         $sock = new Socket($host, $this->dsn->getPort(3306));
         $sock->setTimeout(-1);
     }
     $this->handle = new MySqlxProtocol($sock);
 }