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
0083774f
Commit
0083774f
authored
Oct 22, 2013
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add missing date expressions
parent
11bbb166
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+16
-0
SQLAnywherePlatformTest.php
...Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+2
-0
No files found.
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
0083774f
...
@@ -387,6 +387,14 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -387,6 +387,14 @@ class SQLAnywherePlatform extends AbstractPlatform
return
'DATEADD(day, '
.
$days
.
', '
.
$date
.
')'
;
return
'DATEADD(day, '
.
$days
.
', '
.
$date
.
')'
;
}
}
/**
* {@inheritdoc}
*/
public
function
getDateAddHourExpression
(
$date
,
$hours
)
{
return
'DATEADD(hour, '
.
$hours
.
', '
.
$date
.
')'
;
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
@@ -411,6 +419,14 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -411,6 +419,14 @@ class SQLAnywherePlatform extends AbstractPlatform
return
'DATEADD(day, -1 * '
.
$days
.
', '
.
$date
.
')'
;
return
'DATEADD(day, -1 * '
.
$days
.
', '
.
$date
.
')'
;
}
}
/**
* {@inheritdoc}
*/
public
function
getDateSubHourExpression
(
$date
,
$hours
)
{
return
'DATEADD(hour, -1 * '
.
$hours
.
', '
.
$date
.
')'
;
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
...
tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View file @
0083774f
...
@@ -534,9 +534,11 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
...
@@ -534,9 +534,11 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
$this
->
assertEquals
(
'CURRENT TIME'
,
$this
->
_platform
->
getCurrentTimeSQL
());
$this
->
assertEquals
(
'CURRENT TIME'
,
$this
->
_platform
->
getCurrentTimeSQL
());
$this
->
assertEquals
(
'CURRENT TIMESTAMP'
,
$this
->
_platform
->
getCurrentTimestampSQL
());
$this
->
assertEquals
(
'CURRENT TIMESTAMP'
,
$this
->
_platform
->
getCurrentTimestampSQL
());
$this
->
assertEquals
(
"DATEADD(day, 4, '1987/05/02')"
,
$this
->
_platform
->
getDateAddDaysExpression
(
"'1987/05/02'"
,
4
));
$this
->
assertEquals
(
"DATEADD(day, 4, '1987/05/02')"
,
$this
->
_platform
->
getDateAddDaysExpression
(
"'1987/05/02'"
,
4
));
$this
->
assertEquals
(
"DATEADD(hour, 12, '1987/05/02')"
,
$this
->
_platform
->
getDateAddHourExpression
(
"'1987/05/02'"
,
12
));
$this
->
assertEquals
(
"DATEADD(month, 102, '1987/05/02')"
,
$this
->
_platform
->
getDateAddMonthExpression
(
"'1987/05/02'"
,
102
));
$this
->
assertEquals
(
"DATEADD(month, 102, '1987/05/02')"
,
$this
->
_platform
->
getDateAddMonthExpression
(
"'1987/05/02'"
,
102
));
$this
->
assertEquals
(
"DATEDIFF(day, '1987/04/01', '1987/05/02')"
,
$this
->
_platform
->
getDateDiffExpression
(
"'1987/05/02'"
,
"'1987/04/01'"
));
$this
->
assertEquals
(
"DATEDIFF(day, '1987/04/01', '1987/05/02')"
,
$this
->
_platform
->
getDateDiffExpression
(
"'1987/05/02'"
,
"'1987/04/01'"
));
$this
->
assertEquals
(
"DATEADD(day, -1 * 4, '1987/05/02')"
,
$this
->
_platform
->
getDateSubDaysExpression
(
"'1987/05/02'"
,
4
));
$this
->
assertEquals
(
"DATEADD(day, -1 * 4, '1987/05/02')"
,
$this
->
_platform
->
getDateSubDaysExpression
(
"'1987/05/02'"
,
4
));
$this
->
assertEquals
(
"DATEADD(hour, -1 * 12, '1987/05/02')"
,
$this
->
_platform
->
getDateSubHourExpression
(
"'1987/05/02'"
,
12
));
$this
->
assertEquals
(
"DATEADD(month, -1 * 102, '1987/05/02')"
,
$this
->
_platform
->
getDateSubMonthExpression
(
"'1987/05/02'"
,
102
));
$this
->
assertEquals
(
"DATEADD(month, -1 * 102, '1987/05/02')"
,
$this
->
_platform
->
getDateSubMonthExpression
(
"'1987/05/02'"
,
102
));
$this
->
assertEquals
(
"Y-m-d H:i:s.u"
,
$this
->
_platform
->
getDateTimeFormatString
());
$this
->
assertEquals
(
"Y-m-d H:i:s.u"
,
$this
->
_platform
->
getDateTimeFormatString
());
$this
->
assertEquals
(
"H:i:s.u"
,
$this
->
_platform
->
getTimeFormatString
());
$this
->
assertEquals
(
"H:i:s.u"
,
$this
->
_platform
->
getTimeFormatString
());
...
...
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