<commit_before><?php

namespace Doctrine\Tests\DBAL\Functional;

use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\Tests\DbalFunctionalTestCase;

final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase
{
    public function testFetchLikeExpressionResult() : void
    {
        $string           = '_25% off_ your next purchase \o/';
        $escapeChar       = '!';
        $databasePlatform = $this->_conn->getDatabasePlatform();
        $stmt             = $this->_conn->prepare(sprintf(
            "SELECT (CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)" .
                ($databasePlatform instanceof OraclePlatform ? ' FROM dual' : ''),
            $string,
            $databasePlatform->escapeStringForLike($string, $escapeChar),
            $escapeChar
        ));
        $stmt->execute();
        $this->assertTrue((bool) $stmt->fetchColumn());<commit_msg>Use dummy SELECT SQL<commit_after><?php

namespace Doctrine\Tests\DBAL\Functional;

use Doctrine\Tests\DbalFunctionalTestCase;
use function sprintf;
use function str_replace;

final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase
{
    public function testFetchLikeExpressionResult() : void
    {
        $string           = '_25% off_ your next purchase \o/';
        $escapeChar       = '!';
        $databasePlatform = $this->_conn->getDatabasePlatform();
        $stmt             = $this->_conn->prepare(str_replace(
            '1',
            sprintf(
                "(CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)",
                $string,
                $databasePlatform->escapeStringForLike($string, $escapeChar),
                $escapeChar
            ),
            $databasePlatform->getDummySelectSQL()
        ));
        $stmt->execute();
        $this->assertTrue((bool) $stmt->fetchColumn());
{'fraction_non_alphanumeric': 0.12132752992383025, 'fraction_numerical': 0.004896626768226333, 'mean_word_length': 2.443820224719101, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '4740657', 'n_tokens_mistral': 510, 'n_tokens_neox': 488, 'n_words': 109}