db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r424539 - in /db/derby/code/trunk/java: drda/org/apache/derby/impl/drda/DDMReader.java drda/org/apache/derby/impl/drda/DRDAConnThread.java testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out
Date Sat, 22 Jul 2006 09:00:08 GMT
Author: tmnk
Date: Sat Jul 22 02:00:08 2006
New Revision: 424539

URL: http://svn.apache.org/viewvc?rev=424539&view=rev
Log:
- DERBY-1513_1535 Trial 1 for DERBY-550 & Trial 2 for DERBY-550 - Patch by Tomohito Nakayama
(tomonaka@basil.ocn.ne.jp)

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java?rev=424539&r1=424538&r2=424539&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java Sat Jul 22 02:00:08
2006
@@ -949,17 +949,19 @@
   {
     boolean readHeader;
     int copySize;
-    ByteArrayOutputStream baos;
+    MemorySavedByteArrayOutputStream baos;
     boolean isLengthAndNullabilityUnknown = false;
 
 	
 	if (desiredLength != -1) {
         // allocate a stream based on a known amount of data
-        baos = new ByteArrayOutputStream ((int) desiredLength);
+        baos = new MemorySavedByteArrayOutputStream ((int) desiredLength - 
+													 ( checkNullability ? 1:0 )
+													 );
 	}
 	else {
         // allocate a stream to hold an unknown amount of data
-        baos = new ByteArrayOutputStream ();
+        baos = new MemorySavedByteArrayOutputStream ();
         //isLengthAndNullabilityUnknown = true;
 		// If we aren't given a  length get the whole thing.
 		desiredLength = MAX_EXTDTA_SIZE;
@@ -1784,6 +1786,41 @@
 
 		return DssConstants.DSSCHAIN;
 
+	}
+	
+
+	/**
+	 *
+	 * This class supress to allocate another memory when toByteArray() method was called.
+	 * In compensation for the saving memory, program using this class should not modify the
return value of  toByteArray() method.
+	 *
+	 */
+	static class MemorySavedByteArrayOutputStream extends ByteArrayOutputStream {
+		
+		
+		MemorySavedByteArrayOutputStream(){
+			super();
+		}
+		
+		
+		MemorySavedByteArrayOutputStream(int size){
+			buf = new byte[size];
+			count = 0;
+		}
+		
+		
+		public byte[] toByteArray() {
+			
+			if(buf.length == count){
+				return buf;
+				
+			}else{
+				return super.toByteArray();
+
+			}
+		}
+		
+		
 	}
 
 }

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=424539&r1=424538&r2=424539&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Sat Jul 22
02:00:08 2006
@@ -4366,7 +4366,9 @@
 									  paramBytes.length);
 							}
 						}
-						ps.setBytes(i+1, paramBytes);
+						ps.setBinaryStream(i+1, 
+										   new ByteArrayInputStream(paramBytes),
+										   paramBytes.length);
 						break;
 					case DRDAConstants.DRDA_TYPE_LOBCSBCS:
 					case DRDAConstants.DRDA_TYPE_NLOBCSBCS:

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out?rev=424539&r1=424538&r2=424539&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/parameterMapping.out
Sat Jul 22 02:00:08 2006
@@ -1351,8 +1351,8 @@
   setAsciiStream() as batch getString=eg012d                                            
          was null false JDBC MATCH(OK)
   setAsciiStream(null) getString=null was null true JDBC MATCH(OK)
   setAsciiStream(null) as batch getString=null was null true JDBC MATCH(OK)
-  setBinaryStream() getString=EncodedString: > 33347 51966 50 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 < was null false CLOUD EXT (OK)
-  setBinaryStream() as batch getString=EncodedString: > 33347 51966 50 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 < was null false CLOUD
EXT (OK)
+  setBinaryStream() IC JDBC MATCH (INVALID)
+  setBinaryStream() as batch IC JDBC MATCH (INVALID)
   setBinaryStream(null) getString=null was null true CLOUD EXT (OK)
   setBinaryStream(null) as batch getString=null was null true CLOUD EXT (OK)
   setCharacterStream() getString=89                                                     
     was null false JDBC MATCH(OK)
@@ -1363,8 +1363,8 @@
   setClob() as batch getString=72                                                       
   was null false CLOUD EXT (OK)
   setClob(null) getString=null was null true CLOUD EXT (OK)
   setClob(null) as batch getString=null was null true CLOUD EXT (OK)
