Bug #108387 SQLColumns return unexpected BUFFER_LENGTH with previous version
Submitted: 5 Sep 2022 13:42 Modified: 28 Sep 2022 2:32
Reporter: qingshun luo Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:8.0.30 OS:CentOS
Assigned to: CPU Architecture:x86
Tags: NO_I_S, SQLColumns

[5 Sep 2022 13:42] qingshun luo
Description:
With mysql-connector-odbc diver 5.3.10, SQLColumns return BUFFER_LENGTH, witch I can treat as enough byte length for column value, even connect with different charset.

But during test with mysql-connector-odbc diver 8.0.30, SQLColumns return different BUFFER_LENGTH for the same table structure.

My test table:

```
CREATE TABLE `test_gbk` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;
```

1. When connect string is "DSN=myodbc8w;DRIVER={/home/qsdb/code/install/mysql-connector-odbc/lib/libmyodbc8w.so};SERVER=127.0.0.1;port=60017;DATABASE=test;UID=test;PASSWORD=test;CharSet=ut
f8mb4;Protocol=TCPIP;"

SQLColumns return:

column:id, type:int, buffer_len:4
column:name, type:varchar, buffer_len:200

2. Add no_i_s=1, connect string is "DSN=myodbc8w;DRIVER={/home/qsdb/code/install/mysql-connector-odbc/lib/libmyodbc8w.so};SERVER=127.0.0.1;port=60017;DATABASE=test;UID=test;PASSWORD=test;CharSet=
utf8mb4;Protocol=TCPIP;no_i_s=1;"

SQLColumns return:

column:id, type:integer, buffer_len:4
column:name, type:varchar, buffer_len:800

How to repeat:
Test SQLColumns with driver 8.0.30.

Suggested fix:
Here buffer_len 800 for the column <name> seems a safe value. Remain the same return  with diver 5.3.10 may avoid some trouble.
[5 Sep 2022 13:43] qingshun luo
Simple test code

Attachment: test-code.tar.gz (application/x-gzip, text), 2.56 KiB.

[27 Sep 2022 12:20] MySQL Verification Team
Hello Qingshun Luo,

Thank you for the bug report.
Discussed your issue with Connector / ODBC developer and he concluded that the option NO_I_S is going to be removed in 8.0.31 which is going to be released soon. After the option removing NO_I_S will be ignored, so the bug is not feasible to fix.

Regards,
Ashwini Patil
[28 Sep 2022 2:32] qingshun luo
Thank you for your reply.