-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL_BLOB (-98) column type code falsely classified as string_t in odbc_result::column_types(nanodbc::result const& r) #907
Comments
Hey thanks for the report! I was hoping to get to this, but ran out of time this weekend. I think I'll have a chance to circle back in the next couple of weeks. Will revert here. |
Hi there, had some time to look into this. First - thanks for the detailed investigation and the work you did to diagnose on your own. That's great. If we are unable to mitigate using other means we may need to update nanodbc, but before we think about that can we try this: It seems DB2 has a "long data compatibility mode", where the DB2 specific data types are translated as more standard ODBC data types. So "SQL_BLOB" ( -98 ) is reported as "SQL_LONGVARBINARY" (-4). I am using a linux box. To enable this I needed to edit my
Once I did that I saw the column type being reported as "-4" and handled appropriately:
|
Hi, I was not able to make the driver pick up the LongDataCompat parameter when set in db2dsdriver.cfg. However, it does work when I add LongDataCompat=1 to my DSN config in db2cli.cfg. This is surely something I can work with for now. Thanks a lot for the suggestion! |
Note, however that setting LongDataCompat=1 only solves BLOB and CBLOB columns but not DBCLOB. With LongDataCompat=0:
After setting LongDataCompat=1, DBCLOB gets mapped to -97:
Code -97 is SQL_UNICODE_LONGVARCHAR according to the ODBC specification:
This is also not handled in nanodbc::auto_bind, it falls right into the default block:
I know the original issue is about SQL_BLOB but this is closely related. |
Th IBM Db2 driver sends the code -98 for BLOB column types. This should be captured by the BINARY block of the switch statement in
odbc_result::column_types(nanodbc::result const& r)
, but unfortunately it falls through it and ends up captured by the default block:The following patch solves the issue, but I don't want to submit it as a pull request because it also involves modifying nanodbc.
The following R code can be used to generate a sample table with a 10MB BLOB column:
The text was updated successfully, but these errors were encountered: