[#470] Add support for the Oracle TRUNC function for datetime arithmetic

This commit is contained in:
Lukas Eder 2012-05-01 22:14:10 +02:00
parent 97e8fbc9f0
commit b71d7b47b9

View File

@ -2760,30 +2760,36 @@ public class Factory implements FactoryOperations {
return new TimestampDiff(nullSafe(timestamp1), nullSafe(timestamp2));
}
public static Field<Date> trunc(Date date) {
// -------------------------------------------------------------------------
// [#470] TRUNC(datetime) will be implemented in a future release
// -------------------------------------------------------------------------
static Field<Date> trunc(Date date) {
return trunc(date, DatePart.DAY);
}
public static Field<Date> trunc(Date date, DatePart part) {
static Field<Date> trunc(Date date, DatePart part) {
return trunc(val(date), part);
}
public static Field<Timestamp> trunc(Timestamp timestamp) {
static Field<Timestamp> trunc(Timestamp timestamp) {
return trunc(timestamp, DatePart.DAY);
}
public static Field<Timestamp> trunc(Timestamp timestamp, DatePart part) {
static Field<Timestamp> trunc(Timestamp timestamp, DatePart part) {
return trunc(val(timestamp), part);
}
public static <T extends java.util.Date> Field<T> trunc(Field<T> date) {
static <T extends java.util.Date> Field<T> trunc(Field<T> date) {
return trunc(date, DatePart.DAY);
}
public static <T extends java.util.Date> Field<T> trunc(Field<T> date, DatePart part) {
static <T extends java.util.Date> Field<T> trunc(Field<T> date, DatePart part) {
throw new UnsupportedOperationException("This is not yet implemented");
}
// -------------------------------------------------------------------------
/**
* Get the extract(field, datePart) function
* <p>