db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmarsdende...@sbcglobal.net>
Subject Re: should Clob.getSubstring() allow length of 0?
Date Sat, 15 Jul 2006 01:46:01 GMT
Lance J. Andersen wrote:

> Hi Kathy,
>
> I would probably expect a  SQLException to be thrown in this case or I 
> guess you could return nothing.
>
I will assume then that the Derby behavior  is correct and won't file a bug.
Thank you for the clarification but I don't think your comment was 
either necessary or appropriate.

 In the DDLUtils code, they just had the generic code:  value = 
clob.getSubString(1,  (int)clob.length());  to handle all non-null Clobs.
The fix was to add in an extra branch to handle zero length Clobs which 
they were more than happy to do although it made their code look a 
little messier.

This was the change to work around the SQLException.

+                            else if (clob.length() == 0)
+                               {
+                                       value = "";
+                               }
                        else
                        {
                            value = clob.getSubString(1,  
(int)clob.length());

Kathey

Mime
View raw message