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
e6260dc6
Unverified
Commit
e6260dc6
authored
Jan 27, 2018
by
Michael Moravec
Committed by
Marco Pivetta
Jan 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract AbstractPlatform::TRIM_* constants into TrimMode class
parent
45b57743
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
103 additions
and
69 deletions
+103
-69
UPGRADE.md
UPGRADE.md
+4
-0
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+22
-14
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+5
-5
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+5
-5
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+3
-3
TrimMode.php
lib/Doctrine/DBAL/Platforms/TrimMode.php
+20
-0
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+37
-36
SQLAnywherePlatformTest.php
...Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+7
-6
No files found.
UPGRADE.md
View file @
e6260dc6
# Upgrade to 2.7
# Upgrade to 2.7
## Doctrine\DBAL\Platforms\AbstractPlatform::TRIM_* constants deprecated
``Doctrine\DBAL\Platforms\AbstractPlatform::TRIM_*``
constants were moved into
``Doctrine\DBAL\Platforms\TrimMode``
class without the
``TRIM_``
prefix.
## Doctrine\DBAL\Connection::TRANSACTION_* constants deprecated
## Doctrine\DBAL\Connection::TRANSACTION_* constants deprecated
``Doctrine\DBAL\Connection::TRANSACTION_*``
were moved into
``Doctrine\DBAL\TransactionIsolationLevel``
class without the
``TRANSACTION_``
prefix.
``Doctrine\DBAL\Connection::TRANSACTION_*``
were moved into
``Doctrine\DBAL\TransactionIsolationLevel``
class without the
``TRANSACTION_``
prefix.
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
e6260dc6
...
@@ -111,23 +111,31 @@ abstract class AbstractPlatform
...
@@ -111,23 +111,31 @@ abstract class AbstractPlatform
/**
/**
* @var int
* @var int
*
* @deprecated Use TrimMode::UNSPECIFIED.
*/
*/
const
TRIM_UNSPECIFIED
=
0
;
public
const
TRIM_UNSPECIFIED
=
TrimMode
::
UNSPECIFIED
;
/**
/**
* @var int
* @var int
*
* @deprecated Use TrimMode::LEADING.
*/
*/
const
TRIM_LEADING
=
1
;
public
const
TRIM_LEADING
=
TrimMode
::
LEADING
;
/**
/**
* @var int
* @var int
*
* @deprecated Use TrimMode::TRAILING.
*/
*/
const
TRIM_TRAILING
=
2
;
public
const
TRIM_TRAILING
=
TrimMode
::
TRAILING
;
/**
/**
* @var int
* @var int
*
* @deprecated Use TrimMode::BOTH.
*/
*/
const
TRIM_BOTH
=
3
;
public
const
TRIM_BOTH
=
TrimMode
::
BOTH
;
/**
/**
* @var array|null
* @var array|null
...
@@ -766,34 +774,34 @@ abstract class AbstractPlatform
...
@@ -766,34 +774,34 @@ abstract class AbstractPlatform
* Returns the SQL snippet to trim a string.
* Returns the SQL snippet to trim a string.
*
*
* @param string $str The expression to apply the trim to.
* @param string $str The expression to apply the trim to.
* @param int
$pos
The position of the trim (leading/trailing/both).
* @param int
$mode
The position of the trim (leading/trailing/both).
* @param string|bool
ean
$char The char to trim, has to be quoted already. Defaults to space.
* @param string|bool $char The char to trim, has to be quoted already. Defaults to space.
*
*
* @return string
* @return string
*/
*/
public
function
getTrimExpression
(
$str
,
$
pos
=
self
::
TRIM_
UNSPECIFIED
,
$char
=
false
)
public
function
getTrimExpression
(
$str
,
$
mode
=
TrimMode
::
UNSPECIFIED
,
$char
=
false
)
{
{
$expression
=
''
;
$expression
=
''
;
switch
(
$
pos
)
{
switch
(
$
mode
)
{
case
self
::
TRIM_
LEADING
:
case
TrimMode
::
LEADING
:
$expression
=
'LEADING '
;
$expression
=
'LEADING '
;
break
;
break
;
case
self
::
TRIM_
TRAILING
:
case
TrimMode
::
TRAILING
:
$expression
=
'TRAILING '
;
$expression
=
'TRAILING '
;
break
;
break
;
case
self
::
TRIM_
BOTH
:
case
TrimMode
::
BOTH
:
$expression
=
'BOTH '
;
$expression
=
'BOTH '
;
break
;
break
;
}
}
if
(
false
!==
$char
)
{
if
(
$char
!==
false
)
{
$expression
.=
$char
.
' '
;
$expression
.=
$char
.
' '
;
}
}
if
(
$
pos
||
false
!==
$char
)
{
if
(
$
mode
||
$char
!==
false
)
{
$expression
.=
'FROM '
;
$expression
.=
'FROM '
;
}
}
...
...
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
e6260dc6
...
@@ -1103,13 +1103,13 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -1103,13 +1103,13 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
getTrimExpression
(
$str
,
$pos
=
self
::
TRIM_
UNSPECIFIED
,
$char
=
false
)
public
function
getTrimExpression
(
$str
,
$pos
=
TrimMode
::
UNSPECIFIED
,
$char
=
false
)
{
{
if
(
!
$char
)
{
if
(
!
$char
)
{
switch
(
$pos
)
{
switch
(
$pos
)
{
case
self
::
TRIM_
LEADING
:
case
TrimMode
::
LEADING
:
return
$this
->
getLtrimExpression
(
$str
);
return
$this
->
getLtrimExpression
(
$str
);
case
self
::
TRIM_
TRAILING
:
case
TrimMode
::
TRAILING
:
return
$this
->
getRtrimExpression
(
$str
);
return
$this
->
getRtrimExpression
(
$str
);
default
:
default
:
return
'TRIM('
.
$str
.
')'
;
return
'TRIM('
.
$str
.
')'
;
...
@@ -1119,9 +1119,9 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -1119,9 +1119,9 @@ class SQLAnywherePlatform extends AbstractPlatform
$pattern
=
"'%[^' +
$char
+ ']%'"
;
$pattern
=
"'%[^' +
$char
+ ']%'"
;
switch
(
$pos
)
{
switch
(
$pos
)
{
case
self
::
TRIM_
LEADING
:
case
TrimMode
::
LEADING
:
return
'SUBSTR('
.
$str
.
', PATINDEX('
.
$pattern
.
', '
.
$str
.
'))'
;
return
'SUBSTR('
.
$str
.
', PATINDEX('
.
$pattern
.
', '
.
$str
.
'))'
;
case
self
::
TRIM_
TRAILING
:
case
TrimMode
::
TRAILING
:
return
'REVERSE(SUBSTR(REVERSE('
.
$str
.
'), PATINDEX('
.
$pattern
.
', REVERSE('
.
$str
.
'))))'
;
return
'REVERSE(SUBSTR(REVERSE('
.
$str
.
'), PATINDEX('
.
$pattern
.
', REVERSE('
.
$str
.
'))))'
;
default
:
default
:
return
return
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
e6260dc6
...
@@ -1003,15 +1003,15 @@ class SQLServerPlatform extends AbstractPlatform
...
@@ -1003,15 +1003,15 @@ class SQLServerPlatform extends AbstractPlatform
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
public
function
getTrimExpression
(
$str
,
$pos
=
self
::
TRIM_
UNSPECIFIED
,
$char
=
false
)
public
function
getTrimExpression
(
$str
,
$pos
=
TrimMode
::
UNSPECIFIED
,
$char
=
false
)
{
{
if
(
!
$char
)
{
if
(
!
$char
)
{
switch
(
$pos
)
{
switch
(
$pos
)
{
case
self
::
TRIM_
LEADING
:
case
TrimMode
::
LEADING
:
$trimFn
=
'LTRIM'
;
$trimFn
=
'LTRIM'
;
break
;
break
;
case
self
::
TRIM_
TRAILING
:
case
TrimMode
::
TRAILING
:
$trimFn
=
'RTRIM'
;
$trimFn
=
'RTRIM'
;
break
;
break
;
...
@@ -1033,11 +1033,11 @@ class SQLServerPlatform extends AbstractPlatform
...
@@ -1033,11 +1033,11 @@ class SQLServerPlatform extends AbstractPlatform
*/
*/
$pattern
=
"'%[^' +
$char
+ ']%'"
;
$pattern
=
"'%[^' +
$char
+ ']%'"
;
if
(
$pos
==
self
::
TRIM_
LEADING
)
{
if
(
$pos
==
=
TrimMode
::
LEADING
)
{
return
'stuff('
.
$str
.
', 1, patindex('
.
$pattern
.
', '
.
$str
.
') - 1, null)'
;
return
'stuff('
.
$str
.
', 1, patindex('
.
$pattern
.
', '
.
$str
.
') - 1, null)'
;
}
}
if
(
$pos
==
self
::
TRIM_
TRAILING
)
{
if
(
$pos
==
=
TrimMode
::
TRAILING
)
{
return
'reverse(stuff(reverse('
.
$str
.
'), 1, patindex('
.
$pattern
.
', reverse('
.
$str
.
')) - 1, null))'
;
return
'reverse(stuff(reverse('
.
$str
.
'), 1, patindex('
.
$pattern
.
', reverse('
.
$str
.
')) - 1, null))'
;
}
}
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
e6260dc6
...
@@ -80,16 +80,16 @@ class SqlitePlatform extends AbstractPlatform
...
@@ -80,16 +80,16 @@ class SqlitePlatform extends AbstractPlatform
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*/
*/
public
function
getTrimExpression
(
$str
,
$pos
=
self
::
TRIM_
UNSPECIFIED
,
$char
=
false
)
public
function
getTrimExpression
(
$str
,
$pos
=
TrimMode
::
UNSPECIFIED
,
$char
=
false
)
{
{
$trimChar
=
(
$char
!=
false
)
?
(
', '
.
$char
)
:
''
;
$trimChar
=
(
$char
!=
false
)
?
(
', '
.
$char
)
:
''
;
switch
(
$pos
)
{
switch
(
$pos
)
{
case
self
::
TRIM_
LEADING
:
case
TrimMode
::
LEADING
:
$trimFn
=
'LTRIM'
;
$trimFn
=
'LTRIM'
;
break
;
break
;
case
self
::
TRIM_
TRAILING
:
case
TrimMode
::
TRAILING
:
$trimFn
=
'RTRIM'
;
$trimFn
=
'RTRIM'
;
break
;
break
;
...
...
lib/Doctrine/DBAL/Platforms/TrimMode.php
0 → 100644
View file @
e6260dc6
<?php
declare
(
strict_types
=
1
);
namespace
Doctrine\DBAL\Platforms
;
final
class
TrimMode
{
public
const
UNSPECIFIED
=
0
;
public
const
LEADING
=
1
;
public
const
TRAILING
=
2
;
public
const
BOTH
=
3
;
private
function
__construct
()
{
}
}
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
e6260dc6
...
@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Functional;
...
@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Functional;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\TrimMode
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\DBAL\Types\Type
;
use
PDO
;
use
PDO
;
...
@@ -459,42 +460,42 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -459,42 +460,42 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
public
function
getTrimExpressionData
()
public
function
getTrimExpressionData
()
{
{
return
array
(
return
array
(
array
(
'test_string'
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
false
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
UNSPECIFIED
,
false
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_LEADING
,
false
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
LEADING
,
false
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_TRAILING
,
false
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
TRAILING
,
false
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_BOTH
,
false
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
BOTH
,
false
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
"'f'"
,
'oo'
)
,
[
'test_string'
,
TrimMode
::
UNSPECIFIED
,
"'f'"
,
'oo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
"'o'"
,
'f'
)
,
[
'test_string'
,
TrimMode
::
UNSPECIFIED
,
"'o'"
,
'f'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
"'.'"
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
UNSPECIFIED
,
"'.'"
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_LEADING
,
"'f'"
,
'oo'
)
,
[
'test_string'
,
TrimMode
::
LEADING
,
"'f'"
,
'oo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_LEADING
,
"'o'"
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
LEADING
,
"'o'"
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_LEADING
,
"'.'"
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
LEADING
,
"'.'"
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_TRAILING
,
"'f'"
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
TRAILING
,
"'f'"
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_TRAILING
,
"'o'"
,
'f'
)
,
[
'test_string'
,
TrimMode
::
TRAILING
,
"'o'"
,
'f'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_TRAILING
,
"'.'"
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
TRAILING
,
"'.'"
,
'foo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_BOTH
,
"'f'"
,
'oo'
)
,
[
'test_string'
,
TrimMode
::
BOTH
,
"'f'"
,
'oo'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_BOTH
,
"'o'"
,
'f'
)
,
[
'test_string'
,
TrimMode
::
BOTH
,
"'o'"
,
'f'
]
,
array
(
'test_string'
,
AbstractPlatform
::
TRIM_BOTH
,
"'.'"
,
'foo'
)
,
[
'test_string'
,
TrimMode
::
BOTH
,
"'.'"
,
'foo'
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
false
,
'foo'
)
,
[
"' foo '"
,
TrimMode
::
UNSPECIFIED
,
false
,
'foo'
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_LEADING
,
false
,
'foo '
)
,
[
"' foo '"
,
TrimMode
::
LEADING
,
false
,
'foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_TRAILING
,
false
,
' foo'
)
,
[
"' foo '"
,
TrimMode
::
TRAILING
,
false
,
' foo'
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_BOTH
,
false
,
'foo'
)
,
[
"' foo '"
,
TrimMode
::
BOTH
,
false
,
'foo'
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
"'f'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
UNSPECIFIED
,
"'f'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
"'o'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
UNSPECIFIED
,
"'o'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
"'.'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
UNSPECIFIED
,
"'.'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_UNSPECIFIED
,
"' '"
,
'foo'
)
,
[
"' foo '"
,
TrimMode
::
UNSPECIFIED
,
"' '"
,
'foo'
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_LEADING
,
"'f'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
LEADING
,
"'f'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_LEADING
,
"'o'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
LEADING
,
"'o'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_LEADING
,
"'.'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
LEADING
,
"'.'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_LEADING
,
"' '"
,
'foo '
)
,
[
"' foo '"
,
TrimMode
::
LEADING
,
"' '"
,
'foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_TRAILING
,
"'f'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
TRAILING
,
"'f'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_TRAILING
,
"'o'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
TRAILING
,
"'o'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_TRAILING
,
"'.'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
TRAILING
,
"'.'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_TRAILING
,
"' '"
,
' foo'
)
,
[
"' foo '"
,
TrimMode
::
TRAILING
,
"' '"
,
' foo'
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_BOTH
,
"'f'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
BOTH
,
"'f'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_BOTH
,
"'o'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
BOTH
,
"'o'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_BOTH
,
"'.'"
,
' foo '
)
,
[
"' foo '"
,
TrimMode
::
BOTH
,
"'.'"
,
' foo '
]
,
array
(
"' foo '"
,
AbstractPlatform
::
TRIM_BOTH
,
"' '"
,
'foo'
)
,
[
"' foo '"
,
TrimMode
::
BOTH
,
"' '"
,
'foo'
]
,
);
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View file @
e6260dc6
...
@@ -6,6 +6,7 @@ use Doctrine\DBAL\Connection;
...
@@ -6,6 +6,7 @@ use Doctrine\DBAL\Connection;
use
Doctrine\DBAL\LockMode
;
use
Doctrine\DBAL\LockMode
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\AbstractPlatform
;
use
Doctrine\DBAL\Platforms\SQLAnywherePlatform
;
use
Doctrine\DBAL\Platforms\SQLAnywherePlatform
;
use
Doctrine\DBAL\Platforms\TrimMode
;
use
Doctrine\DBAL\Schema\Column
;
use
Doctrine\DBAL\Schema\Column
;
use
Doctrine\DBAL\Schema\ColumnDiff
;
use
Doctrine\DBAL\Schema\ColumnDiff
;
use
Doctrine\DBAL\Schema\Comparator
;
use
Doctrine\DBAL\Schema\Comparator
;
...
@@ -550,11 +551,11 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
...
@@ -550,11 +551,11 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
self
::
assertEquals
(
'GLOBAL TEMPORARY'
,
$this
->
_platform
->
getTemporaryTableSQL
());
self
::
assertEquals
(
'GLOBAL TEMPORARY'
,
$this
->
_platform
->
getTemporaryTableSQL
());
self
::
assertEquals
(
self
::
assertEquals
(
'LTRIM(column)'
,
'LTRIM(column)'
,
$this
->
_platform
->
getTrimExpression
(
'column'
,
AbstractPlatform
::
TRIM_
LEADING
)
$this
->
_platform
->
getTrimExpression
(
'column'
,
TrimMode
::
LEADING
)
);
);
self
::
assertEquals
(
self
::
assertEquals
(
'RTRIM(column)'
,
'RTRIM(column)'
,
$this
->
_platform
->
getTrimExpression
(
'column'
,
AbstractPlatform
::
TRIM_
TRAILING
)
$this
->
_platform
->
getTrimExpression
(
'column'
,
TrimMode
::
TRAILING
)
);
);
self
::
assertEquals
(
self
::
assertEquals
(
'TRIM(column)'
,
'TRIM(column)'
,
...
@@ -562,15 +563,15 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
...
@@ -562,15 +563,15 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
);
);
self
::
assertEquals
(
self
::
assertEquals
(
'TRIM(column)'
,
'TRIM(column)'
,
$this
->
_platform
->
getTrimExpression
(
'column'
,
AbstractPlatform
::
TRIM_
UNSPECIFIED
)
$this
->
_platform
->
getTrimExpression
(
'column'
,
TrimMode
::
UNSPECIFIED
)
);
);
self
::
assertEquals
(
self
::
assertEquals
(
"SUBSTR(column, PATINDEX('%[^' + c + ']%', column))"
,
"SUBSTR(column, PATINDEX('%[^' + c + ']%', column))"
,
$this
->
_platform
->
getTrimExpression
(
'column'
,
AbstractPlatform
::
TRIM_
LEADING
,
'c'
)
$this
->
_platform
->
getTrimExpression
(
'column'
,
TrimMode
::
LEADING
,
'c'
)
);
);
self
::
assertEquals
(
self
::
assertEquals
(
"REVERSE(SUBSTR(REVERSE(column), PATINDEX('%[^' + c + ']%', REVERSE(column))))"
,
"REVERSE(SUBSTR(REVERSE(column), PATINDEX('%[^' + c + ']%', REVERSE(column))))"
,
$this
->
_platform
->
getTrimExpression
(
'column'
,
AbstractPlatform
::
TRIM_
TRAILING
,
'c'
)
$this
->
_platform
->
getTrimExpression
(
'column'
,
TrimMode
::
TRAILING
,
'c'
)
);
);
self
::
assertEquals
(
self
::
assertEquals
(
"REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', "
.
"REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', "
.
...
@@ -580,7 +581,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
...
@@ -580,7 +581,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
self
::
assertEquals
(
self
::
assertEquals
(
"REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', "
.
"REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', "
.
"REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))))))"
,
"REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))))))"
,
$this
->
_platform
->
getTrimExpression
(
'column'
,
AbstractPlatform
::
TRIM_
UNSPECIFIED
,
'c'
)
$this
->
_platform
->
getTrimExpression
(
'column'
,
TrimMode
::
UNSPECIFIED
,
'c'
)
);
);
}
}
...
...
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