Fall through to default datediff implementation for INGRES

This commit is contained in:
Lukas Eder 2013-08-19 19:02:02 +02:00
parent 6461ce5b87
commit f69c085ea0
2 changed files with 6 additions and 8 deletions

View File

@ -42,7 +42,6 @@ import java.sql.Date;
import org.jooq.Configuration;
import org.jooq.Field;
import org.jooq.exception.SQLDialectNotSupportedException;
/**
* @author Lukas Eder
@ -90,9 +89,6 @@ class DateDiff extends AbstractFunction<Integer> {
case HSQLDB:
return field("{datediff}('day', {0}, {1})", getDataType(), date2, date1);
case INGRES:
throw new SQLDialectNotSupportedException("Date time arithmetic not supported in Ingres. Contributions welcome!");
case SQLITE:
return field("({strftime}('%s', {0}) - {strftime}('%s', {1})) / 86400", getDataType(), date1, date2);
@ -100,6 +96,9 @@ class DateDiff extends AbstractFunction<Integer> {
case ORACLE:
case POSTGRES:
return field("{0} - {1}", getDataType(), date1, date2);
// Fall through to default
case INGRES:
}
// Default implementation for equals() and hashCode()

View File

@ -43,7 +43,6 @@ import java.sql.Timestamp;
import org.jooq.Configuration;
import org.jooq.Field;
import org.jooq.exception.SQLDialectNotSupportedException;
import org.jooq.types.DayToSecond;
/**
@ -104,9 +103,6 @@ class TimestampDiff extends AbstractFunction<DayToSecond> {
case HSQLDB:
return field("{datediff}('ms', {0}, {1})", getDataType(), timestamp2, timestamp1);
case INGRES:
throw new SQLDialectNotSupportedException("Date time arithmetic not supported in Ingres. Contributions welcome!");
// MySQL's datetime operations operate on a microsecond level
case MARIADB:
case MYSQL:
@ -122,6 +118,9 @@ class TimestampDiff extends AbstractFunction<DayToSecond> {
case ORACLE:
case POSTGRES:
return field("{0} - {1}", getDataType(), timestamp1, timestamp2);
// Fall through to default
case INGRES:
}
// Default implementation for equals() and hashCode()