db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r901761 - in /db/derby/code/branches/10.5: ./ java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
Date Thu, 21 Jan 2010 16:29:20 GMT
Author: kristwaa
Date: Thu Jan 21 16:29:20 2010
New Revision: 901761

URL: http://svn.apache.org/viewvc?rev=901761&view=rev
Log:
DERBY-4455: Prepared statement failure with CLOB: Stream has already been read and end-of-file
reached and cannot be re-used.
Merged from trunk (r901760, derby-4455-1c.diff).

Modified:
    db/derby/code/branches/10.5/   (props changed)
    db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java

Propchange: db/derby/code/branches/10.5/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 21 16:29:20 2010
@@ -1 +1 @@
-/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,882732,884163,887246,892912,897161,901165,901648
+/db/derby/code/trunk:769596,769602,769606,769962,772090,772337,772449,772534,774281,777105,779681,782991,785131,785139,785163,785570,785662,788369,788670,788674,788968,789264,790218,792434,793089,793588,794106,794303,794955,795166,796020,796027,796316,796372,797147,798347,798742,800523,803548,803948,805696,808494,808850,809643,810860,812669,816531,816536,819006,822289,823659,824694,829022,832379,833430,882732,884163,887246,892912,897161,901165,901648,901760

Modified: db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java?rev=901761&r1=901760&r2=901761&view=diff
==============================================================================
--- db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
(original)
+++ db/derby/code/branches/10.5/java/engine/org/apache/derby/impl/sql/GenericParameterValueSet.java
Thu Jan 21 16:29:20 2010
@@ -21,29 +21,21 @@
 
 package org.apache.derby.impl.sql;
 
-import org.apache.derby.iapi.services.loader.ClassFactory;
+import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.services.loader.ClassInspector;
-import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
-
+import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.reference.JDBC30Translation;
+import org.apache.derby.iapi.reference.SQLState;
 import org.apache.derby.iapi.sql.ParameterValueSet;
-
 import org.apache.derby.iapi.types.DataTypeDescriptor;
-import org.apache.derby.iapi.types.DataValueFactory;
 import org.apache.derby.iapi.types.DataValueDescriptor;
 import org.apache.derby.iapi.types.UserDataValue;
-
-import org.apache.derby.iapi.reference.SQLState;
-
-import org.apache.derby.iapi.error.StandardException;
-
-import org.apache.derby.iapi.services.sanity.SanityManager;
+import org.apache.derby.iapi.types.SQLBit;
+import org.apache.derby.iapi.types.SQLBlob;
+import org.apache.derby.iapi.types.SQLChar;
 
 import java.io.InputStream;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
 import java.sql.Types;
-import org.apache.derby.iapi.reference.JDBC30Translation;
 
 /**
  * Implementation of ParameterValueSet
@@ -269,7 +261,24 @@
 
 			if (oldp.isSet)
 			{
-				pvstarget.getParameterForSet(i).setValue(oldp.getValue());
+                DataValueDescriptor dvd = oldp.getValue();
+                InputStream is = null;
+                // See if the value type can hold a stream.
+                // SQLBinary isn't public, check for both SQLBlob and SQLBit.
+                if (dvd instanceof SQLChar || dvd instanceof SQLBlob ||
+                        dvd instanceof SQLBit) {
+                    is = dvd.getStream();
+                }
+                if (is != null) {
+                    // DERBY-4455: Don't materialize the stream when
+                    // transferring it. If the stream has been drained already,
+                    // and the user doesn't set a new value before executing
+                    // the prepared statement again, Derby will fail.
+                    pvstarget.getParameterForSet(i).setValue(is,
+                            DataValueDescriptor.UNKNOWN_LOGICAL_LENGTH);
+                } else {
+                    pvstarget.getParameterForSet(i).setValue(dvd);
+                }
 			}
 		}
 	}



Mime
View raw message