Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 27071 invoked from network); 30 May 2006 09:21:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 30 May 2006 09:21:44 -0000 Received: (qmail 8689 invoked by uid 500); 30 May 2006 09:21:26 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 7389 invoked by uid 500); 30 May 2006 09:21:13 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 7301 invoked by uid 99); 30 May 2006 09:21:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 May 2006 02:21:11 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.1.36] (HELO gmpea-pix-1.sun.com) (192.18.1.36) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 May 2006 02:20:47 -0700 Received: from d1-emea-09.sun.com ([192.18.2.119]) by gmpea-pix-1.sun.com (8.12.9/8.12.9) with ESMTP id k4U9KQ4x018635 for ; Tue, 30 May 2006 10:20:26 +0100 (BST) Received: from conversion-daemon.d1-emea-09.sun.com by d1-emea-09.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0J0200B01N638B00@d1-emea-09.sun.com> (original mail from Kristian.Waagan@Sun.COM) for derby-dev@db.apache.org; Tue, 30 May 2006 10:20:26 +0100 (BST) Received: from [129.159.112.188] by d1-emea-09.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0J02005UNNA1NO00@d1-emea-09.sun.com> for derby-dev@db.apache.org; Tue, 30 May 2006 10:20:26 +0100 (BST) Date: Tue, 30 May 2006 11:20:25 +0200 From: Kristian Waagan Subject: Re: [jira] Commented: (DERBY-1286) Fill in Clob methods required for JDBC3 compliance In-reply-to: <4474CE21.7040001@sun.com> Sender: Kristian.Waagan@Sun.COM To: derby-dev@db.apache.org Message-id: <447C0E59.8000101@Sun.com> Organization: Sun Microsystems Inc. MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=UTF-8 Content-transfer-encoding: 7BIT References: <13418999.1147300626171.JavaMail.jira@brutus> <4474CE21.7040001@sun.com> User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; no-NO; rv:1.8.0.2) Gecko/20060427 Thunderbird/1.5.0.2 Mnenhy/0.7.4.0 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Lance J. Andersen wrote: > This is what we discussed in the EG and agreed to in this regards > > consider a Clob, aClob, containing the following value for each > setString() invocation below. I tried doing this in Derby, and I do see the behavior Dan pointed out in his mail (see below). > > ABCDEFG > > > *A. aClob.setString(2, "XX") * > > Result: AXXDEFG Derby: AXX > > > *B. aClob.setString(1, "XX") * > > Result: XXCDEFG Derby: XX > > > > *C. aClob.setString(8, "XX") * > > > Result: ABCDEFGXX Derby: ABCDEFGXX > > > *D. aClob.setString(7, "XX") * > > > Result: ABCDEFXX Derby: ABCDEFXX > > > *E. aClob.setString(9, "XX)* > > Where we are: > > We agreed that we all felt the correct behavior is to return a > SQLException. Derby: SQLException So, Derby truncates the clob after the last inserted character (if there is more left of the original clob). Has a Jira been entered for this? If not, should we declare this a bug? I also took a quick look at Blob.setBytes in the client driver. I think it has the same behavior as Clob.setString. Is this a bug as well? -- Kristian > > > > Daniel John Debrunner (JIRA) wrote: >> [ http://issues.apache.org/jira/browse/DERBY-1286?page=comments#action_12378987 ] >> >> Daniel John Debrunner commented on DERBY-1286: >> ---------------------------------------------- >> >> Is there a good definition in the specification as to how the Clob.setXXX methods are defined to work? Section 16.3.3. of JDBC 3.0 has wording that is pretty vague. The javadoc for these methods doesn't help much either. (Similar concern for Blob.setXXX) >> >> Q1 - I can think of three possible implementations for the setXXX methods: >> A) Overwite any existing data from the passed in position >> B) Replace the data from passed in position onwards >> C) Insert the data into the value at the position >> >> For example, with an existing Clob with value "To be or not to be", and calling setString(7, "is all") I can see getting: >> >> A) "To be is all to be" >> B) "To be is all" >> C) "To be is allor not to be" >> >> From a quick check of the (ugly, see DERBY-684) client code, I think it implements B. >> >> Q2 - is that if I call setXXXStream() but never write to the stream, is the value modified? >> What if the stream is written to with 0 bytes/characters? >> If the defined behaviour above is B) then there's a case to be made that it should be truncated to length matching the passed in position. >> > If you do not write, there are not changes, the offset is just a > positioning. >> Q3 - setString returns the number of characters written, is that allowed to be different to the number of characters that are requested to be written? Like OutputStream.writr(byte[])? >> > vendors did not have an easy answer on when/if the number written/would > differ, so i would say this is implementations specific. >> Sorry if these answers are obvious. >> >> BTW - there is a bug in the javadoc for Clob.truncate() that indicates for the parameter that the truncation is in bytes. The overview of the method indicates correctly it is in characters. This still seems to be an issue in JDBC 4. >> > fixed thanks >> >>> Fill in Clob methods required for JDBC3 compliance >>> -------------------------------------------------- >>> >>> Key: DERBY-1286 >>> URL: http://issues.apache.org/jira/browse/DERBY-1286 >>> Project: Derby >>> Type: Improvement >>> >> >> >>> Components: JDBC >>> Versions: 10.2.0.0 >>> Reporter: Rick Hillegas >>> Fix For: 10.2.0.0 >>> >> >> >>> Fill in Clob methods which we need to be JDBC3-compliant: >>> - The following java.sql.CallableStatement methods: >>> * getClob(int) >>> - The following java.sql.ResultSet methods: >>> * updateClob(int,java.sql.Clob) >>> * updateClob(java.lang.String,java.sql.Clob) >>> - The following java.sql.Clob methods: >>> * setString(long,java.lang.String) >>> * setString(long,java.lang.String,int,int) >>> * setAsciiStream(long) >>> * getCharacterStream(long,long) >>> * setCharacterStream(long) >>> * truncate(long) >>> >> >>