1

In my setup, I have a tinyint(1) column in mysql database table. I populated it with -1 but when I fetch the values via C# EF framework, the values were coming out to be +1.

gawkface
  • 2,104
  • 2
  • 27
  • 29

1 Answers1

1

Turns out this a known bug "behaviour" with tinyint if connection string does not explicitly mention not to convert tinyint negative to boolean as per https://bugs.mysql.com/bug.php?id=33044.

Edit as pointed by @ysth : the link is talking about different toolset but I guess the outcome is same for my toolset

gawkface
  • 2,104
  • 2
  • 27
  • 29
  • 1
    that bug is about the migration toolkit. the mention of the connection string is about the jdbc connector, which I'm guessing it uses. it sounds like the dotnet connector has a similar "feature". – ysth Jun 30 '22 at 02:48
  • @ysth yeah I assumed dotnet can also leverage similar parameter in the connection string - but I did not debug by altering my connection string etc. I missed the part (& thanks for digging in) that the bug report is for migration toolkit - I was using EF framework dealing with a simple fetch of the tinyint column – gawkface Jun 30 '22 at 22:45
  • 1
    note that just selecting (0+yourcolumn) likely works around the client "feature" – ysth Jun 30 '22 at 22:52