[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/date/ -> date_api_sql.inc (summary)

(no description)

File Size: 889 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

date_sql_handler:: (24 methods):
  construct()
  db_tz_support()
  set_db_timezone()
  get_offset()
  sql_field()
  sql_offset()
  sql_date_math()
  sql_tz()
  sql_format()
  sql_extract()
  sql_where_date()
  sql_where_extract()
  sql_where_format()
  date_parts()
  part_info()
  complete_date()
  format_help()
  part_is_valid()
  views_formats()
  granularity_form()
  arg_parts()
  arg_replace()
  arg_granularity()
  arg_range()

Defines 24 functions

  date_sql_concat()
  date_sql_coalesce()
  date_sql_pad()

Class: date_sql_handler  - X-Ref

A class to manipulate date SQL.

construct($date_type = DATE_DATETIME, $local_timezone = NULL)   X-Ref
No description

db_tz_support($reset = FALSE)   X-Ref
See if the db has timezone name support.


set_db_timezone($offset = '+00:00')   X-Ref
Set the database timzone offset.

Setting the db timezone to UTC is done to ensure consistency in date
handling whether or not the database can do proper timezone conversion.

Views filters that not exposed are cached and won't set the timezone
so views date filters should add 'cacheable' => 'no' to their
definitions to ensure that the database timezone gets set properly
when the query is executed.

param: $offset

get_offset()   X-Ref
Return timezone offset for the date being processed.


sql_field($field, $offset = NULL)   X-Ref
Helper function to create cross-database SQL dates.

param: $field
param: $offset
return:

sql_offset($field, $offset = NULL)   X-Ref
Adjust a field value by an offset in seconds.


sql_date_math($field, $direction, $count, $granularity)   X-Ref
Adjust a field value by time interval.

param: $field
param: $direction
param: $count
param: $granularity

sql_tz($field, $offset = NULL)   X-Ref
Select a date value from the database, adjusting the value
for the timezone.

Check whether database timezone conversion is supported in
this system and use it if possible, otherwise use an
offset.

param: $offset

sql_format($format, $field)   X-Ref
Helper function to create cross-database SQL date formatting.

param: $format
param: $field
return:

sql_extract($extract_type, $field)   X-Ref
Helper function to create cross-database SQL date extraction.

param: $extract_type
param: $field
return:

sql_where_date($type, $field, $operator, $value, $adjustment = 0)   X-Ref
Create a where clause to compare a complete date field to a complete date value.

param: string $type
param: string $field
param: string $operator
param: int $value
return:

sql_where_extract($part, $field, $operator, $value)   X-Ref
Create a where clause to compare an extracted part of a field to an integer value.

param: string $part
param: string $field
param: string $operator
param: int $value
return:

sql_where_format($format, $field, $operator, $value)   X-Ref
Create a where clause to compare a formated field to a formated value.

param: string $format
param: string $field
param: string $operator
param: string $value
return:

date_parts($limit = NULL)   X-Ref
An array of all date parts,
optionally limited to an array of allowed parts.


part_info($op = NULL, $part = NULL)   X-Ref
Part information.

param: $op
param: $part

complete_date($selected, $type = 'now')   X-Ref
Create a complete datetime value out of an
incomplete array of selected values.

For example, array('year' => 2008, 'month' => 05) will fill
in the day, hour, minute and second with the earliest possible
values if type = 'min', the latest possible values if type = 'max',
and the current values if type = 'now'.

format_help($format)   X-Ref
Convert a format string into help text,
i.e. 'Y-m-d' becomes 'YYYY-MM-DD'.

param: unknown_type $format
return: unknown

part_is_valid($value, $type)   X-Ref
A function to test the validity of various date parts


views_formats($granularity, $type = 'sql')   X-Ref
No description

granularity_form($granularity)   X-Ref
No description

arg_parts($argument)   X-Ref
Parse date parts from an ISO date argument.

Based on ISO 8601 date duration and time interval standards.

See http://en.wikipedia.org/wiki/ISO_8601#Week_dates for definitions of ISO weeks.
See http://en.wikipedia.org/wiki/ISO_8601#Duration for definitions of ISO duration and time interval.

Parses a value like 2006-01-01--2006-01-15, or 2006-W24, or @P1W.
Separate from and to dates or date and period with a double hyphen (--).

The 'to' portion of the argument can be eliminated if it is the same as the 'from' portion.
Use @ instead of a date to substitute in the current date and time.

Use periods (P1H, P1D, P1W, P1M, P1Y) to get next hour/day/week/month/year from now.
Use date before P sign to get next hour/day/week/month/year from that date.
Use period then date to get a period that ends on the date.


arg_replace($arg)   X-Ref
Convert strings like '+1 day' to the ISO equivalent, like 'P1D'.


arg_granularity($arg)   X-Ref
Use the parsed values from the ISO argument to determine the
granularity of this period.


arg_range($arg)   X-Ref
Use the parsed values from the ISO argument to determine the
min and max date for this period.


Functions
Functions that are not part of a class:

date_sql_concat($array)   X-Ref
A helper function to do cross-database concatation of date parts

param: $array - an array of values to be concatonated in sql
return: - correct sql string for database type

date_sql_coalesce($array)   X-Ref
Helper function to do cross-database NULL replacements

param: an array of values to test for NULL values
return: SQL statement to return the first non-NULL value in the list.

date_sql_pad($str, $size = 2, $pad = '0', $side = 'l')   X-Ref
A helper function to do cross-database padding of date parts

param: $str - a string to apply padding to
param: $size - the size the final string should be
param: $pad - the value to pad the string with
param: $side - the side of the string to pad



Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7