db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r916640 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc: EmbedCallableStatement20.java EmbedResultSet.java
Date Fri, 26 Feb 2010 10:33:29 GMT
Author: kristwaa
Date: Fri Feb 26 10:33:29 2010
New Revision: 916640

URL: http://svn.apache.org/viewvc?rev=916640&view=rev
Log:
DERBY-4563: Avoid unnecessary use of getStream and getStreamWithDescriptor 

Replaced use of StreamStorable.returnStream in the JDBC layer with
DataValueDescriptor.getStream.

Patch file: derby-4563-2a-replace_streamstorable_in_jdbclayer.diff


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java?rev=916640&r1=916639&r2=916640&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedCallableStatement20.java
Fri Feb 26 10:33:29 2010
@@ -1211,12 +1211,11 @@
                 pushStack = true;
                 setupContextStack();
 
-                StreamStorable ss = (StreamStorable)param;
-                InputStream stream = ss.returnStream();
-                if (stream == null) {
-                    stream = new ByteArrayInputStream(param.getBytes());
+                InputStream stream; // The stream we will return to the user
+                if (param.hasStream()) {
+                    stream = new BinaryToRawStream(param.getStream(), param);
                 } else {
-                    stream = new BinaryToRawStream(stream, param);
+                    stream = new ByteArrayInputStream(param.getBytes());
                 }
                 return stream;
             } catch (Throwable t) {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java?rev=916640&r1=916639&r2=916640&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet.java Fri Feb
26 10:33:29 2010
@@ -1246,17 +1246,12 @@
 			pushStack = true;
 			setupContextStack();
 
-			StreamStorable ss = (StreamStorable) dvd;
-
-			InputStream stream = ss.returnStream();
-
-			if (stream == null)
-			{
-				stream = new NewByteArrayInputStream(dvd.getBytes());
-			} else
-			{
-				stream = new BinaryToRawStream(stream, dvd);
-			}
+            InputStream stream; // The stream we will return to the user
+            if (dvd.hasStream()) {
+                stream = new BinaryToRawStream(dvd.getStream(), dvd);
+            } else {
+                stream = new NewByteArrayInputStream(dvd.getBytes());
+            }
 
             if (lmfs > 0)
             {



Mime
View raw message