diff --git a/jOOQ/src/main/java/org/jooq/impl/DateOrTime.java b/jOOQ/src/main/java/org/jooq/impl/DateOrTime.java index 1bceb5989d..8063ebdc3f 100644 --- a/jOOQ/src/main/java/org/jooq/impl/DateOrTime.java +++ b/jOOQ/src/main/java/org/jooq/impl/DateOrTime.java @@ -40,6 +40,8 @@ */ package org.jooq.impl; +import static org.jooq.impl.DSL.keyword; + import java.sql.Date; import java.sql.Time; @@ -77,13 +79,23 @@ class DateOrTime extends AbstractFunction { @Override final QueryPart getFunction0(Configuration configuration) { - switch (configuration.dialect().family()) { + switch (configuration.family()) { case MYSQL: case MARIADB: return DSL.field("{" + name(getDataType()) + "}({0})", getDataType(), field); + case SQLITE: { + String name = + getDataType().getType() == Date.class + ? "date" + : getDataType().getType() == Time.class + ? "time" + : "datetime"; + + return DSL.field("{0}({1})", getDataType(), keyword(name), field); + } + default: - case H2: return field.cast(getDataType()); } }