-
Couldn't load subscription status.
- Fork 3.3k
[WIP] SQLite: Enable TimeSpan #19617
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
Conversation
src/EFCore.Sqlite.Core/Query/Internal/SqliteMemberTranslatorProvider.cs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
src/EFCore.Sqlite.Core/Storage/Internal/SqliteRelationalConnection.cs
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
|
Got all the kinks worked out! Just need to write a bunch of tests now. 😁 |
|
🤔 Hmm, where did I get to on this... I think I ran into floating-point precision issues and wanted to re-examine how we handle TimeSpan and DateTime literals and parameters on SQLite. |
|
Yep. In order to get this to round to the correct time we need to re-create the TimeSpan (and possibly DateTime) instances in various places using a constructor overload that doesn't take |
We can enable these by registering two UDFs on the connection:
The following translations are enabled.
Notes:
datetime()is actually be translated asrtrim(rtrim(strftime('%Y-%m-%d %H:%M:%f'), '0'), '.')julianday(datetime(text, modifiers))is reduced tojulianday(text, modifiers)julianday(datetime(real))is reduced torealef_days(ef_timespan(real))is reduced torealFixes #18844