db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r509375 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/LOBStreamControl.java testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobSetMethodsTest.java
Date Mon, 19 Feb 2007 23:19:06 GMT
Author: kristwaa
Date: Mon Feb 19 15:19:05 2007
New Revision: 509375

URL: http://svn.apache.org/viewvc?view=rev&rev=509375
Log:
DERBY-2345: Fixed bug where Blob.truncate(long) did not work if the blob was materialized
in memory. A test was also added.

Patch contributed by Anurag Shekhar.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobSetMethodsTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java?view=diff&rev=509375&r1=509374&r2=509375
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/LOBStreamControl.java Mon Feb
19 15:19:05 2007
@@ -351,6 +351,7 @@
         if (isBytes) {
             byte [] tmpByte = new byte [(int) size];
             System.arraycopy(dataBytes, 0, tmpByte, 0, (int) size);
+            dataBytes = tmpByte;
         } else {
             if (size < Integer.MAX_VALUE && size < MAX_BUF_SIZE) {
                 dataBytes = new byte [(int) size];

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobSetMethodsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobSetMethodsTest.java?view=diff&rev=509375&r1=509374&r2=509375
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobSetMethodsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/BlobSetMethodsTest.java
Mon Feb 19 15:19:05 2007
@@ -141,6 +141,16 @@
             //test truncate
             blob.truncate (BUFFER_SIZE);
             assertEquals (BUFFER_SIZE, blob.length());
+            //test truncate on small size blob
+            blob = con.createBlob();
+            data = new byte [100];
+            for (int i = 0; i < 100; i++) {
+                data [i] = (byte) i;
+            }
+            blob.setBytes (1, data);
+            assertEquals (blob.length(), 100);
+            blob.truncate (50);
+            assertEquals (blob.length(), 50);
             con.commit();
             stmt.close();
             pstmt.close();



Mime
View raw message