MS SQL Server exception when setting fields of unlimited length to null using MS JDBC driver
Description
Hi,
I have a Stash add-on using ActiveObjects with entities that have string fields of unlimited length. Here's an example:
This all (for other databases) works fine, except for Microsoft SQL Server, where when I try to create an entity I get the following error:
When I try to execute a query (e.g., ao.find()) which uses this entity, I get the following error:
Is this a known bug?
Any help is much appreciated.
Thanks,
Michael
Environment
Testing Notes
Add notes...
Activity
thanks for your feedback. I created a new issue for the other problem: https://ecosystem.atlassian.net/browse/AO-687
This was introduced while fixing AO-468. Apparently, setting a value of generic NULL type to NTEXT column causes the driver to cast it as a VARBINARY NULL inside and then assignment fails.
Do you have a test case for AO-468? I reverted back to the original implementation of putNull and it works for NTEXT column. I want to be sure I won't cause a regression here.
Right, so MS SQL JDBC driver NULL has an UNKNOWN category and therefore is "unsupported", which causes NULL type to be overridden by BINARY:
Confirming null causing the error, will investigate it further.
Please create another issue for the DISTINCT query, it's better to handle different problems separately.
By the way, there is another issue with MS SQL server when executing the following statement:
which gets translated to
resulting in
Shouldn't the query get translated to
? Please note that this is not a count as in the example above!
I can create a new issue for this if you want me to.
While trying to create a replicator, I was finally able to reproduce this issue. All that was necessary is to create an entity with an StringLength.UNLIMITED attribute and setting its value to null:
This is not an issue with other databases. Of course you would normally not explicitly set a value to null like this, but this piece of code is part of some generic handling for creating entities of this type where this value is often set to a specific value.