Menu

#47 SQLGetData returns SQL_SUCCESS instead of SQL_SUCCESS_WITH_INFO

None
closed
nobody
None
5
2021-04-14
2021-04-12
No

I notice that, for blob or binary columns, SQLGetData returns SQL_SUCCESS instead of SQL_SUCCESS_WITH_INFO with a fetch_len > 255

See https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function?redirectedfrom=MSDN&view=sql-server-ver15

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)

Discussion

  • Nick Gorham

    Nick Gorham - 2021-04-12

    This sounds like a driver issue, do you have a example that shows the problem?

     
  • Ondrej Dubaj

    Ondrej Dubaj - 2021-04-12

    Just the PHP test for now, I will work on a reproducer if it is needed.

     
  • Nick Gorham

    Nick Gorham - 2021-04-12

    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

     
  • Ondrej Dubaj

    Ondrej Dubaj - 2021-04-13

    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

     
  • Ondrej Dubaj

    Ondrej Dubaj - 2021-04-14

    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.

     
  • Nick Gorham

    Nick Gorham - 2021-04-14
    • status: open --> closed
    • Group: -->
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.