Ejemplo n.º 1
0
 /**
  *  get the dsn connection string that PDO will use to connect to the backend
  *   
  *  @since  10-18-10
  *  @param  \MingoConfig  $config
  *  @return string  the dsn   
  */
 protected function getDsn(MingoConfig $config)
 {
     // canary...
     if (!$config->hasHost()) {
         throw new InvalidArgumentException('no host specified');
     }
     //if
     if (!$config->hasName()) {
         throw new InvalidArgumentException('no name specified');
     }
     //if
     return sprintf('pgsql:dbname=%s;host=%s;port=%s', $config->getName(), $config->getHost(), $config->getPort(5432));
 }
Ejemplo n.º 2
0
 /**
  *  get the dsn connection string that PDO will use to connect to the backend
  *   
  *  @link http://us2.php.net/manual/en/ref.pdo-mysql.php
  *  @link http://us2.php.net/manual/en/ref.pdo-mysql.connection.php   
  *  @since  10-18-10
  *  @param  \MingoConfig  $config
  *  @return string  the dsn   
  */
 protected function getDsn(MingoConfig $config)
 {
     // canary...
     if (!$config->hasHost()) {
         throw new InvalidArgumentException('no host specified');
     }
     //if
     if (!$config->hasName()) {
         throw new InvalidArgumentException('no name specified');
     }
     //if
     // charset is actually ignored <5.3.6
     return sprintf('mysql:host=%s;dbname=%s;charset=%s', $config->getHost(), $config->getName(), $this->charset);
 }