This commit adds mapping for two types from the java.time
package,
complementing the types that are already translatable to Sql types
TIME, DATE and TIMESTAMP:
- OffsetTime
maps to a TIME_WITH_TIMEZONE
- OffsetDateTime
maps to a TIMESTAMP_WITH_TIMEZONE
This is in accordance with the B.4 table provided in the JDBC 4.2 specification.
When preparing statements, these java.time
types use the setObject
method. Tests covering the 5 java.time
classes have also been added.
See gh-28778 See gh-28527
Comment From: simonbasle
for reference, here's an excerpt of Table B.4 in the JDBC 4.2 specification:
PreparedStatement.setObject, PreparedStatement.setNull, RowSet.setNull and RowSet.setObject use the mapping shown TABLE B-4 when no parameter specifying a target JDBC type is provided.
Java Type | SQL Type
java.sql.Date DATE
| java.sql.Time TIME
| java.sql.Timestamp TIMESTAMP
| java.util.Calendar TIMESTAMP
| java.util.Date TIMESTAMP
| java.time.LocalDate DATE
| java.time.LocalTime TIME
| java.time.LocalDateTime TIMESTAMP
| java.time.OffsetTime TIME_WITH_TIMEZONE
| java.time.OffsetDatetime TIMESTAMP_WITH_TIMEZONE
| |