Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 57492 invoked from network); 17 Feb 2007 14:29:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Feb 2007 14:29:41 -0000 Received: (qmail 78522 invoked by uid 500); 17 Feb 2007 14:29:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 78485 invoked by uid 500); 17 Feb 2007 14:29:48 -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 78476 invoked by uid 99); 17 Feb 2007 14:29:48 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Feb 2007 06:29:48 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 Feb 2007 06:29:40 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8279E7141E7 for ; Sat, 17 Feb 2007 06:29:18 -0800 (PST) Message-ID: <852738.1171722558530.JavaMail.jira@brutus> Date: Sat, 17 Feb 2007 06:29:18 -0800 (PST) From: "Anurag Shekhar (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-2345) truncate on a Blob does not work when the Blob is in memory In-Reply-To: <5187961.1171629665708.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Anurag Shekhar updated DERBY-2345: ---------------------------------- Attachment: derby-2345.diff I had missed reassigning the truncated byte array over original byte array hence this bug. The bug went undetected because the tests i added as part of 2247 wasn't testing truncate for small blob (less than 4k). In this patch I have fixed this bug and added a test for small blob. > truncate on a Blob does not work when the Blob is in memory > ----------------------------------------------------------- > > Key: DERBY-2345 > URL: https://issues.apache.org/jira/browse/DERBY-2345 > Project: Derby > Issue Type: Bug > Components: JDBC > Reporter: V.Narayanan > Assigned To: Anurag Shekhar > Priority: Minor > Attachments: derby-2345.diff > > > I tried the following repro. After calling the truncate the Blob object still returns the length as 29 (its original length) . > import java.sql.*; > public class TruncateBugRepro { > > Connection con = null; > > public Connection getEmbeddedConnection() throws Exception { > if(con == null) { > Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); > con = DriverManager.getConnection > ("jdbc:derby:DB1;create=true"); > } > return con; > } > > public void testTruncate() throws Exception { > //String used to getBytes from and insert into Blob. > String str = new String("I am a Blob!!! I am a Blob!!!"); > Connection con = getEmbeddedConnection(); > //create the blob > Blob blob = con.createBlob(); > //insert bytes > blob.setBytes(1,str.getBytes()); > //Retuns the Blob length as 29 > System.out.println("" + blob.length()); > blob.truncate(14); > //returns the Blob length as 29 > System.out.println("" + blob.length()); > } > > public static void main(String[] args) throws Exception { > TruncateBugRepro t = new TruncateBugRepro(); > t.testTruncate(); > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.