Hello,
My initial work on the new JDBC4 length less overloads are approaching
completion, but I still have one issue that must be solved.
Currently, streams with unknown length are materialized to determine the
length. This is the approach I have implemented in the client driver in
lack of a better solution at the moment. But, the approach is also used
in the embedded driver, and this is simply not good enough.
If I pass the stream down to the storage layer, bypassing the length
checks done by the data type classes (SQLBinary, SQLBlob etc), the
storage layer will insert all the data it can get. For instance, I can
insert 3KB into a 2KB Blob column.
To solve this, I plan to wrap the user/application stream in a
limit-stream. This stream will cause an exception to be thrown if it has
read more data than can be allowed in the column it is being inserted into.
In addition to the maximum length issue, there is also that of
truncation of trailing blanks. I don't yet fully understand what I have
to change. Much of the functionality I need is already in place, but
some changes might be required. For instance, the column width and
whether truncation is allowed or not might need to be passed down to the
limit-mechanism.
Questions, suggestions or other feedback is appreciated!
Related issues are DERBY-1473 and DERBY-1417.
I plan to finish this for 10.2.
Thanks,
--
Kristian