db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r437976 - in /db/derby/code/trunk/java: engine/org/apache/derby/iapi/types/SQLBlob.java testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
Date Tue, 29 Aug 2006 05:50:45 GMT
Author: kahatlen
Date: Mon Aug 28 22:50:44 2006
New Revision: 437976

URL: http://svn.apache.org/viewvc?rev=437976&view=rev
Log:
DERBY-1417: Add new, lengthless overloads to the streaming api

Prevent materialization of lengthless streams in SQLBlob.setWidth().

Contributed by Kristian Waagan.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java?rev=437976&r1=437975&r2=437976&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLBlob.java Mon Aug 28 22:50:44
2006
@@ -136,9 +136,16 @@
 			throws StandardException
     {
 
+		// Input is null, so there's nothing to do.
 		if (isNull())
 			return;
 
+		// Input is a stream with unknown length. The length will be checked
+		// while reading the stream.
+		if (isLengthLess()) {
+			return;
+		}
+
 		int sourceWidth = getLength();
 
         // need to truncate?
@@ -231,6 +238,16 @@
         } catch (SQLException e) {
             throw dataTypeConversion("DAN-438-tmp");
        }
+    }
+
+    /**
+     * Tell if this blob is length less.
+     *
+     * @return <code>true</code> if the length of the blob is not known,
+     *      <code>false</code> otherwise
+     */
+    private final boolean isLengthLess() {
+        return (stream != null && streamValueLength < 0);
     }
 }
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java?rev=437976&r1=437975&r2=437976&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/PreparedStatementTest.java
Mon Aug 28 22:50:44 2006
@@ -860,7 +860,7 @@
             setBinaryStreamOnBlob(key, length, -1, 0, true);
         } catch (SQLException sqle) {
             if (usingEmbedded()) {
-                assertSQLState("XCL30", sqle);
+                assertSQLState("XSDA4", sqle);
             } else {
                 assertSQLState("22001", sqle);
             }



Mime
View raw message