Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.4.2
-
None
-
All
Description
When using java.time.LocalTime to store values in DB, org.mariadb.jdbc.BasePrepareStatement loses all the fractional parts of the seconds during the conversion to java.sql.Time and then uses that to store the value. Even if the conversion was done correctly, java.sql.Time only allows storing at millisecond precision, so some data would be lost in any case.
There are proper implementations with correct fractional second support for OffsetDateTime, OffsetTime and ZonedDateTime so I assume this is just an oversight that LocalTime was not supported with fractions support? If it was intentional, then it would still make sense to keep at least millisecond precision which is also supported using the legacy java.sql.Time datatype.
It is possible to work around the issue atm by implementing a custom org.mariadb.jdbc.internal.com.send.parameters.ParameterHolder and using that to set the value using org.mariadb.jdbc.BasePrepareStatement.setParameter()