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

java.lang.UnsupportedOperationException: Unable to decode metadata for DATETIMN #1040

Closed
rasmushaglund opened this issue Sep 13, 2021 · 8 comments · Fixed by #1041
Closed
Milestone

Comments

@rasmushaglund
Copy link
Contributor

rasmushaglund commented Sep 13, 2021

Hello, I'm trying out the MSSQL client but encountered an error while trying to decode a nullable datetime field for MSSQL 2017 CU21.

I debugged the code and saw that there's no metadata handler for the type. I don't fully understand the system here, but when I read an unsigned byte from the payload for the metadata decoding, ByteBufUtils.readUnsignedByteLengthString(payload) gave the correct columnName.

Can I help somehow? If I were about to add support for DATETIMN, what parts of the code would I look into?

@vietj
Copy link
Member

vietj commented Sep 13, 2021

@tsegismont

@tsegismont tsegismont added this to the 4.2.0 milestone Sep 14, 2021
@tsegismont
Copy link
Contributor

Hi @rasmushaglund , thanks for offering your help.

You can start by implementing the methods in the DataType class. Then you need to update the data types test cases.

If you haven't contributed to Vert.x before, I recommend reading https://github.com/vert-x3/wiki/wiki/Development-Process and https://github.com/vert-x3/wiki/wiki/Vert.x-code-style-guidelines.

Looking forward to your contribution!

@rasmushaglund
Copy link
Contributor Author

@tsegismont
Copy link
Contributor

tsegismont commented Sep 14, 2021 via email

@rasmushaglund
Copy link
Contributor Author

I think I've managed to implemented the type, but I don't know if and how to implement encodeParam. Is there any tests involving encodeParam which I can take a look at? Maybe just try to encode and decode back again and compare the results?

rasmushaglund@31278ff

@tsegismont
Copy link
Contributor

tsegismont commented Sep 14, 2021 via email

@rasmushaglund
Copy link
Contributor Author

rasmushaglund commented Sep 15, 2021

I've updated the related tests now, though the problem I have is that the encodeParam function for the data type is not called because the preferred class for LocalDateTime is DATETIME2N:

typesByValueClass.put(LocalDateTime.class, DATETIME2N);

We have the same problem for DATETIM4. Do we need to create new classes for DATETIMN and DATETIM4 to be able to differentiate between them (since there are no existing java.time classes), or can we just encode those types as DATETIME2N and let SQL Server recast to the correct types?

rasmushaglund@58f79d3

@tsegismont
Copy link
Contributor

or can we just encode those types as DATETIME2N and let SQL Server recast to the correct types

This is fine

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 a pull request may close this issue.

3 participants