diff --git a/pom.xml b/pom.xml index 447f6d1..668d2d7 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ UTF-8 UTF-8 2.5.1.Final - 3.15.5 + 3.15.12 diff --git a/runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgreSQLNotPresent.java b/runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgreSQLNotPresent.java new file mode 100644 index 0000000..70f41ce --- /dev/null +++ b/runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgreSQLNotPresent.java @@ -0,0 +1,15 @@ +package io.quarkiverse.jooq.runtime.graal; + +import java.util.function.BooleanSupplier; + +public class PostgreSQLNotPresent implements BooleanSupplier { + @Override + public boolean getAsBoolean() { + try { + Class.forName("org.postgresql.util.PGInterval"); + return false; + } catch (ClassNotFoundException e) { + return true; + } + } +} diff --git a/runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgresUtilsSubstitutions.java b/runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgresUtilsSubstitutions.java new file mode 100644 index 0000000..84e6560 --- /dev/null +++ b/runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgresUtilsSubstitutions.java @@ -0,0 +1,48 @@ +package io.quarkiverse.jooq.runtime.graal; + +import org.jooq.types.DayToSecond; +import org.jooq.types.YearToMonth; +import org.jooq.types.YearToSecond; + +import com.oracle.svm.core.annotate.Substitute; +import com.oracle.svm.core.annotate.TargetClass; + +@TargetClass(className = "org.jooq.util.postgres.PostgresUtils", onlyWith = PostgreSQLNotPresent.class) +public final class PostgresUtilsSubstitutions { + + @Substitute + public static DayToSecond toDayToSecond(Object pgInterval) { + throw new IllegalArgumentException( + "Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + pgInterval); + } + + @Substitute + public static YearToMonth toYearToMonth(Object pgInterval) { + throw new IllegalArgumentException( + "Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + pgInterval); + } + + @Substitute + public static Object toPGInterval(DayToSecond interval) { + throw new IllegalArgumentException( + "Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + interval); + + } + + @Substitute + public static Object toPGInterval(YearToSecond interval) { + throw new IllegalArgumentException( + "Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + interval); + } + + @Substitute + public static Object toPGInterval(YearToMonth interval) { + throw new IllegalArgumentException( + "Unsupported interval type. Make sure you have the pgjdbc or redshift driver on your classpath: " + interval); + } + + @Substitute + private static final boolean pgIntervalAvailable() { + return false; + } +}