-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dapper fails on MySql nullable bool #552
Comments
OK; I will have a look this morning and see if I can spot the problem. It
|
It looks like it should work fine. I can look, but I will need to install
Marc
|
Marc, I agree, this stuck me as odd as well. I have tried it with the most current version. Currently have dapper.1.50.0-rc3 installed. I can provide a stripped down solution if it helps. Thanks for your help! |
The example you have should be fine; my blocker is simply that I've just On Fri, 8 Jul 2016 09:06 RobRolls, [email protected] wrote:
|
Hi, I have exactly the same issue, but I use byte? instead of bool. Thanks |
@bastiflew can you confirm the exact error message when it happens to you? In particular, the bit in brackets |
(the good news is that I have MySQL up and running on my new OS build, so I can actually investigate this now) |
@mgravell the message : "Error parsing column 10 (svc_desynchro=0 - SByte)"} |
Well shoot, the problem here is that MySQL lies initially, and changes its mind about the schema in the middle of iterating it. I cannot stress just how horribly broken this is - an epic bug in the mysql data provider. It is not meant to do this. I'll have to see whether dapper can work around it somehow. But to illustrate with what the reader reports 1) initially, 2) after the first row (null), and 3) after the second row (non-null):
The thing to call out there is where the schema changes from |
I've had a suggestion (from someone else equally frustrated by the mysql connector) to try using the mysql connector of devart instead; apparently it is far less broken! I cannot vouch for this myself, as I am not a mysql user (except for debugging things): https://www.devart.com/dotconnect/mysql/ |
I've logged this as a bug against the mysql connector: http://bugs.mysql.com/bug.php?id=82292 |
I've forwarded this to the correct person. We'll look at this right away. This should be happening. |
Thanks for your efforts. I will change from MySQL .NET to DevArt Express until this issue is fixed. |
Adapted from a bug reported against the official connector at DapperLib/Dapper#552.
Shameless plug: You can also avoid this error by switching to https://github.com/mysql-net/MySqlConnector. When I was developing its code, I ran across MySQL bug 78917 which seems to be the same underlying issue. (But just to be sure, I added a new test to verify the behaviour doesn't repro.) |
@bgrainger thanks; fully agree that this is a duplicate of 78917 - good catch. Will update on my bug. The existing one deserves to be primary. |
@mgravell I understand that the error is coming from the MySQL connector, but are there any news regarding this error? Any workaround whatsoever? I have tried this StackOverflow solution (changing from I tried @bgrainger solution, but I had problems using it (see issue here), plus it lacked the Edit: added MySqlConnector issue link |
connectionString :Treat Tiny As Boolean=false; |
I would advise against this, because now any Instead, my advice remains to switch to https://github.com/mysql-net/MySqlConnector (NuGet). |
@bgrainger I can confirm. I've been using MySqlConnector since I had the problem, and it works like a charm. In the beginning I was wary because of |
Closing this out since it's a provider issue, and changing providers resolves it. |
For anyone affected by this who wants to stick with |
The fix is also in 8.0.12, according to the release notes. |
Dapper is throwing an error when I try to use a nullable bool with MySql.
It only breaks when a statement follows the null value insert statement.
An additional note, it works fine if I manually change the size of IsBold from tinyint(1) (the default created by BOOLEAN) to 2 or greater.
The text was updated successfully, but these errors were encountered: