function date_sql_handler::sql_where_extract in Date 6.2
Same name and namespace in other branches
- 5.2 date_api_sql.inc \date_sql_handler::sql_where_extract()
- 6 date_api_sql.inc \date_sql_handler::sql_where_extract()
- 7.3 date_api/date_api_sql.inc \date_sql_handler::sql_where_extract()
- 7 date_api/date_api_sql.inc \date_sql_handler::sql_where_extract()
- 7.2 date_api/date_api_sql.inc \date_sql_handler::sql_where_extract()
Create a where clause to compare an extracted part of a field to an integer value.
Parameters
string $part: The part to extract, YEAR, MONTH, DAY, etc.
string $field: The db table and field name, like "$table.$field".
string $operator: The db comparison operator to use, like '='.
int $value: The integer value to compare the extracted date part to.
Return value
SQL for the where clause for this operation.
File
- ./
date_api_sql.inc, line 476 - SQL date functions.
Class
- date_sql_handler
- A class to manipulate date SQL.
Code
function sql_where_extract($part, $field, $operator, $value, $adjustment = NULL) {
$field = $this
->sql_field($field, $adjustment);
return $this
->sql_extract($part, $field) . " {$operator} {$value}";
}