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
f397fe04
Unverified
Commit
f397fe04
authored
Feb 17, 2018
by
Grégoire Paris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use strings to represent wildcard characters
A string is made of characters, an array might contain anything.
parent
a9e5e5a9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
12 deletions
+5
-12
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+3
-7
SQLServer2008Platform.php
lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
+2
-5
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
f397fe04
...
@@ -43,7 +43,6 @@ use Doctrine\DBAL\TransactionIsolationLevel;
...
@@ -43,7 +43,6 @@ use Doctrine\DBAL\TransactionIsolationLevel;
use
Doctrine\DBAL\Types
;
use
Doctrine\DBAL\Types
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
;
use
function
addcslashes
;
use
function
addcslashes
;
use
function
implode
;
use
function
preg_quote
;
use
function
preg_quote
;
use
function
preg_replace
;
use
function
preg_replace
;
use
function
sprintf
;
use
function
sprintf
;
...
@@ -3596,17 +3595,14 @@ abstract class AbstractPlatform
...
@@ -3596,17 +3595,14 @@ abstract class AbstractPlatform
final
public
function
escapeStringForLike
(
string
$inputString
,
string
$escapeChar
)
:
string
final
public
function
escapeStringForLike
(
string
$inputString
,
string
$escapeChar
)
:
string
{
{
return
preg_replace
(
return
preg_replace
(
'~(['
.
preg_quote
(
implode
(
''
,
$this
->
getLikeWildcardCharacters
()
)
.
$escapeChar
,
'~'
)
.
'])~u'
,
'~(['
.
preg_quote
(
$this
->
getLikeWildcardCharacters
(
)
.
$escapeChar
,
'~'
)
.
'])~u'
,
addcslashes
(
$escapeChar
,
'\\'
)
.
'$1'
,
addcslashes
(
$escapeChar
,
'\\'
)
.
'$1'
,
$inputString
$inputString
);
);
}
}
/**
protected
function
getLikeWildcardCharacters
()
:
string
* @return string[]
*/
protected
function
getLikeWildcardCharacters
()
:
array
{
{
return
[
'%'
,
'_'
]
;
return
'%_'
;
}
}
}
}
lib/Doctrine/DBAL/Platforms/SQLServer2008Platform.php
View file @
f397fe04
...
@@ -117,11 +117,8 @@ class SQLServer2008Platform extends SQLServer2005Platform
...
@@ -117,11 +117,8 @@ class SQLServer2008Platform extends SQLServer2005Platform
return
Keywords\SQLServer2008Keywords
::
class
;
return
Keywords\SQLServer2008Keywords
::
class
;
}
}
/**
protected
function
getLikeWildcardCharacters
()
:
string
* {@inheritDoc}
*/
protected
function
getLikeWildcardCharacters
()
:
array
{
{
return
array_merge
(
parent
::
getLikeWildcardCharacters
(),
[
'['
,
']'
,
'^'
])
;
return
parent
::
getLikeWildcardCharacters
()
.
'[]^'
;
}
}
}
}
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