Bug #108452 SQLGetData returns SQL_SUCCESS_WITH_INFO for bit columns
Submitted: 9 Sep 2022 16:33 Modified: 19 Apr 2024 18:23
Reporter: Mingwei Liu Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:8.03.00.00 OS:Windows (11)
Assigned to: CPU Architecture:Any (64)

[9 Sep 2022 16:33] Mingwei Liu
Description:
SQLGetData now will return SQL_SUCCESS_WITH_INFO instead of SQL_SUCCESS for bit columns if BufferLength is set to 0. Not sure if this is a bug or on purpose.

How to repeat:
Step 1: Generate data using following code:

CREATE SCHEMA `mytestdb1`;
CREATE TABLE `mytestdb1`.`mytesttable1` (
  `myint1` INT NOT NULL,
  `mybit1` BIT(1) NOT NULL,
  PRIMARY KEY (`myint1`));
INSERT INTO `mytestdb1`.`mytesttable1` (`myint1`, `mybit1`) VALUES ('1', 0);
INSERT INTO `mytestdb1`.`mytesttable1` (`myint1`, `mybit1`) VALUES ('2', 1);

Step 2: Using query

SELECT mybit1 FROM mytestdb1.mytesttable1

Then SQLExecDirect, SQLFetch, and SQLGetData with TargetType = SQL_C_BIT and BufferLength = 0.

SQLGetData will return SQL_SUCCESS_WITH_INFO in 8.0.30. In 8.0.11 it returns SQL_SUCCESS.
[7 Nov 2022 10:55] MySQL Verification Team
Hello Mingwei Liu,

Thank you for the bug report.
Could you please provide repeatable test case (code, sample project, etc. - please make it as private if you prefer) to confirm this issue at our end?

Regards,
Ashwini Patil
[17 Apr 2024 12:32] MySQL Verification Team
Hello Mingwei Liu,

Thank you for the details. However this is not enough to reproduce the issue.
Please upgrade to latest version and report us back if issue persist even in latest version along with test case. Thank you.

Regards,
Ashwini Patil
[19 Apr 2024 18:23] Mingwei Liu
Hi Ashwini,

I've tried using the latest generally released connector (MySQL ODBC 8.3 Unicode Driver, version 8.03.00.00) but can still see the problem.

For your convenience, I attached the latest log from Microsoft® ODBC Test application (Unicode, amd64) when I saw the issue:

	Full Connect(Default)

	Env. Attr. SQL_ATTR_ODBC_VERSION set to SQL_OV_ODBC3

	Successfully connected to DSN 'MySQL8.3DSN'.

SQLExecDirect:
				In:				Statementhandle = 0x00000000024A5430, StatementText = "SELECT mybit1 FROM mytestdb1.mytesttable1", Statementlength = 41
				Return:	SQL_SUCCESS=0

SQLFetch:
				In:				StatementHandle = 0x00000000024A5430
				Return:	SQL_SUCCESS=0

SQLGetData:
				In:				Statementhandle = 0x00000000024A5430, ColumnNumber = 1, TargetType = SQL_C_BIT=-7, TargetValuePtr = 0x00000000023FA750, 
										BufferLength = 0, StrLen_or_IndPtr = 0x00000000023F0270
				Return:	SQL_SUCCESS_WITH_INFO=1
				Out:			*TargetValuePtr = <unmodified>, *StrLen_or_IndPtr = 1
				TST1001: Buffer TargetValuePtr was not updated.

Thank you.