SQLGetData returns SQL_SUCCESS instead of SQL_SUCCESS_WITH_INFO
Brought to you by:
lurcher,
peteralexharvey
I notice that, for blob or binary columns, SQLGetData returns SQL_SUCCESS instead of SQL_SUCCESS_WITH_INFO with a fetch_len > 255
It works as expected for CHAR columns
This can be workaround on PHP side, waiting for upstream feedback
See https://github.com/php/php-src/pull/6842
only the PHP test which fails and allow me to discover this issue
https://github.com/php/php-src/blob/master/ext/pdo_odbc/tests/bug80783.phpt
Notice: column type have to be changed from IMAGE (ms) to BYTEA (postgresql) of VARBINARY (Mariadb)
This sounds like a driver issue, do you have a example that shows the problem?
Just the PHP test for now, I will work on a reproducer if it is needed.
Ok, it sounds to me like a driver issue, so I will need to be able to replicate this to know if its a issue unixODBC needs to look at
Attaching reproducer.
Using mysql
With VARCHAR column (500 char data)
Table created
Data inserted
Select
Column 1 is name
Fetch
Get SUCCESS_WITH_INFO 500 255/255
Get SUCCESS 245 245/500
SQLGetData fails (100)
Table deleted
Done
With VARBINARY column (500 char data, thus 1000 hex char result)
Table created
Data inserted
Select
Column 1 is name
Fetch
Get SUCCESS 1000 254/254
Get SUCCESS 746 254/508
Get SUCCESS 492 254/762
Get SUCCESS 238 238/1000
SQLGetData fails (100)
Table deleted
Done
IN the second case, you can notice the "SUCCESS" with len > bufsize where SUCCESS_WITH_INFO is expected
From the investigation my colleague has made, the problem is bind to mysql-odbc connector, so this issue can be closed, as unixODBC seems to work fine.