DapperLib / DapperLib/Dapper.Contrib
Dapper Contrib Insert Update not working
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 293
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
when i update dapper and contrib libs in to latest which is 1.50.4 Insert, Update throws exception. so i downgraded to Dapper in to 1.50.2 and Contrib in to 1.50.0 then works fine.
this is the exception that i'm getting
MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1s () values ()' at
line 1 at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at
MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow,
Int64& insertedId) at
MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean
force) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior
behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition&
command) in C:\projects\dapper\Dapper\SqlMapper.cs:line 552 at
Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param,
IDbTransaction transaction, Nullable1 commandTimeout, Nullable1
commandType) in C:\projects\dapper\Dapper\SqlMapper.cs:line 443 at
MySqlAdapter.Insert(IDbConnection connection, IDbTransaction
transaction, Nullable1 commandTimeout, String tableName, String columnList, String parameterList, IEnumerable1 keyProperties, Object
entityToInsert) in
C:\projects\dapper\Dapper.Contrib\SqlMapperExtensions.cs:line 897at
Dapper.Contrib.Extensions.SqlMapperExtensions.Insert[T](IDbConnection
connection, T entityToInsert, IDbTransaction transaction, Nullable1 commandTimeout) in C:\projects\dapper\Dapper.Contrib\SqlMapperExtensions.cs:line 355
at RecruiterinsiderPortal.Data.AgencyRegionRepository.Save(Int32 userId, List`1 regions) in C:\Empite\RI\RecruiterinsiderPortal\RecruiterinsiderPortal\libs\RecruiterinsiderPortal.Data\AgencyRegionRepository.cs:line 67
thanks
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 with MySqlAdapter.Insert in SqlMapperExtensions.cs at line 897 and the Insert extension at line 355. Reproduce the exception using the reported Dapper and Dapper.Contrib versions and inspect the generated SQL around the invalid '1s () values ()' syntax. Done means Insert and Update work with the affected MySQL setup, with a regression test covering the failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, mysql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100