Bug #108190 ODBC SQLGetData return wrong value
Submitted: 18 Aug 2022 13:02 Modified: 3 May 2023 7:02
Reporter: lou shuai (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:8.0.30 OS:Any
Assigned to: CPU Architecture:x86

[18 Aug 2022 13:02] lou shuai
Description:

SQLExecDirect(stmt, (SQLCHAR *)"select 1, -1", SQL_NTS); 

SQLGetData(stmt, 2, SQL_C_SLONG, &li, sizeof(li), &indicator);
will set li = 4294967295

How to repeat:
ODBC version: mysql-connector-odbc-8.0.30-linux-glibc2.27-x86-64bit.tar.g
mysql version: 8.0.29

/etc/odbc.ini
```
louis@greatdb ➜  /etc cat odbc.ini
[sqllogictest]
Driver=MySQL ODBC 8.0 Unicode Driver
SERVER=127.0.0.1
PORT=6666
DATABASE=test
USER=greatdb
PASSWORD=greatdb
NO_SCHEMA=1
nossps=1
TraceFile = /tmp/odbc.trace
Trace     = 1
OPTION = 3
DISABLE_SSL_DEFAULT=1
SSLMODE=DISABLED
```

/etc/odbcinst.ini

```
[MySQL ODBC 8.0]
Driver=/usr/local/lib/libmyodbc8a.so
UsageCount=1

[MySQL ODBC 8.0 Unicode Driver]
Driver=/usr/local/lib/libmyodbc8w.so
UsageCount=1
```

mysql.c test in attachment.

compile:
```
 gcc -g -o test mysql.c -lodbc

``
[18 Aug 2022 13:02] lou shuai
the odbc test file

Attachment: mysql.c (application/octet-stream, text), 2.47 KiB.

[18 Aug 2022 13:02] lou shuai
the odbc test file

Attachment: mysql.c (application/octet-stream, text), 2.47 KiB.

[25 Aug 2022 2:54] lou shuai
Is this an ODBC bug or my program use ODBC in the wrong way?
[5 Sep 2022 2:52] lou shuai
how's the progress?
[3 May 2023 7:02] MySQL Verification Team
Hello lou shuai,

Thank you for the bug report and details.
I am not able to reproduce the issue with odbc test file attached.
Please upgrade to latest version 8.0.33 and let us know if you are still facing the issue.

Regards,
Ashwini Patil