Skip to content

Correct type mappings for .NET numeric types #128

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

staticlibs
Copy link
Collaborator

This PR correct the type mapping changing the ODBC type to SQL_DECIMAL for the following DuckDB types:

  • UBIGINT
  • HUGEINT
  • UHUGEINT
  • DECIMAL

.NET CLS type for these DB types is now System.Decimal.

Testing: new test-suite is added using dotnet on Linux. Currently it only covers the type mapping from OdbcConnection to .NET CLS types. It overlaps with existing Windows dotnet test-suite, but it appeared challenging to iterate over Windows dotnet due to long compile times on Windows. New test-suite is confirmed to work on Ubuntu-22.04 and Fedora. It is added to ODBC Tests CI run.

Fixes: #93

This PR correct the type mapping changing the ODBC type to
`SQL_DECIMAL` for the following DuckDB types:

 - `UBIGINT`
 - `HUGEINT`
 - `UHUGEINT`
 - `DECIMAL`

.NET CLS type for these DB types is now `System.Decimal`.

Testing: new test-suite is added using `dotnet` on Linux. Currently
it only covers the type mapping from `OdbcConnection` to .NET CLS types.
It overlaps with existing Windows `dotnet` test-suite, but it appeared
challenging to iterate over Windows `dotnet` due to long compile times
on Windows. New test-suite is confirmed to work on Ubuntu-22.04 and
Fedora. It is added to `ODBC Tests` CI run.

Fixes: duckdb#93
Copy link
Collaborator

@maiadegraaf maiadegraaf left a comment

Choose a reason for hiding this comment

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

Thanks for adding the correct mappings. The testing looks good, and is a good start for further .NET testing!

@maiadegraaf maiadegraaf merged commit 1d23172 into duckdb:main May 13, 2025
7 checks passed
@staticlibs staticlibs deleted the dotnet_type_mapping branch May 13, 2025 16:56
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 this pull request may close these issues.

DuckDB ODBC Driver Misaligns Data Types with OLEDB
2 participants