You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ka...@apache.org on 2006/08/29 07:50:45 UTC
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
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);
}