src/db/pgsql/PostgresConnector.php
private function getConnectionString() {
        // supported keywords:  https://www.postgresql.org/docs/9.6/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS
        $paramKeywords = [
            'host',
            'hostaddr',
            'port',
            'dbname',
            'user',
            'password',
            'connect_timeout',
            'client_encoding',
            'options',
            'application_name',
            'fallback_application_name',
            'keepalives',
            'keepalives_idle',
            'keepalives_interval',
            'keepalives_count',
            'tty',                                          // ignored
            'sslmode',
            'requiressl',                                   // deprecated in favor of 'sslmode'
            'sslcompression',
            'sslcert',
            'sslkey',
            'sslrootcert',
            'sslcrl',
            'requirepeer',
            'krbsrvname',
          //'gsslib',                                       // rejected by php_pgsql 9.4.1
            'service',
        ];
        $paramKeywords = \array_flip($paramKeywords);
        $connStr = '';

        foreach ($this->options as $key => $value) {
            $keyL = trim(strtolower($key));

            if (!isset($paramKeywords[$keyL])) continue;    // unknown keyword

            if (is_array($value)) {
                if ($keyL != 'options') continue;           // "options" is the only allowed keyword with nested settings

                // split regular connection options and session variables
                if (isset($value[''])) {
                    $this->options[$key] = $value[''];
                    unset($value['']);
                    $this->sessionVars = $value;
                    $value = $this->options[$key];          // the root value goes into the connection string
                }
                else {
                    unset($this->options[$key]);
                    $this->sessionVars = $value;
                    continue;                               // "options" has only session vars and no root value [""]
                }
            }

            if (!strlen($value)) {
                $value = "''";
            }
            else {
                $value = str_replace(['\\', "'"], ['\\\\', "\'"], $value);
                if (strContains($value, ' '))
                    $value = "'".$value."'";
            }
            $connStr .= $key.'='.$value.' ';
        }
        return trim($connStr);
    }
private function getConnectionString() {
        // supported keywords:  https://www.postgresql.org/docs/9.6/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS
        $paramKeywords = [
            'host',
            'hostaddr',
            'port',
            'dbname',
            'user',
            'password',
            'connect_timeout',
            'client_encoding',
            'options',
            'application_name',
            'fallback_application_name',
            'keepalives',
            'keepalives_idle',
            'keepalives_interval',
            'keepalives_count',
            'tty',                                          // ignored
            'sslmode',
            'requiressl',                                   // deprecated in favor of 'sslmode'
            'sslcompression',
            'sslcert',
            'sslkey',
            'sslrootcert',
            'sslcrl',
            'requirepeer',
            'krbsrvname',
          //'gsslib',                                       // rejected by php_pgsql 9.4.1
            'service',
        ];
        $paramKeywords = \array_flip($paramKeywords);
        $connStr = '';

        foreach ($this->options as $key => $value) {
            $keyL = trim(strtolower($key));

            if (!isset($paramKeywords[$keyL])) continue;    // unknown keyword

            if (is_array($value)) {
                if ($keyL != 'options') continue;           // "options" is the only allowed keyword with nested settings

                // split regular connection options and session variables
                if (isset($value[''])) {
                    $this->options[$key] = $value[''];
                    unset($value['']);
                    $this->sessionVars = $value;
                    $value = $this->options[$key];          // the root value goes into the connection string
                }
                else {
                    unset($this->options[$key]);
                    $this->sessionVars = $value;
                    continue;                               // "options" has only session vars and no root value [""]
                }
            }

            if (!strlen($value)) {
                $value = "''";
            }
            else {
                $value = str_replace(['\\', "'"], ['\\\\', "\'"], $value);
                if (strContains($value, ' '))
                    $value = "'".$value."'";
            }
            $connStr .= $key.'='.$value.' ';
        }
        return trim($connStr);
    }
private function getConnectionString ( ) { // supported keywords:  https://www.postgresql.org/docs/9.6/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS $ paramKeywords = [ 'host' , 'hostaddr' , 'port' , 'dbname' , 'user' , 'password' , 'connect_timeout' , 'client_encoding' , 'options' , 'application_name' , 'fallback_application_name' , 'keepalives' , 'keepalives_idle' , 'keepalives_interval' , 'keepalives_count' , 'tty' , // ignored 'sslmode' , 'requiressl' , // deprecated in favor of 'sslmode' 'sslcompression' , 'sslcert' , 'sslkey' , 'sslrootcert' , 'sslcrl' , 'requirepeer' , 'krbsrvname' , //'gsslib',                                       // rejected by php_pgsql 9.4.1 'service' , ] ; $ paramKeywords = \ array_flip ( $ paramKeywords ) ; $ connStr = '' ; foreach ( $ this -> options as $ key => $ value ) { $ keyL = trim ( strtolower ( $ key ) ) ; if ( ! isset ( $ paramKeywords [ $ keyL ] ) ) continue ; // unknown keyword if ( is_array ( $ value ) ) { if ( $ keyL != 'options' ) continue ; // "options" is the only allowed keyword with nested settings // split regular connection options and session variables if ( isset ( $ value [ '' ] ) ) { $ this -> options [ $ key ] = $ value [ '' ] ; unset ( $ value [ '' ] ) ; $ this -> sessionVars = $ value ; $ value = $ this -> options [ $ key ] ; // the root value goes into the connection string } else { unset ( $ this -> options [ $ key ] ) ; $ this -> sessionVars = $ value ; continue ; // "options" has only session vars and no root value [""] } } if ( ! strlen ( $ value ) ) { $ value = "''" ; } else { $ value = str_replace ( [ '\\' , "'" ] , [ '\\\\' , "\'" ] , $ value ) ; if ( strContains ( $ value , ' ' ) ) $ value = "'" . $ value . "'" ; } $ connStr .= $ key . '=' . $ value . ' ' ; } return trim ( $ connStr ) ; }
Resolve and return the PostgreSQL connection string from the passed connection options.

@return string
Resolve and return the PostgreSQL connection string from the passed connection options .