db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: should Clob.getSubstring() allow length of 0?
Date Sat, 15 Jul 2006 16:26:18 GMT
Hi Lance,

Now that Kathey has kicked it back to you and me, how about updating  
the to-be-released JDBC 4 to point out that a length of zero for the  
getSubString is valid?

String getSubString(long pos,
                     int length)
                     throws SQLException
Retrieves a copy of the specified substring in the CLOB value  
designated by this Clob object. The substring begins at position pos  
and has up to length consecutive characters.

pos - the first character of the substring to be extracted. The first  
character is at position 1.
length - the number of consecutive characters to be copied

We might simply add to this description.

length - the number of consecutive characters to be copied; 0 is a  
valid value

We have a similar case with Blob byte[ ] getBytes().

Can you run this past the expert group for a quick consensus?



On Jul 14, 2006, at 11:13 PM, Kathey Marsden wrote:

> Craig L Russell wrote:
>> You can always work around odd code on the other side of an   
>> incompletely defined interface. But you probably have code on the   
>> Derby side that also checks for the clob.length() == 0 and take  
>> some  extraordinary action.
>> So much easier for neither side to check for zero length and let  
>> the  natural boundary condition happen.
> I am happy that you agree that the original  DDLUtils code was  
> perfectly reasonable at not as Lance described it.   I will exit  
> this issue now and allow you,  Lance, or someone else with interest  
> determine the correct behavior, check it with Derby  and  file a  
> Derby bug if needed.
> Kathey

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!

View raw message