-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add support for java.time.Instant #278
Comments
While you could read |
Sorry but I don't agree with that interpretation. In fact, using any other mssql datetime type that allows us to set TZ could be a real problem as this can be configured wrong, to to use TZ order thatn UTC. Or we'd have to make a conversion from TZ set in data into UTC, which again is not a driver's responsibiliy. This makes me even more sure that a datetime without TZ storage has to be used.
R2DBC nor other drivers are not to decide the designation of the data stored in the columns. Driver is to give an access and a possibility to map DB columns into datatypes present in particular language (in this case Java and Instant). And this gives a freedom for developers to use it. JDBC allows this so there's some kind of a convention or possiblity. Then moving from JDBC to reactive access would be (almost) like switching some libraries. But not if suddenly R2DBC is not supporting Again, I encourage you to discuss it and be open for my reasoning. I propose my input on this and a ready PR. Just making sure that is worth spending time on this. |
I should have been more precise. The discussion here is about whether to represent a moment vs. not-a-moment. By “moment” I mean a specific point on the timeline, that isn't necessarily expressed by a date, but rather the duration since measuring time. By “not-a-moment” I mean a date with a time-of-day, but lacking the context of a time zone or offset from UTC. JDBC doesn't specify a mapping for
And that is what we're doing already. We've documented the type mapping. If you want to convert a temporal type to a different one, then your application (or a converter within a Framework) is the right place to manifest your assumptions, not the driver. That being said, I'm fine adding a reading codec that turns |
Ok. Since seems that I will not convince you - your remarks are also good and valid. In my current project, as a solution, my colleagues introduced But I see lots of damage that can happen if using This is my story. Let's wrap it up. MSSQL has no good storate type to "natively" support This is good ground for my second proposal, that I had in my pocket from the start - allow to add custom project For me, this is a natural direction of @mp911de WDYT? I could add some nice code for this. Daj szansę ;-) |
As of now, our codecs support isn't complete. We're missing support for more complex types such as SQL variant that will likely require changes to our codec registry. Once that is in place, we can evaluate opening up our codec registry. |
Hi.
I run into this problem in my project. I can support you with relevant info and code, to get this done.
We need this codec as java.time.Instant is modern type for storing datetime when using machine-to-machine communication.
The problem is to choose which store type to use.
Use datetimeoffset in this case is tempting but I'd not use it. The reason is that we're aiming to store Instant as date time in UTC timezone only. So we have fixed TZ. Using datetimeoffset allows to define or put data in different timezone than UTC.
Using datetime2 is the best approach. It does not declare TZ explicitly but here we have only one possible TZ and it's UTC.
The way datetime2 works is taking datetime as it is, with trimming Z that denotes TZ. It's simply omitted. And this is what we need taking java.time.Instant as an input.
@mp911de
I can provide working Codec for this but I need your approval and agreement on this.
The text was updated successfully, but these errors were encountered: