[getDsn description].

@return [type] [description]
5253
public function getDsn()
    {
        if (!$this->config) {
            return '';
        }
        $dsn = array();
        $dbName = null;

        if ($this->config->getName()) {
            $dbName = $this->config->getName();
        }

        if ($this->config->getHost()) {
            if ($this->config->getPort()) {
                $dsn[] = sprintf('dbname=//%s:%s/%s',
                    $this->config->getHost(),
                    $this->config->getPort(),
                    $dbName
                );
            } else {
                $dsn[] = sprintf('dbname=//%s/%s',
                    $this->config->getHost(),
                    $dbName
                );
            }
        } else {
            $dsn[] = 'dbname='.$dbName;
        }

        if ($this->config->getChar()) {
            $dsn[] = 'charset='.$this->config->getChar();
        }

        return $this->getPrefix().implode(';', $dsn);
    }
134141
protected function _dsn()
    {
        $this->_checkRequiredOptions($this->_config);

        // check if using full connection string
        if (array_key_exists('host', $this->_config)) {
            $dsn = ';DATABASE=' . $this->_config['dbname']
            . ';HOSTNAME=' . $this->_config['host']
            . ';PORT='     . $this->_config['port']
            // PDO_IBM supports only DB2 TCPIP protocol
            . ';PROTOCOL=' . 'TCPIP;';
        } else {
            // catalogued connection
            $dsn = $this->_config['dbname'];
        }
        return $this->_pdoType . ': ' . $dsn;
    }
701328
public function getDsn()
    {
        if (!$this->config) {
            return '';
        }
        $dsn = array();

        if ($this->config->getSock()) {
            $dsn[] = 'unix_socket='.$this->config->getSock();
        }

        if ($this->config->getHost()) {
            $dsn[] = 'host='.$this->config->getHost();
        }

        if ($this->config->getPort()) {
            $dsn[] = 'port='.$this->config->getPort();
        }

        if ($this->config->getName()) {
            $dsn[] = 'dbname='.$this->config->getName();
        }

        if ($this->config->getChar() && in_array('charset', $this->getElements())) {
            $dsn[] = 'charset='.$this->config->getChar();
        }

        return $this->getPrefix().implode(';', $dsn);
    }
884070
protected function getDSN():string {
		$dsn = $this->drivername.':dbname=';

		if($this->options->host !== null){
			$dsn .= $this->options->host;

			if(is_numeric($this->options->port)){
				$dsn .= '/'.$this->options->port;
			}

			$dsn .= ':';
		}

		$dsn .= $this->options->database;

		if($this->options->firebird_encoding !== null){
			$dsn .= ';encoding='.$this->options->firebird_encoding;
		}

		return $dsn;
	}
536497
private function getServerString(): string
    {
        return \sprintf(
            '{%s%s%s}',
            $this->hostname,
            '' !== $this->port ? ':' . $this->port : '',
            $this->flags
        );
    }
994830
public function getDsn()
    {
        if (!$this->config) {
            return '';
        }
        $dsn = array();

        if ($this->config->getHost()) {
            $dsn[] = 'host='.$this->config->getHost();
        }

        if ($this->config->getPort()) {
            $dsn[] = 'port='.$this->config->getPort();
        }

        if ($this->config->getName()) {
            $dsn[] = 'dbname='.$this->config->getName();
        }

        if ($this->config->getUser()) {
            $dsn[] = 'user='.$this->config->getUser();
        }

        if ($this->config->getPass()) {
            $dsn[] = 'password='.$this->config->getPass();
        }

        return $this->getPrefix().implode(';', $dsn);
    }
789367
public static function getWebServerSoftWare() : string
    {
        static $type;

        if (isset($type)) {
            return $type;
        }

        $software = isset($_SERVER['SERVER_SOFTWARE'])
            ? $_SERVER['SERVER_SOFTWARE']
            : null;

        $type = self::SERVER_TYPE_UNKNOWN;

        if (stripos($software, 'lighttpd') !== false) {
            $type = self::SERVER_TYPE_LIGHTTPD;
        }

        if (strpos($software, 'Hiawatha') !== false) {
            $type = self::SERVER_TYPE_HIAWATHA;
        }

        if (strpos($software, 'Apache') !== false) {
            $type = self::SERVER_TYPE_APACHE;
        } elseif (strpos($software, 'Litespeed') !== false) {
            $type = self::SERVER_TYPE_LITESPEED;
        }

        if (strpos($software, 'nginx') !== false) {
            $type = self::SERVER_TYPE_NGINX;
        }

        if ($type !== self::SERVER_TYPE_APACHE && $type !== self::SERVER_TYPE_LITESPEED
            && strpos($software, 'Microsoft-IIS') !== false
            && strpos($software, 'ExpressionDevServer') !== false
        ) {
            $type = self::SERVER_TYPE_IIS;
            if (intval(substr($software, strpos($software, 'Microsoft-IIS/')+14)) >= 7) {
                $type = self::SERVER_TYPE_IIS7;
            }
        }
        if (function_exists('apache_get_modules')) {
            if (in_array('mod_security', apache_get_modules())) {
                $type = self::SERVER_TYPE_APACHE;
            }

            if ($type == self::SERVER_TYPE_UNKNOWN && function_exists('apache_get_version')) {
                $type = self::SERVER_TYPE_APACHE;
            }
        }

        return $type;
    }
