Bug #37118 bit(1) mapped to boolean, data wrong
Submitted: 31 May 2008 13:48 Modified: 2 Jun 2008 7:31
Reporter: Gerald Schade Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:5.1.4. OS:Windows (Windowx XP SP2 and 3)
Assigned to: CPU Architecture:Any
Tags: bit column, bit columns, Data Type, data types, MAPPING

[31 May 2008 13:48] Gerald Schade
Description:
in Visual Basic 6.0, using an ADO recordset a bit(1) column is translated into boolean. Irrespective of its content in the database table, the recordset field returns "true".
This does not happen with the odbc connector 3.51.

How to repeat:
Connection string:

"Provider=MSDASQL.1;Extended Properties="DRIVER={MySQL ODBC 5.1 Driver};UID=praxis;PWD=...;server=LINUX;option=3;database=kvaerzte;"

MySQL 5.1.23-rc-database containing the table hae created by:

CREATE TABLE  `kvaerzte`.`hae2` (
  `DBNr` varchar(7) COLLATE latin1_german2_ci NOT NULL DEFAULT '',
   ...
  `gelöscht` bit(1) DEFAULT NULL,
   ...
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci;

containing a row with dbnr = '6307824' and gelöscht = b'0'.

VB6-Code:
...
Dim cn as new ADODB.Connection
Dim hae as new ADOBB.Recordset
cn.open
hae.open "select * from hae2 where DBNr = '6307824' and gelöscht = 0", cn, adOpenStatic, adLockOptimistic
if not hae.bof then
 debug.print hae!gelöscht
endif
...
returns "true"

Suggested fix:
either don't map bit(1) to boolean or translate 0 into "false" and 1 into "true" like in ODBC driver 3.51
[2 Jun 2008 7:31] Tonci Grgin
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Explanation: Hi Gerald and thanks for your report. This is a duplicate of Bug#36470 which is already verified.