db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r955634 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java
Date Thu, 17 Jun 2010 15:22:49 GMT
Author: kristwaa
Date: Thu Jun 17 15:22:49 2010
New Revision: 955634

URL: http://svn.apache.org/viewvc?rev=955634&view=rev
Log:
DERBY-4686: SQLBinary.writeBlob is inefficient, reading one byte at a time from the source
BLOB

Reduce buffer size if the BLOB value is smaller than the default buffer size.

Patch contributed by Yun Lee (yun dot lee dot bj at gmail dot com).

Patch file: DERBY-4686-2.diff

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java?rev=955634&r1=955633&r2=955634&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBinary.java Thu Jun 17
15:22:49 2010
@@ -374,7 +374,7 @@ abstract class SQLBinary
             
             int bytesRead = 0;
             int numOfBytes = 0;
-            byte[] buffer = new byte[LEN_OF_BUFFER_TO_WRITE_BLOB];
+            byte[] buffer = new byte[Math.min(len, LEN_OF_BUFFER_TO_WRITE_BLOB)];
             
             while(bytesRead < len) {
                 numOfBytes = is.read(buffer);



Mime
View raw message