public function getDSN () {
        $dsn = [];

        // Pick $data_source parameters that make up the DSN string.
        $map = [
            'host' => 'host',
            'port' => 'port',
            'dbname' => 'database',
            'unix_socket' => 'unix_socket',
            'charset' => 'charset'
        ];

        foreach ($map as $dsn_name => $data_source_parameter_name) {
            if (isset($this->data_source[$data_source_parameter_name])) {
                $dsn[] = $dsn_name . '=' . $this->data_source[$data_source_parameter_name];
            }
        }

        if ($dsn) {
            $dsn = $this->data_source['driver'] . ':' . implode(';', $dsn);
        } else {
            $dsn = $this->data_source['driver'];
        }

        return $dsn;
    }
public function getDSN () {
        $dsn = [];

        // Pick $data_source parameters that make up the DSN string.
        $map = [
            'host' => 'host',
            'port' => 'port',
            'dbname' => 'database',
            'unix_socket' => 'unix_socket',
            'charset' => 'charset'
        ];

        foreach ($map as $dsn_name => $data_source_parameter_name) {
            if (isset($this->data_source[$data_source_parameter_name])) {
                $dsn[] = $dsn_name . '=' . $this->data_source[$data_source_parameter_name];
            }
        }

        if ($dsn) {
            $dsn = $this->data_source['driver'] . ':' . implode(';', $dsn);
        } else {
            $dsn = $this->data_source['driver'];
        }

        return $dsn;
    }
public function getDSN ( ) { $ dsn = [ ] ; // Pick $data_source parameters that make up the DSN string. $ map = [ 'host' => 'host' , 'port' => 'port' , 'dbname' => 'database' , 'unix_socket' => 'unix_socket' , 'charset' => 'charset' ] ; foreach ( $ map as $ dsn_name => $ data_source_parameter_name ) { if ( isset ( $ this -> data_source [ $ data_source_parameter_name ] ) ) { $ dsn [ ] = $ dsn_name . '=' . $ this -> data_source [ $ data_source_parameter_name ] ; } } if ( $ dsn ) { $ dsn = $ this -> data_source [ 'driver' ] . ':' . implode ( ';' , $ dsn ) ; } else { $ dsn = $ this -> data_source [ 'driver' ] ; } return $ dsn ; }
Generate the connection string.

@return string
Generate the connection string .