1172806
protected function getDsn(array $config)
    {
        // First we will create the basic DSN setup as well as the port if it is in
        // in the configuration options. This will give us the basic DSN we will
        // need to establish the PDO connections and return them back for use.
        if ($this->prefersOdbc($config)) {
            return $this->getOdbcDsn($config);
        }

        if (in_array('sqlsrv', $this->getAvailableDrivers())) {
            return $this->getSqlSrvDsn($config);
        } else {
            return $this->getDblibDsn($config);
        }
    }
71329
protected static function generateDSN()
        {
            $dsn = self::getDriver() . ":host=" . self::getHostname();
            if (self::getPort()) {
                $dsn .= ';port=' . self::getPort();
            }
            $dsn .= ';dbname=' . self::getDatabaseName();
            self::$dsn = $dsn;
        }
1067429
protected function dsn_string($dsn)
    {
        $params = array();
        $result = 'mysql:';

        if ($dsn['database']) {
            $params[] = 'dbname=' . $dsn['database'];
        }

        if ($dsn['hostspec']) {
            $params[] = 'host=' . $dsn['hostspec'];
        }

        if ($dsn['port']) {
            $params[] = 'port=' . $dsn['port'];
        }

        if ($dsn['socket']) {
            $params[] = 'unix_socket=' . $dsn['socket'];
        }

        $params[] = 'charset=utf8';

        if (!empty($params)) {
            $result .= implode(';', $params);
        }

        return $result;
    }
446750
public function chanCidTNS()
    {
        try
        {
            return $this->getSNMP()->walk1d( self::OID_ASTERISK_CHANNEL_CID_TNS );
        }
        catch( \Cityware\Snmp\Exception $e )
        {
            return null;
        }
    }
336822
protected function buildDSN()
    {
        if(isset($this->option['dsn']))
        {
            return $this->option['dsn'];
        }
        return 'mysql:'
                 . 'host=' . ($this->option['host'] ?? '127.0.0.1')
                 . ';port=' . ($this->option['port'] ?? '3306')
                 . ';dbname=' . ($this->option['database'] ?? '')
                 . ';unix_socket=' . ($this->option['unix_socket'] ?? '')
                 . ';charset=' . ($this->option['charset'] ?? 'utf8')
                 ;
    }
972839
protected function getDSN()
    {
        
        $params = $this->getParams();
        $driver = str_replace('pdo_', '', $params['driver']);
        $dbName = $params['dbname'];
        $dbUrl = $params['host'];
        $dbPort = isset($params['port']) ? ';port='.$params['port'] : '';
        
        return $driver . ':dbname=' . $dbName . ';host=' . $dbUrl . $dbPort;
        
    }
200076
static public function parseDsn($dsnStr)
    {
        if( empty($dsnStr) ){
            return false;
        }
        
        $info = parse_url($dsnStr);
        if(!$info) {
            return false;
        }
        $dsn = array(
            'adapter'    =>  $info['scheme'],
            'host'      =>  isset($info['host']) ? $info['host'] : '',
            'port'  =>  isset($info['port']) ? $info['port'] : '',
            'username'  =>  isset($info['user']) ? $info['user'] : '',
            'password'  =>  isset($info['pass']) ? $info['pass'] : '',
            'database'  =>  isset($info['path']) ? substr($info['path'],1) : '',
            'charset'   =>  isset($info['fragment'])?$info['fragment']:'utf8',
        );
        
        if(isset($info['query'])) {
            parse_str($info['query'], $dsn['params']);
        }else{
            $dsn['params']  =   array();
        }
        foreach ($dsn['params'] as $k=>$v) {
            $dsn[$k] = $v;
        }
        return $dsn;
    }
1194163
public function getExtrasDDLWithDelimiter()
    {
        $ddls = $this->getExtrasDDL();
        $start = "DELIMITER {$this->delimiter}";
        $end = 'DELIMITER ;';

        $newDdls = [];

        foreach ($ddls as $idx => $ddl) {
            $newDdls[] = $start;
            if (!preg_match('/;$/', $ddl)) {
                $newDdls[] = $ddl . ' ' . $this->delimiter;
            } else {
                $newDdls[] = preg_replace('/;$/', $this->delimiter, $ddl);
            }
            $newDdls[] = $end;
        }

        return implode(PHP_EOL, $newDdls) . PHP_EOL . $end . PHP_EOL;
    }
1035135
protected function getDsn(array $config)
    {
        return $this->hasDsnString($config) ? $this->getDsnString($config) : $this->getHostDsn($config);
    }
815890
public static function createConnectionFromDSN($dsn)
    {
        if (is_string($dsn)) {
            $parsed = self::parseDSN($dsn);
        } else {
            $parsed = $dsn;
        }

        /**
         * @todo retry connection here.
         */
        return DriverManager::getConnection($parsed);
    }