DapperLib / DapperLib/Dapper.Contrib
Contrib Error inserting into a table having an Identity and a Computed columns
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
The insert error is:
System.Data.SQLite.SQLiteException: SQL logic error
near ")": syntax error
Apparently, the culprit is the following command
var cmd = $"INSERT INTO {tableName} ({columnList}) VALUES ({parameterList}); SELECT last_insert_rowid() id";
which is part of the Insert function of the Contrib SQL Mapper Extensions for the SQLite implementation. Because both fields are auto-generated, the column and parameter lists are empty and the command fails.
The following command does work:
INSERT INTO [<table name>] Default Values;
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 SQLite implementation's Contrib SQL Mapper Extensions Insert function and inspect how columnList and parameterList are assembled. Reproduce the case where both lists are empty and verify the generated-insert path against SQLite's DEFAULT VALUES syntax. Done means inserts succeed for a table containing only Identity and Computed columns and the generated id is returned.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100