Commit 0083774f authored by Steve Müller's avatar Steve Müller

add missing date expressions

parent 11bbb166
......@@ -387,6 +387,14 @@ class SQLAnywherePlatform extends AbstractPlatform
return 'DATEADD(day, ' . $days . ', ' . $date . ')';
}
/**
* {@inheritdoc}
*/
public function getDateAddHourExpression($date, $hours)
{
return 'DATEADD(hour, ' . $hours . ', ' . $date . ')';
}
/**
* {@inheritdoc}
*/
......@@ -411,6 +419,14 @@ class SQLAnywherePlatform extends AbstractPlatform
return 'DATEADD(day, -1 * ' . $days . ', ' . $date . ')';
}
/**
* {@inheritdoc}
*/
public function getDateSubHourExpression($date, $hours)
{
return 'DATEADD(hour, -1 * ' . $hours . ', ' . $date . ')';
}
/**
* {@inheritdoc}
*/
......
......@@ -534,9 +534,11 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
$this->assertEquals('CURRENT TIME', $this->_platform->getCurrentTimeSQL());
$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(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("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(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("Y-m-d H:i:s.u", $this->_platform->getDateTimeFormatString());
$this->assertEquals("H:i:s.u", $this->_platform->getTimeFormatString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment