Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Parsing failure when selecting CURRENT_TIMESTAMP using CurrentDateTime function #1879

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

joc-a
Copy link
Collaborator

@joc-a joc-a commented Oct 16, 2023

  • For H2, the type of the value returned from the database for CurrentDateTime function is OffsetDateTime, which was not being handled correctly in valueFromDB function.
  • For Oracle, the type of the value returned from the database for CurrentDateTime function is oracle.sql.TIMESTAMPTZ, which was not being handled correctly in valueFromDB function. The fix for this is to call rs.getObject(index, java.sql.Timestamp::class.java) in readObject, which then results in the type being java.sql.Timestamp which is already handled properly in valueFromDB function.

…teTime function

-For H2, the type of the value returned from the database for CurrentDateTime function is OffsetDateTime, which was not being handled correctly in `valueFromDB` function.
-For Oracle, the type of the value returned from the database for CurrentDateTime function is oracle.sql.TIMESTAMPTZ, which was not being handled correctly in `valueFromDB` function. The fix for this is to call `rs.getObject(index, java.sql.Timestamp::class.java)` in readObject, which then results in the type being java.sql.Timestamp which is already handled properly in `valueFromDB` function.
@joc-a joc-a force-pushed the joc/fix-parsing-error-for-current-date-time-function branch from 0732664 to bc8db2c Compare October 16, 2023 18:46
@joc-a joc-a requested review from bog-walk and e5l October 16, 2023 20:08
@joc-a joc-a marked this pull request as ready for review October 16, 2023 20:08
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

fun testCurrentDateTimeFunction() {
val fakeTestTable = object : IntIdTable("fakeTable") {}

withTables(fakeTestTable) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you log an issue about making API for running such functions? I think it could be helpful for users as well

@joc-a joc-a merged commit 486adb1 into main Oct 17, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants