Bug #77350 | BIT type returns inconsistent string data | ||
---|---|---|---|
Submitted: | 14 Jun 2015 23:36 | Modified: | 25 Jan 2016 9:27 |
Reporter: | Eion Robb | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | Connector / ODBC | Severity: | S3 (Non-critical) |
Version: | 5.3.2 | OS: | Windows (32bit ANSI) |
Assigned to: | CPU Architecture: | Any |
[14 Jun 2015 23:36]
Eion Robb
[18 Jun 2015 7:40]
Chiranjeevi Battula
Hello Eion Robb, Thank you for the bug report. I tried to reproduce the issue at my end using PHP and Connector / ODBC 5.3.2 / 5.3.4 32 bit ANSI but couldn't trace out any issue reading BIT values. here is clearly described in the manual about BIT fields https://dev.mysql.com/doc/refman/5.6/en/bit-field-literals.html Thanks, Chiranjeevi.
[13 Jul 2015 3:19]
Eion Robb
What version of PHP were you testing with? We're testing on PHP 5.2 and 5.3. Also, you should have pointed me to https://dev.mysql.com/doc/refman/5.6/en/boolean-literals.html - the 'BIT' type in ODBC would be equivalent to a Boolean in MySQL - see https://msdn.microsoft.com/en-us/library/ms710150(v=vs.85).aspx
[13 Jul 2015 4:25]
Eion Robb
So digging some more, I guess the problem is: The driver reports (via SQLGetTypeInfo) that the MySQL 'BIT' type is the ODBC 'BIT' type, which is incorrect, it's closer to a binary than what ODBC defines a 'BIT' as. The driver also doesn't provide MySQL's 'BOOLEAN' type as a 'BIT' which would be a closer match. (See the footnote [8] of https://msdn.microsoft.com/en-us/library/ms710150(v=vs.85).aspx which says "The SQL_BIT data type has different characteristics than the BIT type in SQL-92." ) In our particular use-case, the flow-on effect is that boolean data stored in this field is converted to a binary string by the copy_binary_result() function, instead of returned as a number/boolean format as it went in.
[25 Jan 2016 9:27]
Chiranjeevi Battula
Hello Eion Robb, Thank you for your feedback. Verified based on internal discussion with dev's, take it as a Feature Request. Thanks, Chiranjeevi.