db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance J. Andersen" <Lance.Ander...@Sun.COM>
Subject Re: should Clob.getSubstring() allow length of 0?
Date Mon, 17 Jul 2006 00:58:26 GMT
Hi Craig, Kathey,

First, it seems someone took my subtle attempt at humor the wrong way.  
My apologies as I was not trying to insult or offend anyone (but it was 
9:40pm EDT and I had been working since 6am to meet some deadlines).

My point was, that I cannot guarantee that a vendor is not throwing a 
SQLException in the case where the length is 0,  someone might have 
chosen to do this, i do not know.  The spec does not articulate a 
specific behavior one way or the other so from a spec perspective, they 
are within their rights to do so as the API does not define the 
behavior.  This was what i was referring to in my attempt at late night 
humor.  I have been surprised many times over as to how some items have 
been implemented by vendors given the lack of clarity.

I think i will sign off derby-dev for a while...


Craig L Russell wrote:
> Hi Lance,
> Unless I'm missing something, a zero length java.lang.String is legal 
> and necessary for completeness. Since there's nothing in the quoted 
> text, I'd assume that a zero-length String should be returned as long 
> as the start position is legal. Not an exception, not null, not 
> "nothing", but a valid zero-length String.
> Craig
> On Jul 14, 2006, at 6:32 PM, 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.
>> We did not discuss this stupid human trick in the EG :-)  but i guess 
>> we should have.
>> Regards
>> Lance
>> Kathey Marsden wrote:
>>> Lance J. Andersen wrote:
>>>> Derby is correct.  The clarified JDBC 4 javadocs indicates the 
>>>> following:
>>>>         |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
>>> Thanks Lance for looking at this.  The question is about the 
>>> length.  The length in this case is 0.
>>> From the DDLUtils code it looked like this where clob.length() was 0.
>>> value = clob.getSubString(1, (int)clob.length());
>>> Is this  ok to send length 0 or to specify position 1 if there is no 
>>> character there?
>>> *
>>> *
> 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