Commit f2832461 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DDC-1282 - Remove overprotective casting of days/months to integer, which...

DDC-1282 - Remove overprotective casting of days/months to integer, which prevents passing columns as days. The platform is not responsible for escapsing, the DQL parser already does it way before generating the sql statements.
parent 00b6667a
......@@ -108,22 +108,22 @@ class MySqlPlatform extends AbstractPlatform
public function getDateAddDaysExpression($date, $days)
{
return 'DATE_ADD(' . $date . ', INTERVAL ' . (int)$days . ' DAY)';
return 'DATE_ADD(' . $date . ', INTERVAL ' . $days . ' DAY)';
}
public function getDateSubDaysExpression($date, $days)
{
return 'DATE_SUB(' . $date . ', INTERVAL ' . (int)$days . ' DAY)';
return 'DATE_SUB(' . $date . ', INTERVAL ' . $days . ' DAY)';
}
public function getDateAddMonthExpression($date, $months)
{
return 'DATE_ADD(' . $date . ', INTERVAL ' . (int)$months . ' MONTH)';
return 'DATE_ADD(' . $date . ', INTERVAL ' . $months . ' MONTH)';
}
public function getDateSubMonthExpression($date, $months)
{
return 'DATE_SUB(' . $date . ', INTERVAL ' . (int)$months . ' MONTH)';
return 'DATE_SUB(' . $date . ', INTERVAL ' . $months . ' MONTH)';
}
public function getListDatabasesSQL()
......
......@@ -118,22 +118,22 @@ class OraclePlatform extends AbstractPlatform
public function getDateAddDaysExpression($date, $days)
{
return '(' . $date . '+' . (int)$days . ')';
return '(' . $date . '+' . $days . ')';
}
public function getDateSubDaysExpression($date, $days)
{
return '(' . $date . '-' . (int)$days . ')';
return '(' . $date . '-' . $days . ')';
}
public function getDateAddMonthExpression($date, $months)
{
return "ADD_MONTHS(" . $date . ", " . (int)$months . ")";
return "ADD_MONTHS(" . $date . ", " . $months . ")";
}
public function getDateSubMonthExpression($date, $months)
{
return "ADD_MONTHS(" . $date . ", -" . (int)$months . ")";
return "ADD_MONTHS(" . $date . ", -" . $months . ")";
}
/**
......
......@@ -99,22 +99,22 @@ class PostgreSqlPlatform extends AbstractPlatform
public function getDateAddDaysExpression($date, $days)
{
return "(" . $date . "+ interval '" . (int)$days . " day')";
return "(" . $date . "+ interval '" . $days . " day')";
}
public function getDateSubDaysExpression($date, $days)
{
return "(" . $date . "- interval '" . (int)$days . " day')";
return "(" . $date . "- interval '" . $days . " day')";
}
public function getDateAddMonthExpression($date, $months)
{
return "(" . $date . "+ interval '" . (int)$months . " month')";
return "(" . $date . "+ interval '" . $months . " month')";
}
public function getDateSubMonthExpression($date, $months)
{
return "(" . $date . "- interval '" . (int)$months . " month')";
return "(" . $date . "- interval '" . $months . " month')";
}
/**
......
......@@ -132,22 +132,22 @@ class SqlitePlatform extends AbstractPlatform
public function getDateAddDaysExpression($date, $days)
{
return "DATE(" . $date . ",'+". (int)$days . " day')";
return "DATE(" . $date . ",'+". days . " day')";
}
public function getDateSubDaysExpression($date, $days)
{
return "DATE(" . $date . ",'-". (int)$days . " day')";
return "DATE(" . $date . ",'-". $days . " day')";
}
public function getDateAddMonthExpression($date, $months)
{
return "DATE(" . $date . ",'+". (int)$months . " month')";
return "DATE(" . $date . ",'+". $months . " month')";
}
public function getDateSubMonthExpression($date, $months)
{
return "DATE(" . $date . ",'-". (int)$months . " month')";
return "DATE(" . $date . ",'-". $months . " month')";
}
protected function _getTransactionIsolationLevelSQL($level)
......
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