DapperLib / DapperLib/Dapper

varchar2[1] null does not map to Char ascii value "0"

Open
#1,717 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

In Oracle there is a varchar2[1] column which is defined as a Char property in the data structure.
If the data is read, it does not convert null to ASCII 0 (zero) for the Char, it instead throws an Exception.

System.Data.DataException: Error parsing column 7 (TYPE=) ---> System.ArgumentNullException: Value cannot be null.
Parameter name: value
at Dapper.SqlMapper.ReadChar(Object value) in /_/Dapper/SqlMapper.cs:line 1878

This seems incongruous with Dapper converting a null to 0 (zero) for a numeric data type(s).

Please update Dapper to allow a null to be converted to ascii 0 (zero) for a Char property.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in SqlMapper.cs around line 1878, where ReadChar is named in the exception, and trace the existing null conversion behavior for mapped values. Confirm the requested varchar2[1] null-to-ASCII-0 behavior and verify the change with the relevant existing test coverage or test suite.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend-api-design, databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.