<commit_before><?php
namespace vipnytt\RobotsTxtParser\SQL;

use PDO;
use vipnytt\RobotsTxtParser\Exceptions\SQLException;

/**
 * Class TableConstructor
 *
 * @package vipnytt\RobotsTxtParser\SQL
 */
class TableConstructor
{
    /**
     * Database connection
     * @var PDO
     */
    private $pdo;

    /**
     * Table name
     * @var string
     */
    private $table;

    /**
     * TableConstructor constructor.
     *
     * @param PDO $pdo
     * @param string $tableName
     */
    public function __construct(PDO $pdo, $tableName)
    {
        $this->pdo = $pdo;
        $this->table = $tableName;
    }

    /**
     * Create table
     *
     * @param string $sql
     * @param string $readme
     * @return bool
     * @throws SQLException
     */
    public function create($sql, $readme)
    {
        if ($this->exists()) {
            return true;
        }
        try {
            $this->pdo->query($sql);
        } catch (\PDOException $exception) {
        }
        if ($this->exists()) {
            return true;
        }
        throw new SQLException('Automatic setup failed, please create table `' . $this->table . '` manually. Setup instructions: ' . $readme);
    }

    /**
     * Check if the table exists
     *
     * @return bool
     */
    public function exists()
    {
        try {
            $result = $this->pdo->query("SELECT 1 FROM " . $this->table . " LIMIT 1;");
        } catch (\PDOException $e) {
            return false;
        }
        return $result !== false;
    }
}<commit_msg>TableConstructor catch fix<commit_after><?php
namespace vipnytt\RobotsTxtParser\SQL;

use PDO;
use vipnytt\RobotsTxtParser\Exceptions\SQLException;

/**
 * Class TableConstructor
 *
 * @package vipnytt\RobotsTxtParser\SQL
 */
class TableConstructor
{
    /**
     * Database connection
     * @var PDO
     */
    private $pdo;

    /**
     * Table name
     * @var string
     */
    private $table;

    /**
     * TableConstructor constructor.
     *
     * @param PDO $pdo
     * @param string $tableName
     */
    public function __construct(PDO $pdo, $tableName)
    {
        $this->pdo = $pdo;
        $this->table = $tableName;
    }

    /**
     * Create table
     *
     * @param string $sql
     * @param string $readme
     * @return bool
     * @throws SQLException
     */
    public function create($sql, $readme)
    {
        if ($this->exists()) {
            return true;
        }
        try {
            $this->pdo->query($sql);
        } catch (\Exception $exception) {
        }
        if ($this->exists()) {
            return true;
        }
        throw new SQLException('Automatic setup failed, please create table `' . $this->table . '` manually. Setup instructions: ' . $readme);
    }

    /**
     * Check if the table exists
     *
     * @return bool
     */
    public function exists()
    {
        try {
            $result = $this->pdo->query("SELECT 1 FROM " . $this->table . " LIMIT 1;");
        } catch (\Exception $e) {
            return false;
        }
        return $result !== false;
    }
}
{'fraction_non_alphanumeric': 0.13320400905269963, 'fraction_numerical': 0.0012932428063368898, 'mean_word_length': 1.7116564417177915, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '1755482', 'n_tokens_mistral': 956, 'n_tokens_neox': 946, 'n_words': 222}