Bug #47760 Bit Type is allways True (-1)
Submitted: 1 Oct 2009 11:04 Modified: 1 Oct 2009 11:34
Reporter: Arno Freisinger Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:5.1.5 OS:Microsoft Windows
Assigned to: CPU Architecture:Any

[1 Oct 2009 11:04] Arno Freisinger
Description:
Fieldtype "BIT" is not koorekt with ODBC Connector V5.1.5

Access 2007 always 0

Delphi 5-2010 always True

How to repeat:
Sample:

CREATE TABLE test (
  id int(11) NOT NULL default '0',
  test bit,
  PRIMARY KEY  (id)
);

Insert Data:
Insert into test (id,test) values (1,0);
Insert into test (id,test) values (2,1);
Insert into test (id,test) values (3,0);
Insert into test (id,test) values (4,1);
Insert into test (id,test) values (5,0);
Insert into test (id,test) values (6,1);
Insert into test (id,test) values (7,NULL);
Insert into test (id,test) values (8,0);

View with MySQL Query Browser (OK):

select * from test
order by id

"id","test"
1,b'0'
2,b'1'
3,b'0'
4,b'1'
5,b'0'
6,b'1'
7,
8,b'0'

View with Access 2007 and ODBC V5.1.5 Vista 32:

id;test
1;0
2;0
3;0
4;0
5;0
6;0
7;
8;0

View with Delphi and ODBC V5.1.5 Vista 32:

id;test
1;True
2;True
3;True
4;True
5;True
6;True
7;
8;True
[1 Oct 2009 11:34] Tonci Grgin
Hi Arno and thanks for your report.

Unfortunately, mapping to SQL_C_BIT *is* broken in c/ODBC 5.1 but patch is pending. This is a duplicate of bug#39644 so you are free to see discussion there and in bug#36470.