protected function checkMultipleHostDsn(array $config)
    {
        $host = is_array($config['host']) ? $config['host'] : explode(',', $config['host']);

        $count = count($host);
        if ($count > 1) {
            $address = '';
            for ($i = 0; $i < $count; $i++) {
                $address .= '(ADDRESS = (PROTOCOL = ' . $config['protocol'] . ')(HOST = ' . trim($host[$i]) . ')(PORT = ' . $config['port'] . '))';
            }

            // create a tns with multiple address connection
            $config['tns'] = "(DESCRIPTION = {$address} (LOAD_BALANCE = yes) (FAILOVER = on) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = {$config['database']})))";
        }

        return $config;
    }
protected function checkMultipleHostDsn(array $config)
    {
        $host = is_array($config['host']) ? $config['host'] : explode(',', $config['host']);

        $count = count($host);
        if ($count > 1) {
            $address = '';
            for ($i = 0; $i < $count; $i++) {
                $address .= '(ADDRESS = (PROTOCOL = ' . $config['protocol'] . ')(HOST = ' . trim($host[$i]) . ')(PORT = ' . $config['port'] . '))';
            }

            // create a tns with multiple address connection
            $config['tns'] = "(DESCRIPTION = {$address} (LOAD_BALANCE = yes) (FAILOVER = on) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = {$config['database']})))";
        }

        return $config;
    }
protected function checkMultipleHostDsn ( array $ config ) { $ host = is_array ( $ config [ 'host' ] ) ? $ config [ 'host' ] : explode ( ',' , $ config [ 'host' ] ) ; $ count = count ( $ host ) ; if ( $ count > 1 ) { $ address = '' ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ address .= '(ADDRESS = (PROTOCOL = ' . $ config [ 'protocol' ] . ')(HOST = ' . trim ( $ host [ $ i ] ) . ')(PORT = ' . $ config [ 'port' ] . '))' ; } // create a tns with multiple address connection $ config [ 'tns' ] = "(DESCRIPTION = {$address} (LOAD_BALANCE = yes) (FAILOVER = on) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = {$config['database']})))" ; } return $ config ; }
Set DSN host from config.

@param array $config
@return array
Set DSN host from config .