<commit_before><?php

function tableexists ($name)
{
    $DBH = new DB();
    $query= "
        SELECT *
        FROM information_schema.tables
        WHERE table_schema = '".$DBH->getDBName()."'
        AND table_name = '$name'
            ";

    $DBH->query($query);
    $DBH->execute();
    if ($DBH->rowCount() == 1) {
        return true;
    } else {
        return false;
    }

}

function columnexists ($table, $column)
{
    $DBH = new DB();
    $query= "
        SELECT table_schema, table_name, column_name
        FROM information_schema.columns
        WHERE table_schema='".$DBH->getDBName()."'
            AND table_name='adminuser'
            AND column_name='deleted';
            ";

    $DBH->query($query);
    $DBH->execute();
    if ($DBH->rowCount() == 1) {
        return true;
    } else {
        return false;
    }
}

?><commit_msg>BUG: columnexists in db/functions always checked same column.<commit_after><?php

function tableexists ($name)
{
    $DBH = new DB();
    $query= "
        SELECT *
        FROM information_schema.tables
        WHERE table_schema = '".$DBH->getDBName()."'
        AND table_name = '$name'
            ";

    $DBH->query($query);
    $DBH->execute();
    if ($DBH->rowCount() == 1) {
        return true;
    } else {
        return false;
    }

}

function columnexists ($table, $column)
{
    $DBH = new DB();
    $query= "
        SELECT table_schema, table_name, column_name
        FROM information_schema.columns
        WHERE table_schema='".$DBH->getDBName()."'
            AND table_name=:tname
            AND column_name=:cname;
            ";

    $DBH->query($query);
    $DBH->bind(":tname", $table);
    $DBH->bind(":cname", $column);
    $DBH->execute();
    if ($DBH->rowCount() == 1) {
        return true;
    } else {
        return false;
    }
}

?>
{'fraction_non_alphanumeric': 0.15949918345127925, 'fraction_numerical': 0.002177463255307567, 'mean_word_length': 2.023026315789474, 'pattern_counts': {'":': 2, '<': 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': '6295473', 'n_tokens_mistral': 614, 'n_tokens_neox': 604, 'n_words': 125}