<commit_before><?php

namespace Dero\Data;
use Dero\Core\Config;

/**
 * PDO wrapper for PostgreSQL
 * @author <NAME>
 * @package DeroFramework
 * @namespace Dero\Data
 * @since 2012-12-08
 */

abstract class PDOPostgre extends PDOWrapper
{
    /**
     * Opens a connection for a query
     */
    protected function OpenConnection($bIsRead){}
}<commit_msg>PostgreSQL OpenConnection<commit_after><?php

namespace Dero\Data;
use Dero\Core\Config;

/**
 * PDO wrapper for PostgreSQL
 * @author <NAME>
 * @package DeroFramework
 * @namespace Dero\Data
 * @since 2012-12-08
 */

abstract class PDOPostgre extends PDOWrapper
{
    private $oInstance;

    /**
     * Opens a connection for a query
     */
    protected function OpenConnection($bIsRead)
    {
        $aConfigArgs = [
            'database',
            $this->sInstance
        ];
        $aOpts = [];
        $aOpts['Name'] = call_user_func_array('Config::GetValue', array_merge($aConfigArgs, 'name'));
        $aOpts['Host'] = call_user_func_array('Config::GetValue', array_merge($aConfigArgs, 'host'));
        $aOpts['User'] = call_user_func_array('Config::GetValue', array_merge($aConfigArgs, 'user'));
        $aOpts['Pass'] = call_user_func_array('Config::GetValue', array_merge($aConfigArgs, 'pass'));
        $aOpts['Port'] = call_user_func_array('Config::GetValue', array_merge($aConfigArgs, 'port')) ?: 3306;
        if( in_array(null, $aOpts) )
        {
            throw new \UnexpectedValueException('Database connection information not properly defined');
        }
        if( !$this->oInstance )
        {
            $this->oInstance = new \PDO(
                sprintf(
                    'pgsql:host=%s;port=%d;dbname=%s;user=%s;password=%s',
                    $aOpts['Host'],
                    $aOpts['Port'],
                    $aOpts['Name'],
                    $aOpts['User'],
                    $aOpts['Pass']
                )
            );
        }
        return $this->oInstance;
    }
}
{'fraction_non_alphanumeric': 0.14414866901054746, 'fraction_numerical': 0.010045203415369162, 'mean_word_length': 2.405128205128205, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4857934', 'n_tokens_mistral': 625, 'n_tokens_neox': 615, 'n_words': 115}