Use dummy SELECT SQL

This should take care of most idiosyncracies.
parent bcc9403d
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
namespace Doctrine\Tests\DBAL\Functional; namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\Tests\DbalFunctionalTestCase; use Doctrine\Tests\DbalFunctionalTestCase;
use function sprintf;
use function str_replace;
final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase
{ {
...@@ -12,12 +13,15 @@ final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase ...@@ -12,12 +13,15 @@ final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase
$string = '_25% off_ your next purchase \o/'; $string = '_25% off_ your next purchase \o/';
$escapeChar = '!'; $escapeChar = '!';
$databasePlatform = $this->_conn->getDatabasePlatform(); $databasePlatform = $this->_conn->getDatabasePlatform();
$stmt = $this->_conn->prepare(sprintf( $stmt = $this->_conn->prepare(str_replace(
"SELECT (CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)" . '1',
($databasePlatform instanceof OraclePlatform ? ' FROM dual' : ''), sprintf(
$string, "(CASE WHEN '%s' LIKE '%s' ESCAPE '%s' THEN 1 ELSE 0 END)",
$databasePlatform->escapeStringForLike($string, $escapeChar), $string,
$escapeChar $databasePlatform->escapeStringForLike($string, $escapeChar),
$escapeChar
),
$databasePlatform->getDummySelectSQL()
)); ));
$stmt->execute(); $stmt->execute();
$this->assertTrue((bool) $stmt->fetchColumn()); $this->assertTrue((bool) $stmt->fetchColumn());
......
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