1.20.x database.inc | public DatabaseConnection_mysql::dateMathSql($field, $direction, $count, $granularity) |
Overrides DatabaseConnection::dateMathSql
File
- drivers/
database_mysql/ database.inc, line 665 - Database interface code for MySQL database servers.
Class
Code
public function dateMathSql($field, $direction, $count, $granularity) {
$granularity = strtoupper($granularity);
switch ($direction) {
case 'ADD':
return "DATE_ADD($field, INTERVAL $count $granularity)";
case 'SUB':
return "DATE_SUB($field, INTERVAL $count $granularity)";
}
return $field;
}