OleDb parameter replacement broken?
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
I am having issues with parameter replacements with OleDb. Code is provided below. Hopfully I'm just doing something wrong, but not sure.
Query:
select distinct
PLITM as ItemNumber
from SomeSchema.F564501
JOIN SomeSchema.F564541 ON CLY56BKY = PLY56BKY
LEFT JOIN SomeSchema.F564540 ON SPITM = PLITM AND CLAN8 = SPAN8
WHERE PLUORG = 1 AND CLAN8 = ?RetailerId? AND PLITM IN ?ItemNumbers?
Code:
IEnumerable<DbModels.Pricing> prices = connection.Query<DbModels.Pricing>(sql,
new
{
RetailerId = request.RetailerId, //int
ItemNumbers = itemNumbers //List<int>, if it helps there are two ints in the list
});
Using Mini Profiler the resulting sql and parameters
Parameters:
DECLARE @RetailerId int = 1;
Sql:
select distinct
PLITM as ItemNumber
JOIN SomeSchema.F564541 ON CLY56BKY = PLY56BKY
LEFT JOIN SomeSchema.F564540 ON SPITM = PLITM AND CLAN8 = SPAN8
WHERE PLUORG = 1 AND CLAN8 = ? AND PLITM IN (?, ?) ;
All that being noted, It will work if i comment out lines 1757 through 1765 in SqlMapper. Let me know if you need anymore info.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SqlMapper lines 1757-1765 and reproduce the reported OleDb query with RetailerId and ItemNumbers. Done means parameter replacement produces valid SQL and binds both values as intended, with the behavior verified against the supplied example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100