=item * The L</-value> operator
+=item * Date Functions:
+
+Note that for the following functions use different functions for different
+RDBMS'. See the SQLMaker docs for your database to see what functions are
+used.
+
+=over
+
+=item * -dt => $date_time_obj
+
+This function will convert the passed datetime to whatever format the current
+database prefers
+
+=item * -dt_diff => [$unit, \'foo.date_from', \'foo.date_to']
+
+This function will diff two dates and return the units requested. Note that
+it correctly recurses if you pass it something like a function or a date value.
+Also note that not all RDBMS' are equal; some units supported on some databases
+and some are supported on others. See the documentation for the SQLMaker class
+for your database.
+
+=item * -dt_get => [$part, \'foo.date_col']
+
+This function will extract the passed part from the passed column. Note that
+it correctly recurses if you pass it something like a function or a date value.
+Also note that not all RDBMS' are equal; some parts supported on some databases
+and some are supported on others. See the documentation for the SQLMaker class
+for your database.
+
+=item * -dt_year => \'foo.date_col'
+
+A shortcut for -dt_get => [year => ...]
+
+=item * -dt_month => \'foo.date_col'
+
+A shortcut for -dt_get => [month => ...]
+
+=item * -dt_day => \'foo.date_col'
+
+A shortcut for -dt_get => [day_of_month => ...]
+
+=item * -dt_hour => \'foo.date_col'
+
+A shortcut for -dt_get => [hour => ...]
+
+=item * -dt_minute => \'foo.date_col'
+
+A shortcut for -dt_get => [minute => ...]
+
+=item * -dt_second => \'foo.date_col'
+
+A shortcut for -dt_get => [second => ...]
+
+=back
+
=back
Another operator is C<-func> that allows you to call SQL functions with
month => 'MONTH',
quarter => 'QUARTER',
year => 'YEAR',
- # should we support these or what?
second_microsecond => 'SECOND_MICROSECOND',
minute_microsecond => 'MINUTE_MICROSECOND',
minute_second => 'MINUTE_SECOND',
}
}
+=head1 DATE FUNCTION IMPLEMENTATION
+
+=head1 DATE FUNCTION IMPLEMENTATION
+
+The function used to extract date information is C<DATEPART>, which supports
+
+ microsecond
+ second
+ minute
+ hour
+ day_of_month
+ week
+ month
+ quarter
+ year
+ second_microsecond
+ minute_microsecond
+ minute_second
+ hour_microsecond
+ hour_second
+ hour_minute
+ day_microsecond
+ day_second
+ day_minute
+ day_hour
+ year_month
+
+The function used to diff dates is C<TIMESTAMPDIFF>, which supports
+
+ microsecond
+ second
+ minute
+ hour
+ day
+ week
+ month
+ quarter
+ year
+ second_microsecond
+ minute_microsecond
+ minute_second
+ hour_microsecond
+ hour_second
+ hour_minute
+ day_microsecond
+ day_second
+ day_minute
+ day_hour
+ year_month
+
+=cut
+
1;
"TIMESTAMPDIFF($part_map{$_[1]}, $_[2], $_[3])"
}
}
+
+=head1 DATE FUNCTION IMPLEMENTATION
+
+A separate function is used for each extraction type in Oracle. The types
+supported are:
+
+ month
+ day_of_month
+ day_of_year
+ day_of_quarter
+ quarter
+ month_of_quarter
+ year
+ hour
+ minute
+ second
+ week_of_quarter
+ week_of_year
+
+The function used to diff dates is C<TIMESTAMPDIFF>, which supports
+
+ second
+ minute
+ hour
+ week
+ quarter
+ month
+ day_of_year
+ year
+
+=cut
+
1;
day_of_week => 'w',
week => 'W',
year => 'Y',
- # should we support these or what?
julian_day => 'J',
seconds_since_epoch => 's',
fractional_seconds => 'f',
}
}
+=head1 DATE FUNCTION IMPLEMENTATION
+
+The function used to extract date information is C<STRFTIME>, which supports
+
+ month
+ day_of_month
+ year
+ hour
+ day_of_year
+ minute
+ seconds
+ day_of_week
+ week
+ year
+ julian_day
+ seconds_since_epoch
+ fractional_seconds
+
+The function used to diff dates differs and only supports
+
+ day
+ second
+
+=cut
+
1;