Skip to content

Read TimeOnly values stored as REAL in Microsoft.Data.Sqlite - #39227

Merged
AndriySvyryd merged 1 commit into
dotnet:mainfrom
ilkertskn:fix/sqlite-timeonly-read-real
Oct 14, 2026
Merged

AndriySvyryd merged 1 commit into
dotnet:mainfrom
ilkertskn:fix/sqlite-timeonly-read-real

Conversation

@ilkertskn

Copy link
Copy Markdown
Contributor

SqliteValueBinder writes TimeOnly as a fraction of a day when the parameter is SqliteType.Real, but SqliteDataReader.GetFieldValue only parsed text, so reading such a value back threw a FormatException. GetDateOnly and GetTimeSpan already handle FLOAT/INTEGER; do the same for TimeOnly.

  • [x ] I've read the guidelines for contributing and seen the walkthrough
  • [x ] I've posted a comment on an issue with a detailed description of how I am planning to contribute and got approval from a member of the team
  • [x ] The code builds and tests pass locally (also verified by our automated build checks)
  • [x ] Commit messages follow this format:
        Summary of the changes
        - Detail 1
        - Detail 2

        Fixes #bugnumber
  • [x ] Tests for the changes have been added (for bug fixes / features)
  • [x ] Code follows the same patterns and style as existing code in this repo

SqliteValueBinder writes TimeOnly as a fraction of a day when the parameter
is SqliteType.Real, but SqliteDataReader.GetFieldValue<TimeOnly> only parsed
text, so reading such a value back threw a FormatException. GetDateOnly and
GetTimeSpan already handle FLOAT/INTEGER; do the same for TimeOnly.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved issues were identified, and all approval assessments indicate readiness.

0 open findings

What changed in this PR

Adds support for reading TimeOnly values stored as SQLite numeric day fractions.

Changes:

  • Converts REAL/INTEGER values to TimeOnly.
  • Adds numeric and round-trip test coverage.
File Description
src/​Microsoft.Data.Sqlite.Core/​SqliteValueReader.cs Adds numeric TimeOnly conversion.
test/​Microsoft.Data.Sqlite.Tests/​SqliteDataReaderTest.cs Adds numeric and round-trip tests.

🧠 Review effort: Lite


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@AndriySvyryd AndriySvyryd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your contribution!

@AndriySvyryd
AndriySvyryd merged commit 9f804de into dotnet:main Oct 14, 2026
19 of 20 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants