<commit_before><?php
/**
 * An implementation of a postgresql datastore. This model is used to store the 
 * postgresql data.
 *
 * @author james
 *
 */
class postgresql extends SQLDBDataStore
{
    protected static $_conn = null;
    private static $namesSeen = array();

    public function __construct()
    {
        if(!is_resource(postgresql::$_conn))
        {
            postgresql::$_conn = Db::get();
        }
    }
    
    public function __wakeup()
    {
        if(!is_resource(postgresql::$_conn))
        {
            postgresql::$_conn = Db::get();
        }
    }

    public function beginTransaction($external = true)
    {
        $this->query("BEGIN");
    }

    public function endTransaction($external = true)
    {
        $this->query("COMMIT");
    }<commit_msg>Re added support for nested transaction .... wyf style!<commit_after><?php
/**
 * An implementation of a postgresql datastore. This model is used to store the 
 * postgresql data.
 *
 * @author james
 *
 */
class postgresql extends SQLDBDataStore
{
    protected static $_conn = null;
    private static $namesSeen = array();
    private static $nesting = 0;

    public function __construct()
    {
        if(!is_resource(postgresql::$_conn))
        {
            postgresql::$_conn = Db::get();
        }
    }
    
    public function __wakeup()
    {
        if(!is_resource(postgresql::$_conn))
        {
            postgresql::$_conn = Db::get();
        }
    }

    public function beginTransaction($external = true)
    {
        if(postgresql::$nesting == 0)
        {
            $this->query("BEGIN");
        }
        postgresql::$nesting++;
    }

    public function endTransaction($external = true)
    {
        postgresql::$nesting--;
        if(postgresql::$nesting == 0)
        {
            $this->query("COMMIT");
        }
    }
{'fraction_non_alphanumeric': 0.12979989183342347, 'fraction_numerical': 0.0016224986479177934, 'mean_word_length': 2.125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6738872', 'n_tokens_mistral': 564, 'n_tokens_neox': 547, 'n_words': 121}