sepatel/tekniq

Bug using LocalDate parameter to sql queries

Closed this issue · 3 comments

I found a rather obnoxious bug using tekniq-jdbc to do sql queries. When passing a LocalDate as a parameter to the sql query, the resulting date ends up 1900 years in the future.
The reason being that the java.util.Date and java.sql.Date constructors which take the year, month and day assume the year is years since 1900 and add that many years to the date.

Instead, it is recommended to use java.sql.Date.valueOf(myLocalDate) instead (ref: line 80 of TqConnectionExt.kt)

I've pushed up a fix onto a branch fix-locatdatetime, however it will probably be this weekend before I'm able to fully regression test everything and push up a release.

Thank you for discovering and providing a detailed explanation as to the issue and resolution.

Fixed, validated, and released with version 0.9.6

Looks good, thank you!