Unverified Commit de2bfb12 authored by Grégoire Paris's avatar Grégoire Paris Committed by Grégoire Paris
parent 20d07bff
...@@ -2,18 +2,21 @@ ...@@ -2,18 +2,21 @@
namespace Doctrine\Tests\DBAL\Functional; namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\Tests\DbalFunctionalTestCase; use Doctrine\Tests\DbalFunctionalTestCase;
final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase
{ {
public function testFetchLikeExpressionResult() : void public function testFetchLikeExpressionResult() : void
{ {
$string = '_25% off_ your next purchase \o/'; $string = '_25% off_ your next purchase \o/';
$escapeChar = '!'; $escapeChar = '!';
$stmt = $this->_conn->prepare(sprintf( $databasePlatform = $this->_conn->getDatabasePlatform();
"SELECT '%s' LIKE '%s' ESCAPE '%s' as it_matches", $stmt = $this->_conn->prepare(sprintf(
"SELECT (CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)" .
($databasePlatform instanceof OraclePlatform ? ' FROM dual' : ''),
$string, $string,
$this->_conn->getDatabasePlatform()->escapeStringForLike($string, $escapeChar), $databasePlatform->escapeStringForLike($string, $escapeChar),
$escapeChar $escapeChar
)); ));
$stmt->execute(); $stmt->execute();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment