generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgreSQLNotPresent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
runtime/src/main/java/io/quarkiverse/jooq/runtime/graal/PostgresUtilsSubstitutions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |