Skip to content
New issue

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

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

Already on GitHub? # to your account

SQLite: Translate more DateOnly and TimeOnly members #25103

Open
Tracked by #22950
bricelam opened this issue Jun 15, 2021 · 4 comments
Open
Tracked by #22950

SQLite: Translate more DateOnly and TimeOnly members #25103

bricelam opened this issue Jun 15, 2021 · 4 comments
Labels
area-query area-sqlite punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Milestone

Comments

@bricelam
Copy link
Contributor

bricelam commented Jun 15, 2021

In addition to adding the corresponding TimeOnly translations listed in issue #18844, here are some additional members we could translate:

.NET SQL
DateOnly.FromDateTime(dateTime) date($dateTime)
date.ToDateTime(time) $date || ' ' || $time
TimeOnly.FromDateTime(dateTime) time($dateTime)
TimeOnly.FromTimeSpan(timeSpan) $timeSpan
time.Add(timeSpan) time(ef_days($time) + ef_days($timeSpan))
time.IsBetween(start, end) ef_days($time) BETWEEN ef_days($start) AND ef_days($end)
time.ToTimeSpan() $time

❗ Important: These translations are currently over-simplified. We need to think more about precision and day-wrapping.

See also #24506 (comment)

@roji
Copy link
Member

roji commented Jun 15, 2021

Careful with BETWEEN and inclusivity/exclusivity. I checked this on PG, where BETWEEN is inclusive on both sides. IIRC the .NET version is exclusive on the end side, so not good. And yeah, day-wrapping isn't trivial.

@roji
Copy link
Member

roji commented Dec 15, 2021

Note: implemented these in PG (npgsql/efcore.pg#2151), some tests can probably be taken from there.

@ajcvickers ajcvickers added punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. and removed propose-punt labels Apr 23, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Apr 23, 2022
@briangtn
Copy link

briangtn commented Oct 17, 2022

Is there an existing issues for same translations in SQLServer ? @ajcvickers

@roji
Copy link
Member

roji commented Oct 17, 2022

@briangtn #24507 tracks supporting DateOnly/TimeOnly on SQL Server. Note that that's blocked on dotnet/SqlClient#1009.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-query area-sqlite punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Projects
None yet
Development

No branches or pull requests

5 participants