Fix for truncation of strings with FreeTDS driver
Added a fix for FreeTDS. It was interpreting strings longer than 4000 characters as NVARCHAR(4000) instead of NVARCHAR(MAX). Updated so now it interprets strings longer than 4000 characters as SQL_WLONGVARCHAR instead of SQL_WVARCHAR.
If memory serves correctly, I think there are some weird issues surrounding the usage of SQL_WLONGVARCHAR. I need to do some research.
Yeah, see #10. Need to figure out how to solve this problem for good.
Yeah, it's a horrible problem. I don't know if there is a sane solution :(
I think this is going to require some kind of config property with specific code for each driver--ugly, but probably necessary because I doubt there are ways to accurately detect the behavior here. A couple ideas:
- We could attempt to match part of the connection string to detect the driver being used. Then set a variable in the odbc connection that will determine which code path to take for string bindings.
- We could create a config property on the connection that is effectively and Enum that sets the driver being used. Could be set to things like
'FreeTDS','MSAccess', etc. where the default would be the current functionality (thus preventing a major version change).
I agree, @bzuillsmith. Even if we can accurately detect what the proper type should be either from the driver or other magic, we'll have to have a property on the connection that can be passed to GetParametersFromArray.
We could also expose methods to manually set up the bindings (as @lee-houghton did in eos) where the user can manually set the data types, sizes, etc instead of trying to just magically do the right thing.