praeclarum / praeclarum/sqlite-net
Select last row id always returns 0.
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
public async Task<int> InsertAsync (App app)
{
await db.ExecuteAsync ("insert into app (name, icon_url, home_page_url)" +
"values (?, ?, ?)", app.name, app.iconUrl, app.homePageUrl);
int id = await db.ExecuteScalarAsync<int> ("select last_insert_rowid();");
return id; // Returns the id of the the object being inserted.
}
id will always return 0. Using the nonasync version returns the correct id number.
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 the InsertAsync method shown in the issue and trace ExecuteScalarAsync for the last_insert_rowid() query, comparing it with the working nonasync path. Reproduce the asynchronous case and confirm that the method returns the inserted row's id rather than 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sqlite
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100