Class JDBC42_21
- java.lang.Object
-
- org.postgresql.pljava.example.annotation.JDBC42_21
-
@SQLAction(requires="TypeRoundTripper.roundTrip", install={" SELECT CASE WHEN every(orig = roundtripped) THEN javatest.logmessage(\'INFO\', \'java.time.LocalDate passes\') ELSE javatest.logmessage(\'WARNING\', \'java.time.LocalDate fails\') END FROM (VALUES (date \'infinity\'), (date \'2017-08-21\'), (date \'1970-03-07\'), (date \'1919-05-29\'), (date \'-infinity\') ) AS p(orig), javatest.roundtrip(p, \'java.time.LocalDate\') AS r(roundtripped date)"," SELECT CASE WHEN every(orig = roundtripped) THEN javatest.logmessage(\'INFO\', \'java.time.LocalTime passes\') ELSE javatest.logmessage(\'WARNING\', \'java.time.LocalTime fails\') END FROM (VALUES (current_time::time), (\'00:00:00\'), (\'24:00:00\') ) AS p(orig), javatest.roundtrip(p, \'java.time.LocalTime\') AS r(roundtripped time)"," SELECT CASE WHEN every(orig = roundtripped) THEN javatest.logmessage(\'INFO\', \'java.time.OffsetTime passes\') ELSE javatest.logmessage(\'WARNING\', \'java.time.OffsetTime fails\') END FROM (VALUES (current_time::timetz), (\'00:00:00\'), (\'24:00:00\') ) AS p(orig), javatest.roundtrip(p, \'java.time.OffsetTime\') AS r(roundtripped timetz)"," SELECT CASE WHEN every(orig = roundtripped) THEN javatest.logmessage(\'INFO\', \'java.time.LocalDateTime passes\') ELSE javatest.logmessage(\'WARNING\',\'java.time.LocalDateTime fails\') END FROM (SELECT \'on\' = current_setting(\'integer_datetimes\')) AS ck(idt), LATERAL ( SELECT value FROM\t (VALUES\t (true, timestamp \'2017-08-21 18:25:29.900005\'),\t (true, timestamp \'1970-03-07 17:37:49.300009\'),\t (true, timestamp \'1919-05-29 13:08:33.600001\'),\t (idt, timestamp \'infinity\'),\t (idt, timestamp \'-infinity\')\t ) AS vs(cond, value) WHERE cond ) AS p(orig), javatest.roundtrip(p, \'java.time.LocalDateTime\') AS r(roundtripped timestamp)"," SELECT CASE WHEN every(orig = roundtripped) THEN javatest.logmessage(\'INFO\', \'java.time.OffsetDateTime passes\') ELSE javatest.logmessage( \'WARNING\',\'java.time.OffsetDateTime fails\') END FROM (SELECT \'on\' = current_setting(\'integer_datetimes\')) AS ck(idt), LATERAL ( SELECT value FROM\t (VALUES\t (true, timestamptz \'2017-08-21 18:25:29.900005Z\'),\t (true, timestamptz \'1970-03-07 17:37:49.300009Z\'),\t (true, timestamptz \'1919-05-29 13:08:33.600001Z\'),\t (idt, timestamptz \'infinity\'),\t (idt, timestamptz \'-infinity\')\t ) AS vs(cond, value) WHERE cond ) AS p(orig), javatest.roundtrip(p, \'java.time.OffsetDateTime\') AS r(roundtripped timestamptz)"," SELECT CASE WHEN every(orig = roundtripped) THEN javatest.logmessage(\'INFO\', \'OffsetTime as stmt param passes\') ELSE javatest.logmessage( \'WARNING\',\'java.time.OffsetTime as stmt param fails\') END FROM (SELECT current_time::timetz) AS p(orig), javatest.roundtrip(p, \'java.time.OffsetTime\', true) AS r(roundtripped timetz)"}) public class JDBC42_21 extends Object
Exercise new mappings between date/time types and java.time classes (JDBC 4.2 change 21).Defines a method
javaSpecificationGE
that may be of use for other examples.
-
-
Constructor Summary
Constructors Constructor Description JDBC42_21()
-
Method Summary
Modifier and Type Method Description static boolean
javaSpecificationGE(String want)
Return true if running under a Java specification version at least as recent as the argument ('1.6', '1.7', '1.8', '9', '10', '11', ...).
-
-
-
Constructor Detail
-
JDBC42_21
public JDBC42_21()
-
-
Method Detail
-
javaSpecificationGE
@Function(schema="javatest", provides="javaSpecificationGE") public static boolean javaSpecificationGE(String want)
Return true if running under a Java specification version at least as recent as the argument ('1.6', '1.7', '1.8', '9', '10', '11', ...).
-
-