DapperLib / DapperLib/Dapper

SqlMapper.GridReader.IsConsumed should return true if stored procedure does not return any recordsets

Open
#751 10 comments 4 reactions 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

SqlMapper.GridReader.IsConsumed should return true if stored procedure does not return any recordsets. This can happen e.g. when stored procedure executes a select in a loop, and number of loop iterations depends on passed arguments. If there were zero iterations, stored procedure will return no recordsets, and the loop like below will throw an exception "No columns were selected" when calling GridReader.Read():

SqlMapper.GridReader gridReader = connection.QueryMultiple(...);
while (!gridReader.IsConsumed)
{
	//do something with gridReader.Read();
}

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 at the SqlMapper.GridReader.IsConsumed entry point and trace how QueryMultiple represents a stored procedure that returns no recordsets. Compare that state with the GridReader.Read() call in the example, then add coverage showing that the loop exits without the "No columns were selected" exception; no file or test path is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.