<commit_before><?php

namespace Mocodo\Db\Driver;

class MySQLConnection extends \PDO
{
    private $query;

    private $preparedParams = [];

    public function quote($value, $parameterType = \PDO::PARAM_STR)
    {
        if (!is_array($value)) {
            return parent::quote($value, $parameterType);
        }

        foreach ($value as $k => $v) {
            $value[$k] = parent::quote($v, $parameterType);
        }

        return implode(', ', $value);
    }

    public function find($query, array $params = [])
    {
        $this->query = $query;

        if (!empty($params['conditions'])) {
            $this->conditions($params['conditions']);
        }

        if (!empty($params['group'])) {
            $this->group($params['group']);
        }

        if (!empty($params['order'])) {
            $this->order($params['order']);
        }

        if (!empty($params['limit'])) {
            if (!empty($params['offset'])) {
                $this->limit($params['limit'], $params['offset']);
            } else {
                $this->limit($params['limit']);
            }
        }

        $stmt = $this->prepare($this->query);
        $stmt->execute($this->preparedParams);

        return $stmt;
    }

    public function findOne($query, array $params = [])
    {
        $this->query = $query;

        if (!empty($params['conditions'])) {
            $this->conditions($params['conditions']);
        }

        if (!empty($params['group'])) {
            $this->group($params['group']);
        }

        if (!empty($params['order'])) {
            $this->order($params['order']);
        }

        $this->query .= ' LIMIT 1';

        $stmt = $this->prepare($this->query);
        $stmt->execute($this->preparedParams);

        return $stmt;
    }

    public function dumpQuery($query, array $params = [], $single = true)
    {
        $this->query = $query;
<commit_msg>patching the prepared statements values array, was not reset before each request<commit_after><?php

namespace Mocodo\Db\Driver;

class MySQLConnection extends \PDO
{
    private $query;

    private $preparedParams = [];

    public function quote($value, $parameterType = \PDO::PARAM_STR)
    {
        if (!is_array($value)) {
            return parent::quote($value, $parameterType);
        }

        foreach ($value as $k => $v) {
            $value[$k] = parent::quote($v, $parameterType);
        }

        return implode(', ', $value);
    }

    public function find($query, array $params = [])
    {
        $this->preparedParams = [];
        $this->query = $query;

        if (!empty($params['conditions'])) {
            $this->conditions($params['conditions']);
        }

        if (!empty($params['group'])) {
            $this->group($params['group']);
        }

        if (!empty($params['order'])) {
            $this->order($params['order']);
        }

        if (!empty($params['limit'])) {
            if (!empty($params['offset'])) {
                $this->limit($params['limit'], $params['offset']);
            } else {
                $this->limit($params['limit']);
            }
        }

        $stmt = $this->prepare($this->query);
        $stmt->execute($this->preparedParams);

        return $stmt;
    }

    public function findOne($query, array $params = [])
    {
        $this->preparedParams = [];
        $this->query = $query;

        if (!empty($params['conditions'])) {
            $this->conditions($params['conditions']);
        }

        if (!empty($params['group'])) {
            $this->group($params['group']);
        }

        if (!empty($params['order'])) {
            $this->order($params['order']);
        }

        $this->query .= ' LIMIT 1';

        $stmt = $this->prepare($this->query);
        $stmt->execute($this->preparedParams);

        return $stmt;
    }

    public function dumpQuery($query, array $params = [], $single = true)
    {
        $this->preparedParams = [];
        $this->query = $query;

{'fraction_non_alphanumeric': 0.18954738684671169, 'fraction_numerical': 0.0005001250312578145, 'mean_word_length': 2.0211480362537766, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, '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': '643083', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1088, 'n_words': 202}