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
8d4d457c
Unverified
Commit
8d4d457c
authored
Mar 21, 2019
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked AbstractPlatform::get*Expression() methods
parent
91ede91a
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
554 additions
and
364 deletions
+554
-364
UPGRADE.md
UPGRADE.md
+27
-0
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+158
-246
DB2Platform.php
lib/Doctrine/DBAL/Platforms/DB2Platform.php
+8
-8
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+5
-6
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+7
-7
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+6
-6
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+7
-8
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+8
-11
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+18
-27
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+304
-39
DB2PlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
+4
-4
SqlitePlatformTest.php
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
+2
-2
No files found.
UPGRADE.md
View file @
8d4d457c
# Upgrade to 3.0
## BC BREAK `AbstractPlatform::get*Expression()` methods no loner accept integer values as arguments
The following methods' arguments do not longer accept integer value:
-
the
`$expression`
argument in
`::getCountExpression()`
,
-
the
`$decimals`
argument in
`::getRoundExpression()`
,
-
the
`$seconds`
argument in
`::getDateAddSecondsExpression()`
,
-
the
`$seconds`
argument in
`::getDateSubSecondsExpression()`
,
-
the
`$minutes`
argument in
`::getDateAddMinutesExpression()`
,
-
the
`$minutes`
argument in
`::getDateSubMinutesExpression()`
,
-
the
`$hours`
argument in
`::getDateAddHourExpression()`
,
-
the
`$hours`
argument in
`::getDateAddHourExpression()`
,
-
the
`$days`
argument in
`::getDateAddDaysExpression()`
,
-
the
`$days`
argument in
`::getDateSubDaysExpression()`
,
-
the
`$weeks`
argument in
`::getDateAddWeeksExpression()`
,
-
the
`$weeks`
argument in
`::getDateSubWeeksExpression()`
,
-
the
`$months`
argument in
`::getDateAddMonthExpression()`
,
-
the
`$months`
argument in
`::getDateSubMonthExpression()`
,
-
the
`$quarters`
argument in
`::getDateAddQuartersExpression()`
,
-
the
`$quarters`
argument in
`::getDateSubQuartersExpression()`
,
-
the
`$years`
argument in
`::getDateAddYearsExpression()`
,
-
the
`$years`
argument in
`::getDateSubYearsExpression()`
.
Please use the strings representing numeric SQL literals instead (e.g.
`'1'`
instead of
`1`
).
The signature of
`AbstractPlatform::getConcatExpression()`
changed to
`::getConcatExpression(string ...$string)`
.
## BC BREAK The type of `$start` in `AbstractPlatform::getLocateExpression()` changed from `string|false` to `?string`
The default value of
`$start`
is now
`null`
, not
`false`
.
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
8d4d457c
This diff is collapsed.
Click to expand it.
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
8d4d457c
...
...
@@ -186,7 +186,7 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public
function
getBitAndComparisonExpression
(
$value1
,
$value2
)
public
function
getBitAndComparisonExpression
(
string
$value1
,
string
$value2
)
:
string
{
return
'BITAND('
.
$value1
.
', '
.
$value2
.
')'
;
}
...
...
@@ -194,7 +194,7 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public
function
getBitOrComparisonExpression
(
$value1
,
$value2
)
public
function
getBitOrComparisonExpression
(
string
$value1
,
string
$value2
)
:
string
{
return
'BITOR('
.
$value1
.
', '
.
$value2
.
')'
;
}
...
...
@@ -202,17 +202,17 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritdoc}
*/
protected
function
getDateArithmeticIntervalExpression
(
$date
,
$operator
,
$interval
,
$unit
)
protected
function
getDateArithmeticIntervalExpression
(
string
$date
,
string
$operator
,
string
$interval
,
string
$unit
)
:
string
{
switch
(
$unit
)
{
case
DateIntervalUnit
::
WEEK
:
$interval
*=
7
;
$unit
=
DateIntervalUnit
::
DAY
;
$interval
=
$this
->
multiplyInterval
(
$interval
,
7
)
;
$unit
=
DateIntervalUnit
::
DAY
;
break
;
case
DateIntervalUnit
::
QUARTER
:
$interval
*=
3
;
$unit
=
DateIntervalUnit
::
MONTH
;
$interval
=
$this
->
multiplyInterval
(
$interval
,
3
)
;
$unit
=
DateIntervalUnit
::
MONTH
;
break
;
}
...
...
@@ -222,7 +222,7 @@ class DB2Platform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public
function
getDateDiffExpression
(
$date1
,
$date2
)
public
function
getDateDiffExpression
(
string
$date1
,
string
$date2
)
:
string
{
return
'DAYS('
.
$date1
.
') - DAYS('
.
$date2
.
')'
;
}
...
...
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
8d4d457c
...
...
@@ -16,7 +16,6 @@ use function array_merge;
use
function
array_unique
;
use
function
array_values
;
use
function
count
;
use
function
func_get_args
;
use
function
implode
;
use
function
in_array
;
use
function
is_numeric
;
...
...
@@ -73,7 +72,7 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getRegexpExpression
()
public
function
getRegexpExpression
()
:
string
{
return
'RLIKE'
;
}
...
...
@@ -93,15 +92,15 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getConcatExpression
(
)
public
function
getConcatExpression
(
string
...
$string
)
:
string
{
return
sprintf
(
'CONCAT(%s)'
,
implode
(
', '
,
func_get_args
()
));
return
sprintf
(
'CONCAT(%s)'
,
implode
(
', '
,
$string
));
}
/**
* {@inheritdoc}
*/
protected
function
getDateArithmeticIntervalExpression
(
$date
,
$operator
,
$interval
,
$unit
)
protected
function
getDateArithmeticIntervalExpression
(
string
$date
,
string
$operator
,
string
$interval
,
string
$unit
)
:
string
{
$function
=
$operator
===
'+'
?
'DATE_ADD'
:
'DATE_SUB'
;
...
...
@@ -111,7 +110,7 @@ class MySqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getDateDiffExpression
(
$date1
,
$date2
)
public
function
getDateDiffExpression
(
string
$date1
,
string
$date2
)
:
string
{
return
'DATEDIFF('
.
$date1
.
', '
.
$date2
.
')'
;
}
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
8d4d457c
...
...
@@ -59,7 +59,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getNowExpression
(
$type
=
'timestamp'
)
public
function
getNowExpression
(
$type
=
'timestamp'
)
:
string
{
switch
(
$type
)
{
case
'date'
:
...
...
@@ -85,7 +85,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
protected
function
getDateArithmeticIntervalExpression
(
$date
,
$operator
,
$interval
,
$unit
)
protected
function
getDateArithmeticIntervalExpression
(
string
$date
,
string
$operator
,
string
$interval
,
string
$unit
)
:
string
{
switch
(
$unit
)
{
case
DateIntervalUnit
::
MONTH
:
...
...
@@ -93,11 +93,11 @@ class OraclePlatform extends AbstractPlatform
case
DateIntervalUnit
::
YEAR
:
switch
(
$unit
)
{
case
DateIntervalUnit
::
QUARTER
:
$interval
*=
3
;
$interval
=
$this
->
multiplyInterval
(
$interval
,
3
)
;
break
;
case
DateIntervalUnit
::
YEAR
:
$interval
*=
12
;
$interval
=
$this
->
multiplyInterval
(
$interval
,
12
)
;
break
;
}
...
...
@@ -131,7 +131,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getDateDiffExpression
(
$date1
,
$date2
)
public
function
getDateDiffExpression
(
string
$date1
,
string
$date2
)
:
string
{
return
sprintf
(
'TRUNC(%s) - TRUNC(%s)'
,
$date1
,
$date2
);
}
...
...
@@ -139,7 +139,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getBitAndComparisonExpression
(
$value1
,
$value2
)
public
function
getBitAndComparisonExpression
(
string
$value1
,
string
$value2
)
:
string
{
return
'BITAND('
.
$value1
.
', '
.
$value2
.
')'
;
}
...
...
@@ -147,7 +147,7 @@ class OraclePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getBitOrComparisonExpression
(
$value1
,
$value2
)
public
function
getBitOrComparisonExpression
(
string
$value1
,
string
$value2
)
:
string
{
return
'('
.
$value1
.
'-'
.
$this
->
getBitAndComparisonExpression
(
$value1
,
$value2
)
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
8d4d457c
...
...
@@ -78,7 +78,7 @@ class PostgreSqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getNowExpression
()
public
function
getNowExpression
()
:
string
{
return
'LOCALTIMESTAMP(0)'
;
}
...
...
@@ -86,7 +86,7 @@ class PostgreSqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getRegexpExpression
()
public
function
getRegexpExpression
()
:
string
{
return
'SIMILAR TO'
;
}
...
...
@@ -108,11 +108,11 @@ class PostgreSqlPlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
protected
function
getDateArithmeticIntervalExpression
(
$date
,
$operator
,
$interval
,
$unit
)
protected
function
getDateArithmeticIntervalExpression
(
string
$date
,
string
$operator
,
string
$interval
,
string
$unit
)
:
string
{
if
(
$unit
===
DateIntervalUnit
::
QUARTER
)
{
$interval
*=
3
;
$unit
=
DateIntervalUnit
::
MONTH
;
$interval
=
$this
->
multiplyInterval
(
$interval
,
3
)
;
$unit
=
DateIntervalUnit
::
MONTH
;
}
return
'('
.
$date
.
' '
.
$operator
.
' ('
.
$interval
.
" || ' "
.
$unit
.
"')::interval)"
;
...
...
@@ -121,7 +121,7 @@ class PostgreSqlPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getDateDiffExpression
(
$date1
,
$date2
)
public
function
getDateDiffExpression
(
string
$date1
,
string
$date2
)
:
string
{
return
'(DATE('
.
$date1
.
')-DATE('
.
$date2
.
'))'
;
}
...
...
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
8d4d457c
...
...
@@ -21,7 +21,6 @@ use function array_unique;
use
function
array_values
;
use
function
count
;
use
function
explode
;
use
function
func_get_args
;
use
function
get_class
;
use
function
implode
;
use
function
in_array
;
...
...
@@ -373,9 +372,9 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public
function
getConcatExpression
(
)
public
function
getConcatExpression
(
string
...
$string
)
:
string
{
return
'STRING('
.
implode
(
', '
,
(
array
)
func_get_args
()
)
.
')'
;
return
'STRING('
.
implode
(
', '
,
$string
)
.
')'
;
}
/**
...
...
@@ -470,7 +469,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
protected
function
getDateArithmeticIntervalExpression
(
$date
,
$operator
,
$interval
,
$unit
)
protected
function
getDateArithmeticIntervalExpression
(
string
$date
,
string
$operator
,
string
$interval
,
string
$unit
)
:
string
{
$factorClause
=
''
;
...
...
@@ -484,7 +483,7 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public
function
getDateDiffExpression
(
$date1
,
$date2
)
public
function
getDateDiffExpression
(
string
$date1
,
string
$date2
)
:
string
{
return
'DATEDIFF(day, '
.
$date2
.
', '
.
$date1
.
')'
;
}
...
...
@@ -986,15 +985,15 @@ SQL
/**
* {@inheritdoc}
*/
public
function
getMd5Expression
(
$column
)
public
function
getMd5Expression
(
string
$string
)
:
string
{
return
'HASH('
.
$
column
.
", 'MD5')"
;
return
'HASH('
.
$
string
.
", 'MD5')"
;
}
/**
* {@inheritdoc}
*/
public
function
getRegexpExpression
()
public
function
getRegexpExpression
()
:
string
{
return
'REGEXP'
;
}
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
8d4d457c
...
...
@@ -18,7 +18,6 @@ use function count;
use
function
crc32
;
use
function
dechex
;
use
function
explode
;
use
function
func_get_args
;
use
function
implode
;
use
function
in_array
;
use
function
is_array
;
...
...
@@ -74,7 +73,7 @@ class SQLServerPlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
protected
function
getDateArithmeticIntervalExpression
(
$date
,
$operator
,
$interval
,
$unit
)
protected
function
getDateArithmeticIntervalExpression
(
string
$date
,
string
$operator
,
string
$interval
,
string
$unit
)
:
string
{
$factorClause
=
''
;
...
...
@@ -88,7 +87,7 @@ class SQLServerPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getDateDiffExpression
(
$date1
,
$date2
)
public
function
getDateDiffExpression
(
string
$date1
,
string
$date2
)
:
string
{
return
'DATEDIFF(day, '
.
$date2
.
','
.
$date1
.
')'
;
}
...
...
@@ -1028,9 +1027,9 @@ SQL
/**
* {@inheritDoc}
*/
public
function
getModExpression
(
$expression1
,
$expression2
)
public
function
getModExpression
(
string
$dividend
,
string
$divisor
)
:
string
{
return
$
expression1
.
' % '
.
$expression2
;
return
$
dividend
.
' % '
.
$divisor
;
}
/**
...
...
@@ -1082,11 +1081,9 @@ SQL
/**
* {@inheritDoc}
*/
public
function
getConcatExpression
(
)
public
function
getConcatExpression
(
string
...
$string
)
:
string
{
$args
=
func_get_args
();
return
'('
.
implode
(
' + '
,
$args
)
.
')'
;
return
'('
.
implode
(
' + '
,
$string
)
.
')'
;
}
/**
...
...
@@ -1120,9 +1117,9 @@ SQL
/**
* {@inheritDoc}
*/
public
function
getLengthExpression
(
$column
)
public
function
getLengthExpression
(
string
$string
)
:
string
{
return
'LEN('
.
$
column
.
')'
;
return
'LEN('
.
$
string
.
')'
;
}
/**
...
...
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
8d4d457c
...
...
@@ -17,7 +17,6 @@ use function array_merge;
use
function
array_unique
;
use
function
array_values
;
use
function
implode
;
use
function
is_numeric
;
use
function
sprintf
;
use
function
sqrt
;
use
function
str_replace
;
...
...
@@ -37,7 +36,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getRegexpExpression
()
public
function
getRegexpExpression
()
:
string
{
return
'REGEXP'
;
}
...
...
@@ -45,7 +44,7 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public
function
getNowExpression
(
$type
=
'timestamp'
)
public
function
getNowExpression
(
$type
=
'timestamp'
)
:
string
{
switch
(
$type
)
{
case
'time'
:
...
...
@@ -122,39 +121,31 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
protected
function
getDateArithmeticIntervalExpression
(
$date
,
$operator
,
$interval
,
$unit
)
protected
function
getDateArithmeticIntervalExpression
(
string
$date
,
string
$operator
,
string
$interval
,
string
$unit
)
:
string
{
switch
(
$unit
)
{
case
DateIntervalUnit
::
SECOND
:
case
DateIntervalUnit
::
MINUTE
:
case
DateIntervalUnit
::
HOUR
:
return
'DATETIME('
.
$date
.
",'"
.
$operator
.
$interval
.
' '
.
$unit
.
"')"
;
default
:
switch
(
$unit
)
{
case
DateIntervalUnit
::
WEEK
:
$interval
*=
7
;
$unit
=
DateIntervalUnit
::
DAY
;
break
;
case
DateIntervalUnit
::
QUARTER
:
$interval
*=
3
;
$unit
=
DateIntervalUnit
::
MONTH
;
break
;
}
if
(
!
is_numeric
(
$interval
))
{
$interval
=
"' || "
.
$interval
.
" || '"
;
}
case
DateIntervalUnit
::
WEEK
:
$interval
=
$this
->
multiplyInterval
(
$interval
,
7
);
$unit
=
DateIntervalUnit
::
DAY
;
break
;
return
'DATE('
.
$date
.
",'"
.
$operator
.
$interval
.
' '
.
$unit
.
"')"
;
case
DateIntervalUnit
::
QUARTER
:
$interval
=
$this
->
multiplyInterval
(
$interval
,
3
);
$unit
=
DateIntervalUnit
::
MONTH
;
break
;
}
return
'DATETIME('
.
$date
.
','
.
$this
->
getConcatExpression
(
$this
->
quoteStringLiteral
(
$operator
),
$interval
,
$this
->
quoteStringLiteral
(
' '
.
$unit
)
)
.
')'
;
}
/**
* {@inheritDoc}
*/
public
function
getDateDiffExpression
(
$date1
,
$date2
)
public
function
getDateDiffExpression
(
string
$date1
,
string
$date2
)
:
string
{
return
sprintf
(
"JULIANDAY(%s, 'start of day') - JULIANDAY(%s, 'start of day')"
,
$date1
,
$date2
);
}
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
8d4d457c
This diff is collapsed.
Click to expand it.
tests/Doctrine/Tests/DBAL/Platforms/DB2PlatformTest.php
View file @
8d4d457c
...
...
@@ -348,18 +348,18 @@ class DB2PlatformTest extends AbstractPlatformTestCase
self
::
assertEquals
(
"'1987/05/02' + 12 HOUR"
,
$this
->
platform
->
getDateAddHourExpression
(
"'1987/05/02'"
,
12
));
self
::
assertEquals
(
"'1987/05/02' + 2 MINUTE"
,
$this
->
platform
->
getDateAddMinutesExpression
(
"'1987/05/02'"
,
2
));
self
::
assertEquals
(
"'1987/05/02' + 102 MONTH"
,
$this
->
platform
->
getDateAddMonthExpression
(
"'1987/05/02'"
,
102
));
self
::
assertEquals
(
"'1987/05/02' +
15
MONTH"
,
$this
->
platform
->
getDateAddQuartersExpression
(
"'1987/05/02'"
,
5
));
self
::
assertEquals
(
"'1987/05/02' +
(5 * 3)
MONTH"
,
$this
->
platform
->
getDateAddQuartersExpression
(
"'1987/05/02'"
,
5
));
self
::
assertEquals
(
"'1987/05/02' + 1 SECOND"
,
$this
->
platform
->
getDateAddSecondsExpression
(
"'1987/05/02'"
,
1
));
self
::
assertEquals
(
"'1987/05/02' +
21
DAY"
,
$this
->
platform
->
getDateAddWeeksExpression
(
"'1987/05/02'"
,
3
));
self
::
assertEquals
(
"'1987/05/02' +
(3 * 7)
DAY"
,
$this
->
platform
->
getDateAddWeeksExpression
(
"'1987/05/02'"
,
3
));
self
::
assertEquals
(
"'1987/05/02' + 10 YEAR"
,
$this
->
platform
->
getDateAddYearsExpression
(
"'1987/05/02'"
,
10
));
self
::
assertEquals
(
"DAYS('1987/05/02') - DAYS('1987/04/01')"
,
$this
->
platform
->
getDateDiffExpression
(
"'1987/05/02'"
,
"'1987/04/01'"
));
self
::
assertEquals
(
"'1987/05/02' - 4 DAY"
,
$this
->
platform
->
getDateSubDaysExpression
(
"'1987/05/02'"
,
4
));
self
::
assertEquals
(
"'1987/05/02' - 12 HOUR"
,
$this
->
platform
->
getDateSubHourExpression
(
"'1987/05/02'"
,
12
));
self
::
assertEquals
(
"'1987/05/02' - 2 MINUTE"
,
$this
->
platform
->
getDateSubMinutesExpression
(
"'1987/05/02'"
,
2
));
self
::
assertEquals
(
"'1987/05/02' - 102 MONTH"
,
$this
->
platform
->
getDateSubMonthExpression
(
"'1987/05/02'"
,
102
));
self
::
assertEquals
(
"'1987/05/02' -
15
MONTH"
,
$this
->
platform
->
getDateSubQuartersExpression
(
"'1987/05/02'"
,
5
));
self
::
assertEquals
(
"'1987/05/02' -
(5 * 3)
MONTH"
,
$this
->
platform
->
getDateSubQuartersExpression
(
"'1987/05/02'"
,
5
));
self
::
assertEquals
(
"'1987/05/02' - 1 SECOND"
,
$this
->
platform
->
getDateSubSecondsExpression
(
"'1987/05/02'"
,
1
));
self
::
assertEquals
(
"'1987/05/02' -
21
DAY"
,
$this
->
platform
->
getDateSubWeeksExpression
(
"'1987/05/02'"
,
3
));
self
::
assertEquals
(
"'1987/05/02' -
(3 * 7)
DAY"
,
$this
->
platform
->
getDateSubWeeksExpression
(
"'1987/05/02'"
,
3
));
self
::
assertEquals
(
"'1987/05/02' - 10 YEAR"
,
$this
->
platform
->
getDateSubYearsExpression
(
"'1987/05/02'"
,
10
));
self
::
assertEquals
(
' WITH RR USE AND KEEP UPDATE LOCKS'
,
$this
->
platform
->
getForUpdateSQL
());
self
::
assertEquals
(
'LOCATE(substring_column, string_column)'
,
$this
->
platform
->
getLocateExpression
(
'string_column'
,
'substring_column'
));
...
...
tests/Doctrine/Tests/DBAL/Platforms/SqlitePlatformTest.php
View file @
8d4d457c
...
...
@@ -791,12 +791,12 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
public
function
testDateAddStaticNumberOfDays
()
:
void
{
self
::
assertSame
(
"DATE
(rentalBeginsOn,'+12
DAY')"
,
$this
->
platform
->
getDateAddDaysExpression
(
'rentalBeginsOn'
,
12
));
self
::
assertSame
(
"DATE
TIME(rentalBeginsOn,'+' || 12 || '
DAY')"
,
$this
->
platform
->
getDateAddDaysExpression
(
'rentalBeginsOn'
,
12
));
}
public
function
testDateAddNumberOfDaysFromColumn
()
:
void
{
self
::
assertSame
(
"DATE(rentalBeginsOn,'+' || duration || ' DAY')"
,
$this
->
platform
->
getDateAddDaysExpression
(
'rentalBeginsOn'
,
'duration'
));
self
::
assertSame
(
"DATE
TIME
(rentalBeginsOn,'+' || duration || ' DAY')"
,
$this
->
platform
->
getDateAddDaysExpression
(
'rentalBeginsOn'
,
'duration'
));
}
public
function
testSupportsColumnCollation
()
:
void
...
...
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