Bug #43646 | Default values for bit(1) fields displayed incorrectly | ||
---|---|---|---|
Submitted: | 14 Mar 2009 9:47 | Modified: | 16 Apr 2009 18:36 |
Reporter: | Arcadiy Fedushin | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | Connector / NET | Severity: | S3 (Non-critical) |
Version: | 1.1.2 Alpha | OS: | Any |
Assigned to: | Assigned Account | CPU Architecture: | Any |
Tags: | Visual Studio plugin bit binary default values |
[14 Mar 2009 9:47]
Arcadiy Fedushin
[14 Mar 2009 13:48]
Peter Laursen
I think this is espected behaviour! CREATE TABLE `bittest` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `txt` VARCHAR(10) DEFAULT NULL, `bin1` BIT(1) DEFAULT NULL, `bin2` BIT(8) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=utf8; INSERT INTO `bittest`(`id`,`txt`,`bin1`,`bin2`) VALUES ( NULL,'a',b'1',b'01111000'); SELECT * FROM bittest; /* returns id txt bin1 bin2 ------ ------ ------ ------ 1 a x or id txt bin1 bin2 ------ ------ ------ ------ 1 a <symbol> x .. all depending on how the client environment treats a '1' binary string. */ .. AND note that b'01111000' is 'x' ASCII character and that is what is displayed! And the ASCII-character corresponding b'1' is a non-printable character. http://dev.mysql.com/doc/refman/5.0/en/bit-field-values.html "Bit values are returned as binary values. To display them in printable form, add 0 or use a conversion function such as BIN()." And also you will need to enter them a binary values (the string " '1' " is not the same as the binary number " b'1' ". That said using the MySQL BIT type is an annoyance with any graphical environment (at least). A TINYINT is most often a better option. A good summary of problems here: http://www.xaprb.com/blog/2006/04/11/bit-values-in-mysql/ Peter (not a MySQL person)
[14 Mar 2009 14:56]
Arcadiy Fedushin
The summary of problem you gave is VERY interesting, thank you! I met similar problems - to be read (by PHP) a bit field needs conversion to UNSIGNED inside MySQL query... Let's hope BIT bugs & problems in MySQL will be solved. For this it's better to improve working with BIT than just to say 'BIT type is an annoyance'. Why not to support correct operating with BIT in MSVS GUI? And start with bit(1), as the most required.
[16 Mar 2009 18:36]
Tonci Grgin
Hi Arcadiy and thanks for your report. You do not file feature request against plug-in, it's integral part of connector now. So please change the Version field so I know what to test against.
[18 Mar 2009 22:33]
Tonci Grgin
Probably duplicate of your Bug#43653. See my comments there.
[16 Apr 2009 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".