-  setBlob() getString=EncodedString: > 12867 29251 55 32 32 32 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 < was null false CLOUD EXT (OK)
-  setBlob() as batch getString=EncodedString: > 12867 29251 55 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 < was null false CLOUD EXT (OK)
+  setBlob() IC JDBC MATCH (INVALID)
+  setBlob() as batch IC JDBC MATCH (INVALID)
   setBlob(null) getString=null was null true CLOUD EXT (OK)
   setBlob(null) as batch getString=null was null true CLOUD EXT (OK)
   setUnicodeStream()  (0A000):Feature not implemented: setUnicodeStream. JDBC MATCH (INVALID)
@@ -1523,8 +1523,8 @@
   setAsciiStream() as batch getString=eg012d was null false JDBC MATCH(OK)
   setAsciiStream(null) getString=null was null true JDBC MATCH(OK)
   setAsciiStream(null) as batch getString=null was null true JDBC MATCH(OK)
-  setBinaryStream() getString=EncodedString: > 33347 51966 50 < was null false CLOUD
EXT (OK)
-  setBinaryStream() as batch getString=EncodedString: > 33347 51966 50 < was null false
CLOUD EXT (OK)
+  setBinaryStream() IC JDBC MATCH (INVALID)
+  setBinaryStream() as batch IC JDBC MATCH (INVALID)
   setBinaryStream(null) getString=null was null true CLOUD EXT (OK)
   setBinaryStream(null) as batch getString=null was null true CLOUD EXT (OK)
   setCharacterStream() getString=89 was null false JDBC MATCH(OK)
@@ -1535,8 +1535,8 @@
   setClob() as batch getString=72 was null false CLOUD EXT (OK)
   setClob(null) getString=null was null true CLOUD EXT (OK)
   setClob(null) as batch getString=null was null true CLOUD EXT (OK)
-  setBlob() getString=EncodedString: > 12867 29251 55 < was null false CLOUD EXT (OK)
-  setBlob() as batch getString=EncodedString: > 12867 29251 55 < was null false CLOUD
EXT (OK)
+  setBlob() IC JDBC MATCH (INVALID)
+  setBlob() as batch IC JDBC MATCH (INVALID)
   setBlob(null) getString=null was null true CLOUD EXT (OK)
   setBlob(null) as batch getString=null was null true CLOUD EXT (OK)
   setUnicodeStream()  (0A000):Feature not implemented: setUnicodeStream. JDBC MATCH (INVALID)
@@ -1695,8 +1695,8 @@
   setAsciiStream() as batch getString=eg012d was null false JDBC MATCH(OK)
   setAsciiStream(null) getString=null was null true JDBC MATCH(OK)
   setAsciiStream(null) as batch getString=null was null true JDBC MATCH(OK)
-  setBinaryStream() getString=EncodedString: > 33347 51966 50 < was null false CLOUD
EXT (OK)
-  setBinaryStream() as batch getString=EncodedString: > 33347 51966 50 < was null false
CLOUD EXT (OK)
+  setBinaryStream() IC JDBC MATCH (INVALID)
+  setBinaryStream() as batch IC JDBC MATCH (INVALID)
   setBinaryStream(null) getString=null was null true CLOUD EXT (OK)
   setBinaryStream(null) as batch getString=null was null true CLOUD EXT (OK)
   setCharacterStream() getString=89 was null false JDBC MATCH(OK)
@@ -1707,8 +1707,8 @@
   setClob() as batch getString=72 was null false CLOUD EXT (OK)
   setClob(null) getString=null was null true CLOUD EXT (OK)
   setClob(null) as batch getString=null was null true CLOUD EXT (OK)
-  setBlob() getString=EncodedString: > 12867 29251 55 < was null false CLOUD EXT (OK)
-  setBlob() as batch getString=EncodedString: > 12867 29251 55 < was null false CLOUD
EXT (OK)
+  setBlob() IC JDBC MATCH (INVALID)
+  setBlob() as batch IC JDBC MATCH (INVALID)
   setBlob(null) getString=null was null true CLOUD EXT (OK)
   setBlob(null) as batch getString=null was null true CLOUD EXT (OK)
   setUnicodeStream()  (0A000):Feature not implemented: setUnicodeStream. JDBC MATCH (INVALID)



Mime
View raw message