Thread: [pgjdbc/pgjdbc] 3d14ea: feat: add support for ResultSet#getObject(OffsetTi...

[pgjdbc/pgjdbc] 3d14ea: feat: add support for ResultSet#getObject(OffsetTi...

From
Uwe Schindler
Date:
Branch: refs/heads/master
  Home:   https://github.com/pgjdbc/pgjdbc
  Commit: 3d14ea45688d98ebead548e00f78756841837434
      https://github.com/pgjdbc/pgjdbc/commit/3d14ea45688d98ebead548e00f78756841837434
  Author: Uwe Schindler <uwe@thetaphi.de>
  Date:   2022-03-29 (Tue, 29 Mar 2022)

  Changed paths:
    M pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java
    M pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
    M pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java
    M pgjdbc/src/test/java/org/postgresql/test/jdbc42/GetObject310Test.java
    M pgjdbc/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java
    M pgjdbc/src/test/java/org/postgresql/test/jdbc42/TimestampUtilsTest.java

  Log Message:
  -----------
  feat: add support for ResultSet#getObject(OffsetTime.class) and PreparedStatement#setObject(OffsetTime.class)
(#2467)

* Add support for OffsetTime to Postgres JDBC; make parseBackendTimestamp() use a ZoneOffset instead of a Calendar
instance

* Revert the removal of the calendar cache (it is still needed for legacy conversion of Time/Date/Timestamp)

* Add more tests and add support for OffsetTime in prepared statements

* Add test for prepared statement

* Correct implementation of cache

* Change test to assert roundtrip on setObject(type) and getObject(type) return equal values (except the test with
timestamprounding)
 

* Add TODO entry about missing constant

* Update TimestampUtilsTest to have the special rounding conditions in the message


* Rename parameter to what it originally was

* Rewrite TimestampUtilsTest to use custom assertion method with good error messages

* remove nullability suppression

* add comments back

* Disallow conversion of non-TZ to Offset and TZ types to Local time values:
- refactor code to have the conversion exception at end of method as fallback
- also check correct types in string mode"

* Add missing checks to have all possible types

* Remove type checks in getObject

* Fix and move getLocalTime to the other JSR-310 methods, too

* Add tests for invalid type conversions; cleanup test with try-with-resources