Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
35982f2c
Unverified
Commit
35982f2c
authored
Feb 09, 2018
by
Grégoire Paris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use dummy SELECT SQL
This should take care of most idiosyncracies.
parent
bcc9403d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
LikeWildcardsEscapingTest.php
...trine/Tests/DBAL/Functional/LikeWildcardsEscapingTest.php
+11
-7
No files found.
tests/Doctrine/Tests/DBAL/Functional/LikeWildcardsEscapingTest.php
View file @
35982f2c
...
...
@@ -2,8 +2,9 @@
namespace
Doctrine\Tests\DBAL\Functional
;
use
Doctrine\DBAL\Platforms\OraclePlatform
;
use
Doctrine\Tests\DbalFunctionalTestCase
;
use
function
sprintf
;
use
function
str_replace
;
final
class
LikeWildcardsEscapingTest
extends
DbalFunctionalTestCase
{
...
...
@@ -12,12 +13,15 @@ final class LikeWildcardsEscapingTest extends DbalFunctionalTestCase
$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
=
$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
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment