Unable to reuse TempTable created when also sending params into the execute
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
If you add a param in the same call that creates the temp table then the temp table won't be accessible in future calls. This is a very strange behavior we came across today.
This works fine:
connection.Open();
await connection.ExecuteAsync(
@"create table #foo (val int not null);
insert #foo (val) values (123)");
await connection.ExecuteAsync(@"insert #foo (val) values (111)");
var vals = await connection.QueryAsync<int>(@"select * from #foo");
This fails. The error is that the temp table #foo doesn't exist.
connection.Open();
await connection.ExecuteAsync(
@"create table #foo (val int not null);
insert #foo (val) values (@InsertDate)", param: new { InsertDate = insertDate2 });
await connection.ExecuteAsync(@"insert #foo (val) values (111)");
var vals = await connection.QueryAsync<int>(@"select * from #foo");
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 by reproducing the two ExecuteAsync sequences from the issue against the Dapper API, comparing the parameterized and non-parameterized cases. Trace the execution path used when params is supplied and verify that the temporary table remains available to subsequent calls; done means both examples can insert and query #foo successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100