[ODBC-350] Invalid BIT column value from subselect Created: 2022-01-21  Updated: 2023-06-02  Resolved: 2023-06-02

Status: Closed
Project: MariaDB Connector/ODBC
Component/s: General
Affects Version/s: 3.1.15
Fix Version/s: 3.1.19, 3.2.1

Type: Bug Priority: Major
Reporter: Marek Šrom Assignee: Lawrin Novitsky
Resolution: Fixed Votes: 0
Labels: None
Environment:

Windows server 2012 R2


Attachments: File test.vbs    
Issue Links:
Relates
relates to MDEV-31392 Server returns string inerpretation o... Open

 Description   

ODBC connector returns wrong value of BIT column when it is selected by subselect like:

CREATE TABLE aaa (x bit);
INSERT INTO aaa VALUES(0);

SELECT X, (SELECT x FROM aaa LIMIT 1) FROM aaa;

result:
false, true //should be false, false

Tested via ADODB... Simple test attached...



 Comments   
Comment by Marek Šrom [ 2022-05-03 ]

Hello, I'd like to ask if there will be some progress with this issue... Thanks

Comment by Lawrin Novitsky [ 2022-05-03 ]

Sorry, I'll take a look at it this week

Comment by Lawrin Novitsky [ 2022-05-04 ]

I will look more into this, but somehow that is what connector gets from the server. For first column it's \0, for 2nd - "0". You can see the same picture if you run the query in the mariadb command line client.
I will also talk to server guys. Maybe that is their bug, or maybe that is something expected

Comment by Lawrin Novitsky [ 2022-05-04 ]

And character '0' is rendered as true for bit type since the byte is not zero

Comment by Lawrin Novitsky [ 2023-06-02 ]

I've workarounded, that I think is the server problem, in the driver

Generated at Thu Feb 08 03:28:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.