db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmarsdende...@sbcglobal.net>
Subject [DERBY-255 - Sunitha please review] Re: svn commit: r179014 - in /incubator/derby/code/trunk/java: drda/org/apache/derby/impl/drda/ testing/org/apache/derbyTesting/functionTests/master/ testing/org/apache/derbyTesting/functionTests/master/DerbyNet/ testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/ testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/
Date Mon, 30 May 2005 16:12:23 GMT
kmarsden@apache.org wrote:

Sunitha, could you review this change?
When I sycnched up, the message for your test for DERBY-265 changed I 
think correctly  but I'd like you to check that and review the change in
general if you have time.

Thanks

Kathey


>Author: kmarsden
>Date: Sun May 29 22:36:14 2005
>New Revision: 179014
>
>URL: http://svn.apache.org/viewcvs?rev=179014&view=rev
>Log:
>This fixes DERBY-255 
>
>Closing a resultset after retriving BLOB or CLOB data > 32K, does not release locks properly. 
>
>Network server/client materializes the LOB on the client and cannot differentiate getBlob from getBytes or getBinaryStream. Previously, network server would always call getBlob/getClob for any lob related call. This change changes network server to use getBytes/getString and not  hold locks for any of the calls. 
>
>The implementation adds a new class EXTDTAInputStream to network server to localize the stream handling for large objects.   This should make it easier to adjust in the future as improvements are made in the large object handling. Because we need a length in order to write a stream, EXTDTAInputStream currently call getBytes or getString to get the length and stream out that object. This is apparently required because we cannot reset the input stream after traversing it to get the length.
>
>
>Future suggestions for changes to network server to handle this in a more complete way would be to:
>
>1) Change DDMWriter.writeScalarStream to  not require a length and optimize EXTDTAObjectInputStream accordingly
>
>2) Add support for lob locators with network server.  The getBlob, getClob calls would use the locators and would hold locks until the end of the transaction.
>
>
>Added:
>    incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java   (with props)
>Modified:
>    incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java
>    incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
>    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out
>    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out
>    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/blobclob4BLOB.out
>    incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/blobclob4BLOB.java
>
>Modified: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java
>URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java?rev=179014&r1=179013&r2=179014&view=diff
>==============================================================================
>--- incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java (original)
>+++ incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMWriter.java Sun May 29 22:36:14 2005
>@@ -637,6 +637,11 @@
> 	}
> 
> 
>+	// TODO: Rewrite writeScalarStream to avoid passing a length.
>+	// The length is never written and not required by the DRDA spec.
>+	// Also looks like on IOException we just pad out the stream instead
>+	// of actually sending an exception.  Similar code is in client, so 
>+	// should be fixed in both places.
> 	protected int  writeScalarStream (boolean chainedWithSameCorrelator,
> 									  int codePoint,
> 									  int length,
>@@ -681,7 +686,6 @@
> 
> 			bytesToRead = flushScalarStreamSegment (leftToRead, bytesToRead);
> 		} while (leftToRead > 0);
>-		
> 		// check to make sure that the specified length wasn't too small
> 		try {
> 			if (in.read() != -1) {
>
>Modified: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
>URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=179014&r1=179013&r2=179014&view=diff
>==============================================================================
>--- incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
>+++ incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Sun May 29 22:36:14 2005
>@@ -5910,11 +5910,10 @@
> 					switch (ndrdaType)
> 					{
> 						case FdocaConstants.DRDA_TYPE_NLOBBYTES:
>-							writeFdocaVal(i,rs.getBlob(i),drdaType,
>-										  precision,scale,rs.wasNull(),stmt);
>-							break;
> 						case  FdocaConstants.DRDA_TYPE_NLOBCMIXED:
>-							writeFdocaVal(i,rs.getClob(i),drdaType,
>+							EXTDTAInputStream extdtaStream=  
>+								EXTDTAInputStream.getEXTDTAStream(rs, i, drdaType);
>+							writeFdocaVal(i,extdtaStream, drdaType,
> 										  precision,scale,rs.wasNull(),stmt);
> 							break;
> 						case FdocaConstants.DRDA_TYPE_NINTEGER:
>@@ -6550,19 +6549,13 @@
> 					writer.writeLDString(val.toString(), index);
> 					break;
> 				case FdocaConstants.DRDA_TYPE_NLOBBYTES:
>+				case FdocaConstants.DRDA_TYPE_NLOBCMIXED:
> 					// do not send EXTDTA for lob of length 0, beetle 5967
>-					valLength = ((Blob) val).length();
>+					valLength = ((EXTDTAInputStream) val).length();
> 					if (valLength > 0)
> 						stmt.addExtDtaObject(val, index);
> 					writer.writeExtendedLength (valLength);
> 					break;
>-				case FdocaConstants.DRDA_TYPE_NLOBCMIXED:
>-					valLength = ((Clob) val).length();
>-					// do not send EXTDTA for lob of length 0, beetle 5967
>-					if (valLength > 0) 
>-						stmt.addExtDtaObject(val,index);
>-					writer.writeExtendedLength(valLength);
>-					break;
> 				case  FdocaConstants.DRDA_TYPE_NFIXBYTE:
> 					writer.writeBytes((byte[]) val);
> 					break;
>@@ -7125,29 +7118,24 @@
> 				writeNullByte = true;
> 		
> 		Object o  = extdtaValues.get(i);
>-        if (o instanceof Blob) {
>-			Blob b = (Blob) o;
>-			long blobLength = b.length();
>+        if (o instanceof EXTDTAInputStream) {
>+			EXTDTAInputStream stream = (EXTDTAInputStream) o;
>+			long lobLength = stream.length();
> 			writer.writeScalarStream (chainedWithSameCorrelator,
> 									  CodePoint.EXTDTA,
>-									  (int) Math.min(blobLength,
>+									  (int) Math.min(lobLength,
> 													 Integer.MAX_VALUE),
>-									  b.getBinaryStream (),
>+									  stream,
> 									  writeNullByte);
> 			
>-		}
>-		else if (o instanceof  Clob) {
>-			Clob c = (Clob) o;
>-			long[] outlen = {-1};
>-			ByteArrayInputStream  unicodeStream =
>-				convertClobToUnicodeStream(c, outlen);
>-			writer.writeScalarStream (chainedWithSameCorrelator,
>-									  CodePoint.EXTDTA,
>-									  (int) Math.min(outlen[0],
>-													 Integer.MAX_VALUE),		 
>-									  unicodeStream,
>-									  writeNullByte);
>-		}
>+			try {
>+				// close the stream when done
>+				if (stream != null)
>+					stream.close();
>+			} catch (IOException e) {
>+				Util.javaException(e);
>+			}
>+        }
> 		else if (o instanceof  byte[]) {
> 			byte[] b = (byte []) o;
> 			writer.writeScalarStream (chainedWithSameCorrelator,
>@@ -7162,43 +7150,6 @@
> 
>   }
> 
>-
>-
>-	private  java.io.ByteArrayInputStream  
>-		convertClobToUnicodeStream (
>-								Clob c,
>-								long outlen[]) throws SQLException
>-	{
>-		java.io.Reader characterStream = c.getCharacterStream();
>-		// Extract all the characters and write into a StringWriter.
>-		java.io.StringWriter sw = new java.io.StringWriter ();
>-		try {
>-			int read = characterStream.read();
>-			while (read != -1) {
>-				sw.write(read);
>-				read = characterStream.read();
>-			}
>-    }
>-		catch (java.io.IOException e) {
>-			throw new SQLException (e.getMessage());
>-		}
>-
>-		// Extract the String from the StringWriter and extract the UTF-8 bytes.
>-		String string = sw.toString();
>-
>-		byte[] utf8Bytes = null;
>-		try {
>-			utf8Bytes = string.getBytes("UTF-8");
>-		}
>-		catch (java.io.UnsupportedEncodingException e) {
>-			throw new SQLException (e.getMessage());
>-    }
>-
>-		// Create a new ByteArrayInputStream based on the bytes.
>-
>-		outlen[0]= utf8Bytes.length;
>-		return new java.io.ByteArrayInputStream (utf8Bytes);
>-		}
> 
> 	/**
> 	 * Check SQLWarning and write SQLCARD as needed.
>
>Added: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java
>URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java?rev=179014&view=auto
>==============================================================================
>--- incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java (added)
>+++ incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java Sun May 29 22:36:14 2005
>@@ -0,0 +1,282 @@
>+/*
>+ 
>+ Derby - Class org.apache.derby.impl.drda.DRDAStatement
>+
>+ Copyright 2002, 2004 The Apache Software Foundation or its licensors, as applicable.
>+
>+ Licensed under the Apache License, Version 2.0 (the "License");
>+ you may not use this file except in compliance with the License.
>+ You may obtain a copy of the License at
>+
>+ http://www.apache.org/licenses/LICENSE-2.0
>+
>+ Unless required by applicable law or agreed to in writing, software
>+ distributed under the License is distributed on an "AS IS" BASIS,
>+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>+ See the License for the specific language governing permissions and
>+ limitations under the License.
>+
>+ */
>+package org.apache.derby.impl.drda;
>+
>+import java.io.ByteArrayInputStream;
>+import java.io.IOException;
>+import java.io.InputStream;
>+import java.sql.ResultSet;
>+import java.sql.SQLException;
>+
>+import org.apache.derby.iapi.services.sanity.SanityManager;
>+import org.apache.derby.impl.jdbc.Util;
>+
>+/**
>+ * @author marsden
>+ * 
>+ * EXTDTAObjectHolder provides Externalized Large Object representation that
>+ * does not hold locks until the end of the transaction (DERBY-255)
>+ * 
>+ * It serves as a holder for lob data and is only valid as long as the original
>+ * result set from which it came is on the same row.  
>+ * 
>+ *  
>+ */
>+public class EXTDTAInputStream extends InputStream {
>+
>+	long dataLength = 0; // length of the stream;
>+
>+	InputStream binaryInputStream = null;
>+
>+	int columnNumber;
>+
>+	ResultSet dataResultSet = null;
>+	
>+	
>+	/**
>+	 * @param dataLength
>+	 * @param binaryInputStream
>+	 */
>+	private EXTDTAInputStream( int dataLength, InputStream binaryInputStream) {
>+		
>+		this.dataLength = dataLength;
>+		this.binaryInputStream = binaryInputStream;
>+	}
>+
>+	/**
>+	 * Retrieve stream from the ResultSet and column specified.  Create an
>+	 * input stream and length for the large object being retrieved. Do not hold
>+	 * locks until end of transaction. DERBY-255.
>+	 * 
>+	 * 
>+	 * @see DDMWriter.writeScalarStream
>+	 * 
>+	 * @param rs
>+	 *            result set from which to retrieve the lob
>+	 * @param column
>+	 *            column number
>+	 * @param drdaType
>+	 *            FD:OCA type of object one of
>+	 * 			   FdocaConstants.DRDA_TYPE_NLOBBYTES
>+	 * 			   FdocaConstants.DRDA_TYPE_LOBBYTES
>+	 * 			   FdocaConstants.DRDA_TYPE_NLOBCMIXED
>+	 *  		   FdocaConstants.DRDA_TYPE_LOBCMIXED
>+	 * 
>+	 * @returns null if the value is null or a new EXTDTAInputStream corresponding to 
>+	 *  		rs.getBinaryStream(column) value and associated length
>+	 * 
>+	 * @throws SQLException
>+	 */
>+	public static EXTDTAInputStream getEXTDTAStream(ResultSet rs, int column, int drdaType) 
>+			throws SQLException {
>+		
>+		EXTDTAInputStream extdtaStream = null;
>+		int length = 0;
>+		byte[] bytes = null;
>+		
>+		int ndrdaType = drdaType | 1; //nullable drdaType
>+		// BLOBS
>+		if (ndrdaType == FdocaConstants.DRDA_TYPE_NLOBBYTES) 
>+		{
>+			//TODO: Change to just use rs.getBinaryStream() by 
>+			// eliminating the need for a length parameter in
>+			//DDMWriter.writeScalarStream and therefore eliminating the need for dataLength in this class
>+			bytes = rs.getBytes(column);
>+			
>+		}
>+		// CLOBS
>+		else if (ndrdaType ==  FdocaConstants.DRDA_TYPE_NLOBCMIXED)
>+		{	
>+			//TODO: Change to use getCharacterStream and change the read method
>+			// to stream the data after length is no longer needed in DDMWRiter.writeScalarStream
>+			String s  = rs.getString(column);
>+			try {
>+				if (s != null)
>+					bytes = s.getBytes(NetworkServerControlImpl.DEFAULT_ENCODING);
>+			}
>+			catch (java.io.UnsupportedEncodingException e) {
>+				throw new SQLException (e.getMessage());
>+			}
>+		}
>+		else
>+		{
>+			SanityManager.THROWASSERT("DRDAType: " + drdaType +
>+						" not valid EXTDTA object type");
>+		}
>+		
>+		if (bytes != null)
>+		{
>+			length = bytes.length;
>+			InputStream is = new ByteArrayInputStream(bytes);
>+			extdtaStream =  new EXTDTAInputStream(length, is);
>+		}
>+		
>+		return extdtaStream;
>+	}
>+
>+	
>+	/**
>+	 * Get the length of the InputStream 
>+	 * This method is currently not used because there seems to be no way to 
>+	 * reset the she stream.
>+	 *   
>+	 * @param binaryInputStream
>+	 *            an InputStream whose length needs to be calclulated
>+	 * @return length of stream
>+	 */
>+	private static long getInputStreamLength(InputStream binaryInputStream)
>+			throws SQLException {
>+		long length = 0;
>+		if (binaryInputStream == null)
>+			return length;
>+		
>+		try {
>+			for (;;) {
>+				int avail = binaryInputStream.available();
>+				binaryInputStream.skip(avail);
>+				if (avail == 0)
>+					break;
>+				length += avail;
>+				
>+			}
>+			//binaryInputStream.close();
>+		} catch (IOException ioe) {
>+			throw Util.javaException(ioe);
>+		}
>+
>+		return length;
>+
>+	}
>+	
>+	
>+	
>+	/**
>+	 * Return the length of the binary stream which was calculated when
>+	 * EXTDTAObject was created.
>+	 * 
>+	 * @return the length of the stream once converted to an InputStream
>+	 */
>+	public long length() throws SQLException {
>+		return dataLength;
>+		
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#read()
>+	 */
>+	public int read() throws IOException {
>+		return binaryInputStream.read();
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#available()
>+	 */
>+	public int available() throws IOException {
>+		return binaryInputStream.available();
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#close()
>+	 */
>+	public void close() throws IOException {
>+		if (binaryInputStream != null)
>+			binaryInputStream.close();	
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.lang.Object#equals(java.lang.Object)
>+	 */
>+	public boolean equals(Object arg0) {
>+		return binaryInputStream.equals(arg0);
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.lang.Object#hashCode()
>+	 */
>+	public int hashCode() {
>+		return binaryInputStream.hashCode();
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#mark(int)
>+	 */
>+	public void mark(int arg0) {
>+		binaryInputStream.mark(arg0);
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#markSupported()
>+	 */
>+	public boolean markSupported() {
>+		return binaryInputStream.markSupported();
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#read(byte[])
>+	 */
>+	public int read(byte[] arg0) throws IOException {
>+		return binaryInputStream.read(arg0);
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#read(byte[], int, int)
>+	 */
>+	public int read(byte[] arg0, int arg1, int arg2) throws IOException {
>+		return binaryInputStream.read(arg0, arg1, arg2);
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#reset()
>+	 */
>+	public void reset() throws IOException {
>+		binaryInputStream.reset();
>+	}
>+
>+	/**
>+	 * 
>+	 * 
>+	 * @see java.io.InputStream#skip(long)
>+	 */
>+	public long skip(long arg0) throws IOException {
>+		return binaryInputStream.skip(arg0);
>+	}
>+
>+
>+}
>
>Propchange: incubator/derby/code/trunk/java/drda/org/apache/derby/impl/drda/EXTDTAInputStream.java
>------------------------------------------------------------------------------
>    svn:eol-style = native
>
>Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out
>URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out?rev=179014&r1=179013&r2=179014&view=diff
>==============================================================================
>--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out (original)
>+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNet/blobclob4BLOB.out Sun May 29 22:36:14 2005
>@@ -1,26 +1,35 @@
> Test blobclob starting
>+START: prepareCLOBMAIN
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: prepareSearchClobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+prepareSearchClobTable finished
>+START: prepareUnicodeTable
>+START: prepareUnicodeFile
> unicode string 0 correct
> unicode string 1 correct
> unicode string 2 correct
> Finished prepareUnicodeFile
>+START: setCharacterStreamTest
> Length of clob is 5009
> unicode string 0 matched
> unicode string 1 matched
> unicode string 2 matched
> EOF matched
> setCharacterStreamTest finished
>+START: clobTest0
> clobTest0 finished
>+START: clobTest1
> clobTest11 finished
>+START: clobTest12
> Succeeded to match, row 1
> PASSED, row 1, length was 3
> Succeeded to match, row 2
>@@ -34,16 +43,17 @@
> Succeeded to match, row 6
> PASSED, row 6, length was 5016
> clobTest12 finished
>+START: clobTest2
> CLOB getSubString 9905 > 0
>-Known JCC Bug 5914 - String index out of range: -9904
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 0
>-Known JCC Bug 5914 - String index out of range: -203
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 0
>-Known JCC Bug 5914 - String index out of range: -67
>+EXPECTED Out of bounds exception
> CLOB getSubString 1 > 0
> 1(5) (len 50) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
>@@ -51,52 +61,52 @@
> 1(6) (len 1) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
> CLOB getSubString 9905 > 65
>-Known JCC Bug 5914 - String index out of range: -9839
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 65
>-Known JCC Bug 5914 - String index out of range: -5844
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 65
>-Known JCC Bug 5914 - String index out of range: -5844
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 65
>-Known JCC Bug 5914 - String index out of range: -138
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 65
>-Known JCC Bug 5914 - String index out of range: -2
>+EXPECTED Out of bounds exception
> 2(5) (len 50) you can lead a horse to water but you can't form i
> 2(6) (len 1) y
> CLOB getSubString 9905 > 26
>-Known JCC Bug 5914 - String index out of range: -9878
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 26
>-Known JCC Bug 5914 - String index out of range: -5883
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 26
>-Known JCC Bug 5914 - String index out of range: -5883
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 26
>-Known JCC Bug 5914 - String index out of range: -177
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 26
>-Known JCC Bug 5914 - String index out of range: -41
>+EXPECTED Out of bounds exception
> 3(5) (len 50) a stitch in time says ouch
> 3(6) (len 1) a
> CLOB getSubString 9905 > 42
>-Known JCC Bug 5914 - String index out of range: -9862
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 42
>-Known JCC Bug 5914 - String index out of range: -5867
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 42
>-Known JCC Bug 5914 - String index out of range: -5867
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 42
>-Known JCC Bug 5914 - String index out of range: -161
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 42
>-Known JCC Bug 5914 - String index out of range: -25
>+EXPECTED Out of bounds exception
> 4(5) (len 50) here is a string with a return 
>  character
> 4(6) (len 1) h
> CLOB getSubString 9905 > 56
>-Known JCC Bug 5914 - String index out of range: -9848
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 56
>-Known JCC Bug 5914 - String index out of range: -5853
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 56
>-Known JCC Bug 5914 - String index out of range: -5853
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 56
>-Known JCC Bug 5914 - String index out of range: -147
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 56
>-Known JCC Bug 5914 - String index out of range: -11
>+EXPECTED Out of bounds exception
> 5(5) (len 50) test data: a string column inserted as an Ascii st
> 5(6) (len 1) t
> 6(0) (len 50) wwPosition-9907-behold-the-end-of-the-clob-is-nigh
>@@ -111,15 +121,15 @@
> 6(7) 
> wwwwwwPosition-9907-behold-the-end-of-the-clob-is-nighwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> CLOB getSubString 9905 > 0
>-Known JCC Bug 5914 - String index out of range: -9904
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 0
>-Known JCC Bug 5914 - String index out of range: -203
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 0
>-Known JCC Bug 5914 - String index out of range: -67
>+EXPECTED Out of bounds exception
> CLOB getSubString 1 > 0
> 7(5) (len 50) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
>@@ -127,11 +137,11 @@
> 7(6) (len 1) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
> CLOB getSubString 9905 > 5000
>-Known JCC Bug 5914 - String index out of range: -4904
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 5000
>-Known JCC Bug 5914 - String index out of range: -909
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 5000
>-Known JCC Bug 5914 - String index out of range: -909
>+EXPECTED Out of bounds exception
> 8(3) (len 50) wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> 8(4) (len 50) wwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> wwwwwwwwwwwwwwwww
>@@ -151,6 +161,7 @@
> 9(7) 
> wwHere-I-am-at-position-299003-near-the-end-of-the-clobwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> clobTest2 finished
>+START: clobTest22
> Row 1 : Succeeded
> Row 2 : Succeeded
> Row 3 : Succeeded
>@@ -161,6 +172,7 @@
> Row 6 : Succeeded
> Second time Succeeded
> clobTest22 finished
>+START: clobTest3
> Found horse in row 1 starting from position 1 at position  NOTFOUND 
> Found ouch in row 1 starting from position 1 at position  NOTFOUND 
> Found 
>@@ -266,6 +278,7 @@
> Found I-am-hiding-here-at-position-5910 in row 8 starting from position 5911 at position  NOTFOUND 
> Found Position-9907 in row 8 starting from position 1 at position  NOTFOUND 
> clobTest3 finished
>+START: clobTest32
> Succeeded: Found unicode string 0 at position 1,row 1
> Succeeded: Found unicode string 0 at position -1,row 1
> Succeeded: Found unicode string 1 at position 1,row 2
>@@ -279,6 +292,7 @@
> Succeeded: Found unicode string 2 at position 1,row 6
> Succeeded: Found unicode string 2 at position 5004,row 6
> clobTest32 finished
>+START: clobTest4
> position(clob) NOT FOUND 1 searchStr horse
> position(clob) NOT FOUND 1 searchStr ouch
> position(clob) NOT FOUND 1 searchStr 
>@@ -390,25 +404,30 @@
> searchClob row 13 skipped (too large)
> testCLOB_MAIN row 9 skipped (too large)
> clobTest4 finished
>+START: clobTest42
> Succeeded: Found clob at position 1,row 0
> Succeeded: Found clob at position 1,row 1
> Succeeded: Found clob at position 1,row 2
> clobTest42 finished
>+START: clobTest51
> clobTest51 finished
>+START: clobTest52
> create table testInteger (a integer)
> insert into testInteger values('158')
> select a from testInteger
> getClob(1)
> 52: SQLException
> EXPECTED SQL Exception: Invalid data conversion: Wrong result column type for requested conversion.
>+START: clobTest53
> clobTest53 finished
>-start clobTest54
>+START: clobTest54
> EXPECTED SQLSTATE(22018): Invalid character string format for type INTEGER.
> end clobTest54
>+START: clobTest6
>  negative tests for clob.getSubstring won't run  for network server  until 5243 is fixed
>-start clobTest7
>+START: clobTest7
> clobTest7 finished
>-start clobTest8
>+START: clobTest8
> small string pattern
> @1  position MATCH(129)
> @2  position MATCH(2074)
>@@ -476,6 +495,7 @@
> @9  position MATCH(-1)
> @10  position MATCH(-1)
> complete clobTest8
>+START: clobTest91
> done row 0, length was 0
> done row 1, length was 65
> done row 2, length was 26
>@@ -487,29 +507,37 @@
> done row 8, length was 300000
> row 9 is null, skipped
> clobTest91 finished
>-FAIL -- unexpected exception ****************
>-SQLSTATE(40XL1): A lock could not be obtained within the time requested
>+START: clobTest92
> clobTest92 finished
>+START: clobTest93
>+clobTest92 finished
>+START: clobTest94
> shortClob length after commit is 26
> clobTest94 finished
>+START: clobTest95
> shortClob length after closing connection is 26
> EXPECTED SQL Exception: Lob method called after connection was closed
> EXPECTED SQL Exception: Lob method called after connection was closed
> EXPECTED SQL Exception: Lob method called after connection was closed
> EXPECTED SQL Exception: Lob method called after connection was closed
> clobTest95 finished
>+START: clobTest96
> clobTest96 finished
>+START: prepareBlobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: prepareSearchBlobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: blobTest0
> blobTest0 finished
>+START: blobTest2
> testing Blob.getBytes() with pos 9905 > 0
> Known JCC Bug 5914
> testing Blob.getBytes() with pos 5910 > 0
>@@ -627,6 +655,7 @@
> 9(7) 
> wwHere-I-am-at-position-299003-near-the-end-of-the-clobwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> blobTest2 finished
>+START: blobTest3
> Found horse in row 2 starting from position 1 at position 16
> Found ouch in row 3 starting from position 1 at position 23
> Found 
>@@ -644,6 +673,7 @@
> Found 
>  in row 8 starting from position 1 at position 100
> blobTest3 finished
>+START: blobTest4
> searchBlob row 13 skipped (too large)
> Found horse in row 2 at position 16
> searchBlob row 13 skipped (too large)
>@@ -673,16 +703,23 @@
> searchBlob row 13 skipped (too large)
> testBlob row 9 skipped (too large)
> blobTest4 finished
>+START: blobTest51
> blobTest51 finished
>+START: blobTest52
> EXPECTED SQLSTATE(null): Invalid data conversion: Wrong result column type for requested conversion.
>+START: blobTest53
> blobTest53 finished
>+START: blobTest54
> EXPECTED SQLSTATE(XCL12): An attempt was made to put a data value of type 'byte[]' into a data value of type 'INTEGER'.
>+START: blobTest6
> EXPECTED SQLSTATE(null): Invalid position 0 or length 5
> EXPECTED SQLSTATE(null): Invalid position 1 or length -76
> EXPECTED SQLSTATE(null): Search pattern cannot be null.
> EXPECTED SQLSTATE(null): Search pattern cannot be null.
> blobTest6 finished
>+START: blobTest7
> blobTest7 finished
>+START: blobTest91
> done row 0, length was 0
> done row 1, length was 65
> done row 2, length was 26
>@@ -694,11 +731,15 @@
> done row 8, length was 300000
> row 9 is null, skipped
> blobTest91 finished
>-FAIL -- unexpected exception ****************
>-SQLSTATE(40XL1): A lock could not be obtained within the time requested
>+START: blobTest92
>+Locks not held by Network Server for Blobs since they are materialized on client
>+blobTest92 finished
>+START: blobTest93
> blobTest93 finished
>+START: blobTest94
> shortBlob length after commit is 26
> blobTest94 finished
>+START: blobTest95
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
>@@ -706,20 +747,25 @@
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> blobTest95 finished
>+START: blobTest96
> blobTest96 finished
>+START: clobTestSelfDestructive
> length of clob chosen is 10000
> After update
> Row 1 value.substring(0,50) is jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
> 10000 total bytes read
> clobTestSelfDestructive finished
>+START: clobTestSelfDestructive2
> length of clob chosen is 10000
> After drop
> Expect to get an IOException, container has been closed
> 10000 total bytes read
> clobTestSelfDestructive2 finished
>+START: clobNegativeTest_Derby265
> -----
>-Expected Exception The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>+EXPECTED SQLSTATE(XCL30): An IOException was thrown when reading a 'java.sql.String' from an InputStream. SQLSTATE: XJ001: Java exception: 'ERROR 40XD0: Container has been closed: java.io.IOException'.
>+START: blobTestNegativeTest_Derby265
> -----
>-Expected Exception The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>+EXPECTED SQLSTATE(XCL30): An IOException was thrown when reading a 'BLOB' from an InputStream. SQLSTATE: XJ001: Java exception: 'ERROR 40XD0: Container has been closed: java.io.IOException'.
> FINISHED TEST blobclob :-)
> Test blobclob finished
>
>Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out
>URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out?rev=179014&r1=179013&r2=179014&view=diff
>==============================================================================
>--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out (original)
>+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/blobclob4BLOB.out Sun May 29 22:36:14 2005
>@@ -1,26 +1,35 @@
> Test blobclob starting
>+START: prepareCLOBMAIN
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: prepareSearchClobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+prepareSearchClobTable finished
>+START: prepareUnicodeTable
>+START: prepareUnicodeFile
> unicode string 0 correct
> unicode string 1 correct
> unicode string 2 correct
> Finished prepareUnicodeFile
>+START: setCharacterStreamTest
> Length of clob is 5009
> unicode string 0 matched
> unicode string 1 matched
> unicode string 2 matched
> EOF matched
> setCharacterStreamTest finished
>+START: clobTest0
> clobTest0 finished
>+START: clobTest1
> clobTest11 finished
>+START: clobTest12
> Succeeded to match, row 1
> PASSED, row 1, length was 3
> Succeeded to match, row 2
>@@ -34,16 +43,17 @@
> Succeeded to match, row 6
> PASSED, row 6, length was 5016
> clobTest12 finished
>+START: clobTest2
> CLOB getSubString 9905 > 0
>-Known JCC Bug 5914 - String index out of range: -9904
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 0
>-Known JCC Bug 5914 - String index out of range: -203
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 0
>-Known JCC Bug 5914 - String index out of range: -67
>+EXPECTED Out of bounds exception
> CLOB getSubString 1 > 0
> 1(5) (len 50) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
>@@ -51,52 +61,52 @@
> 1(6) (len 1) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
> CLOB getSubString 9905 > 65
>-Known JCC Bug 5914 - String index out of range: -9839
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 65
>-Known JCC Bug 5914 - String index out of range: -5844
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 65
>-Known JCC Bug 5914 - String index out of range: -5844
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 65
>-Known JCC Bug 5914 - String index out of range: -138
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 65
>-Known JCC Bug 5914 - String index out of range: -2
>+EXPECTED Out of bounds exception
> 2(5) (len 50) you can lead a horse to water but you can't form i
> 2(6) (len 1) y
> CLOB getSubString 9905 > 26
>-Known JCC Bug 5914 - String index out of range: -9878
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 26
>-Known JCC Bug 5914 - String index out of range: -5883
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 26
>-Known JCC Bug 5914 - String index out of range: -5883
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 26
>-Known JCC Bug 5914 - String index out of range: -177
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 26
>-Known JCC Bug 5914 - String index out of range: -41
>+EXPECTED Out of bounds exception
> 3(5) (len 50) a stitch in time says ouch
> 3(6) (len 1) a
> CLOB getSubString 9905 > 42
>-Known JCC Bug 5914 - String index out of range: -9862
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 42
>-Known JCC Bug 5914 - String index out of range: -5867
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 42
>-Known JCC Bug 5914 - String index out of range: -5867
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 42
>-Known JCC Bug 5914 - String index out of range: -161
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 42
>-Known JCC Bug 5914 - String index out of range: -25
>+EXPECTED Out of bounds exception
> 4(5) (len 50) here is a string with a return 
>  character
> 4(6) (len 1) h
> CLOB getSubString 9905 > 56
>-Known JCC Bug 5914 - String index out of range: -9848
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 56
>-Known JCC Bug 5914 - String index out of range: -5853
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 56
>-Known JCC Bug 5914 - String index out of range: -5853
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 56
>-Known JCC Bug 5914 - String index out of range: -147
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 56
>-Known JCC Bug 5914 - String index out of range: -11
>+EXPECTED Out of bounds exception
> 5(5) (len 50) test data: a string column inserted as an Ascii st
> 5(6) (len 1) t
> 6(0) (len 50) wwPosition-9907-behold-the-end-of-the-clob-is-nigh
>@@ -111,15 +121,15 @@
> 6(7) 
> wwwwwwPosition-9907-behold-the-end-of-the-clob-is-nighwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> CLOB getSubString 9905 > 0
>-Known JCC Bug 5914 - String index out of range: -9904
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 0
>-Known JCC Bug 5914 - String index out of range: -5909
>+EXPECTED Out of bounds exception
> CLOB getSubString 204 > 0
>-Known JCC Bug 5914 - String index out of range: -203
>+EXPECTED Out of bounds exception
> CLOB getSubString 68 > 0
>-Known JCC Bug 5914 - String index out of range: -67
>+EXPECTED Out of bounds exception
> CLOB getSubString 1 > 0
> 7(5) (len 50) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
>@@ -127,11 +137,11 @@
> 7(6) (len 1) 
> CLOB FAIL - NO ERROR ON getSubString POS TOO LARGE 1 > 0
> CLOB getSubString 9905 > 5000
>-Known JCC Bug 5914 - String index out of range: -4904
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 5000
>-Known JCC Bug 5914 - String index out of range: -909
>+EXPECTED Out of bounds exception
> CLOB getSubString 5910 > 5000
>-Known JCC Bug 5914 - String index out of range: -909
>+EXPECTED Out of bounds exception
> 8(3) (len 50) wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> 8(4) (len 50) wwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> wwwwwwwwwwwwwwwww
>@@ -151,6 +161,7 @@
> 9(7) 
> wwHere-I-am-at-position-299003-near-the-end-of-the-clobwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> clobTest2 finished
>+START: clobTest22
> Row 1 : Succeeded
> Row 2 : Succeeded
> Row 3 : Succeeded
>@@ -161,6 +172,7 @@
> Row 6 : Succeeded
> Second time Succeeded
> clobTest22 finished
>+START: clobTest3
> Found horse in row 1 starting from position 1 at position  NOTFOUND 
> Found ouch in row 1 starting from position 1 at position  NOTFOUND 
> Found 
>@@ -266,6 +278,7 @@
> Found I-am-hiding-here-at-position-5910 in row 8 starting from position 5911 at position  NOTFOUND 
> Found Position-9907 in row 8 starting from position 1 at position  NOTFOUND 
> clobTest3 finished
>+START: clobTest32
> Succeeded: Found unicode string 0 at position 1,row 1
> Succeeded: Found unicode string 0 at position -1,row 1
> Succeeded: Found unicode string 1 at position 1,row 2
>@@ -279,6 +292,7 @@
> Succeeded: Found unicode string 2 at position 1,row 6
> Succeeded: Found unicode string 2 at position 5004,row 6
> clobTest32 finished
>+START: clobTest4
> position(clob) NOT FOUND 1 searchStr horse
> position(clob) NOT FOUND 1 searchStr ouch
> position(clob) NOT FOUND 1 searchStr 
>@@ -390,25 +404,30 @@
> searchClob row 13 skipped (too large)
> testCLOB_MAIN row 9 skipped (too large)
> clobTest4 finished
>+START: clobTest42
> Succeeded: Found clob at position 1,row 0
> Succeeded: Found clob at position 1,row 1
> Succeeded: Found clob at position 1,row 2
> clobTest42 finished
>+START: clobTest51
> clobTest51 finished
>+START: clobTest52
> create table testInteger (a integer)
> insert into testInteger values('158')
> select a from testInteger
> getClob(1)
> 52: SQLException
> EXPECTED SQL Exception: Invalid data conversion: Wrong result column type for requested conversion.
>+START: clobTest53
> clobTest53 finished
>-start clobTest54
>+START: clobTest54
> EXPECTED SQLSTATE(22018): Invalid character string format for type INTEGER.
> end clobTest54
>+START: clobTest6
>  negative tests for clob.getSubstring won't run  for network server  until 5243 is fixed
>-start clobTest7
>+START: clobTest7
> clobTest7 finished
>-start clobTest8
>+START: clobTest8
> small string pattern
> @1  position MATCH(129)
> @2  position MATCH(2074)
>@@ -476,6 +495,7 @@
> @9  position MATCH(-1)
> @10  position MATCH(-1)
> complete clobTest8
>+START: clobTest91
> done row 0, length was 0
> done row 1, length was 65
> done row 2, length was 26
>@@ -487,29 +507,37 @@
> done row 8, length was 300000
> row 9 is null, skipped
> clobTest91 finished
>-FAIL -- unexpected exception ****************
>-SQLSTATE(40XL1): A lock could not be obtained within the time requested
>+START: clobTest92
> clobTest92 finished
>+START: clobTest93
>+clobTest92 finished
>+START: clobTest94
> shortClob length after commit is 26
> clobTest94 finished
>+START: clobTest95
> shortClob length after closing connection is 26
> EXPECTED SQL Exception: Lob method called after connection was closed
> EXPECTED SQL Exception: Lob method called after connection was closed
> EXPECTED SQL Exception: Lob method called after connection was closed
> EXPECTED SQL Exception: Lob method called after connection was closed
> clobTest95 finished
>+START: clobTest96
> clobTest96 finished
>+START: prepareBlobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: prepareSearchBlobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: blobTest0
> blobTest0 finished
>+START: blobTest2
> testing Blob.getBytes() with pos 9905 > 0
> Known JCC Bug 5914
> testing Blob.getBytes() with pos 5910 > 0
>@@ -627,6 +655,7 @@
> 9(7) 
> wwHere-I-am-at-position-299003-near-the-end-of-the-clobwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> blobTest2 finished
>+START: blobTest3
> Found horse in row 2 starting from position 1 at position 16
> Found ouch in row 3 starting from position 1 at position 23
> Found 
>@@ -644,6 +673,7 @@
> Found 
>  in row 8 starting from position 1 at position 100
> blobTest3 finished
>+START: blobTest4
> searchBlob row 13 skipped (too large)
> Found horse in row 2 at position 16
> searchBlob row 13 skipped (too large)
>@@ -673,16 +703,23 @@
> searchBlob row 13 skipped (too large)
> testBlob row 9 skipped (too large)
> blobTest4 finished
>+START: blobTest51
> blobTest51 finished
>+START: blobTest52
> EXPECTED SQLSTATE(null): Invalid data conversion: Wrong result column type for requested conversion.
>+START: blobTest53
> blobTest53 finished
>+START: blobTest54
> EXPECTED SQLSTATE(XCL12): An attempt was made to put a data value of type 'byte[]' into a data value of type 'INTEGER'.
>+START: blobTest6
> EXPECTED SQLSTATE(null): Invalid position 0 or length 5
> EXPECTED SQLSTATE(null): Invalid position 1 or length -76
> EXPECTED SQLSTATE(null): Search pattern cannot be null.
> EXPECTED SQLSTATE(null): Search pattern cannot be null.
> blobTest6 finished
>+START: blobTest7
> blobTest7 finished
>+START: blobTest91
> done row 0, length was 0
> done row 1, length was 65
> done row 2, length was 26
>@@ -694,11 +731,15 @@
> done row 8, length was 300000
> row 9 is null, skipped
> blobTest91 finished
>-FAIL -- unexpected exception ****************
>-SQLSTATE(40XL1): A lock could not be obtained within the time requested
>+START: blobTest92
>+Locks not held by Network Server for Blobs since they are materialized on client
>+blobTest92 finished
>+START: blobTest93
> blobTest93 finished
>+START: blobTest94
> shortBlob length after commit is 26
> blobTest94 finished
>+START: blobTest95
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
>@@ -706,20 +747,25 @@
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> EXPECTED SQLSTATE(null): Lob method called after connection was closed
> blobTest95 finished
>+START: blobTest96
> blobTest96 finished
>+START: clobTestSelfDestructive
> length of clob chosen is 10000
> After update
> Row 1 value.substring(0,50) is jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
> 10000 total bytes read
> clobTestSelfDestructive finished
>+START: clobTestSelfDestructive2
> length of clob chosen is 10000
> After drop
> Expect to get an IOException, container has been closed
> 10000 total bytes read
> clobTestSelfDestructive2 finished
>+START: clobNegativeTest_Derby265
> -----
>-Expected Exception The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>+EXPECTED SQLSTATE(XCL30): An IOException was thrown when reading a 'java.sql.String' from an InputStream. SQLSTATE: XJ001: Java exception: 'ERROR 40XD0: Container has been closed: java.io.IOException'.
>+START: blobTestNegativeTest_Derby265
> -----
>-Expected Exception The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>+EXPECTED SQLSTATE(XCL30): An IOException was thrown when reading a 'BLOB' from an InputStream. SQLSTATE: XJ001: Java exception: 'ERROR 40XD0: Container has been closed: java.io.IOException'.
> FINISHED TEST blobclob :-)
> Test blobclob finished
>
>Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/blobclob4BLOB.out
>URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/blobclob4BLOB.out?rev=179014&r1=179013&r2=179014&view=diff
>==============================================================================
>--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/blobclob4BLOB.out (original)
>+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/blobclob4BLOB.out Sun May 29 22:36:14 2005
>@@ -1,26 +1,35 @@
> Test blobclob starting
>+START: prepareCLOBMAIN
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: prepareSearchClobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+prepareSearchClobTable finished
>+START: prepareUnicodeTable
>+START: prepareUnicodeFile
> unicode string 0 correct
> unicode string 1 correct
> unicode string 2 correct
> Finished prepareUnicodeFile
>+START: setCharacterStreamTest
> Length of clob is 5009
> unicode string 0 matched
> unicode string 1 matched
> unicode string 2 matched
> EOF matched
> setCharacterStreamTest finished
>+START: clobTest0
> clobTest0 finished
>+START: clobTest1
> clobTest11 finished
>+START: clobTest12
> Succeeded to match, row 1
> PASSED, row 1, length was 3
> Succeeded to match, row 2
>@@ -34,6 +43,7 @@
> Succeeded to match, row 6
> PASSED, row 6, length was 5016
> clobTest12 finished
>+START: clobTest2
> CLOB getSubString 9905 > 0
> EXPECTED SQLSTATE(XJ076): The position argument '9,905' exceeds the size of the Blob/Clob.
> CLOB getSubString 5910 > 0
>@@ -147,6 +157,7 @@
> 9(7) 
> wwHere-I-am-at-position-299003-near-the-end-of-the-clobwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> clobTest2 finished
>+START: clobTest22
> Row 1 : Succeeded
> Row 2 : Succeeded
> Row 3 : Succeeded
>@@ -157,6 +168,7 @@
> Row 6 : Succeeded
> Second time Succeeded
> clobTest22 finished
>+START: clobTest3
> Found horse in row 1 starting from position 1 at position  NOTFOUND 
> Found ouch in row 1 starting from position 1 at position  NOTFOUND 
> Found 
>@@ -262,6 +274,7 @@
> Found I-am-hiding-here-at-position-5910 in row 8 starting from position 5911 at position  NOTFOUND 
> Found Position-9907 in row 8 starting from position 1 at position  NOTFOUND 
> clobTest3 finished
>+START: clobTest32
> Succeeded: Found unicode string 0 at position 1,row 1
> Succeeded: Found unicode string 0 at position -1,row 1
> Succeeded: Found unicode string 1 at position 1,row 2
>@@ -275,6 +288,7 @@
> Succeeded: Found unicode string 2 at position 1,row 6
> Succeeded: Found unicode string 2 at position 5004,row 6
> clobTest32 finished
>+START: clobTest4
> position(clob) NOT FOUND 1 searchStr horse
> position(clob) NOT FOUND 1 searchStr ouch
> position(clob) NOT FOUND 1 searchStr 
>@@ -386,11 +400,14 @@
> searchClob row 13 skipped (too large)
> testCLOB_MAIN row 9 skipped (too large)
> clobTest4 finished
>+START: clobTest42
> Succeeded: Found clob at position 1,row 0
> Succeeded: Found clob at position 1,row 1
> Succeeded: Found clob at position 1,row 2
> clobTest42 finished
>+START: clobTest51
> clobTest51 finished
>+START: clobTest52
> create table testInteger (a integer)
> insert into testInteger values('158')
> select a from testInteger
>@@ -398,10 +415,12 @@
> 52: SQLException
> FAIL -- unexpected exception ****************
> SQLSTATE(22005): An attempt was made to get a data value of type 'java.sql.Clob' from a data value of type 'INTEGER'.
>+START: clobTest53
> clobTest53 finished
>-start clobTest54
>+START: clobTest54
> EXPECTED SQLSTATE(22005): An attempt was made to get a data value of type 'INTEGER' from a data value of type 'java.sql.Clob'.
> end clobTest54
>+START: clobTest6
> EXPECTED SQLSTATE(XJ070): Negative or zero position argument '0' passed in a Blob or Clob method.
> EXPECTED SQLSTATE(XJ071): Zero or negative length argument '-76' passed in a Blob or Clob method.
> EXPECTED SQLSTATE(XJ071): Zero or negative length argument '0' passed in a Blob or Clob method.
>@@ -410,9 +429,9 @@
> EXPECTED SQLSTATE(XJ070): Negative or zero position argument '-42' passed in a Blob or Clob method.
> EXPECTED SQLSTATE(XJ072): Null pattern or searchStr passed in to a Blob or Clob position method.
> clobTest6 finished
>-start clobTest7
>+START: clobTest7
> clobTest7 finished
>-start clobTest8
>+START: clobTest8
> small string pattern
> @1  position MATCH(129)
> @2  position MATCH(2074)
>@@ -480,6 +499,7 @@
> @9  position MATCH(-1)
> @10  position MATCH(-1)
> complete clobTest8
>+START: clobTest91
> done row 0, length was 0
> done row 1, length was 65
> done row 2, length was 26
>@@ -491,9 +511,12 @@
> done row 8, length was 300000
> row 9 is null, skipped
> clobTest91 finished
>+START: clobTest92
> FAIL -- unexpected exception ****************
> SQLSTATE(40XL1): A lock could not be obtained within the time requested
>+START: clobTest93
> clobTest92 finished
>+START: clobTest94
> shortClob length after commit is 26
> FAIL -- unexpected exception ****************
> SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>@@ -506,6 +529,7 @@
> FAIL -- unexpected exception ****************
> SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
> clobTest94 finished
>+START: clobTest95
> shortClob length after closing connection is 26
> FAIL -- unexpected exception ****************
> SQLSTATE(08003): No current connection.
>@@ -518,18 +542,23 @@
> FAIL -- unexpected exception ****************
> SQLSTATE(08003): No current connection.
> clobTest95 finished
>+START: clobTest96
> clobTest96 finished
>+START: prepareBlobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: prepareSearchBlobTable
> ===> inserting extin/short.txt length = 56
> ===> inserting extin/littleclob.txt length = 10000
> ===> inserting extin/empty.txt length = 0
> ===> inserting extin/searchclob.txt length = 5000
> ===> inserting extin/aclob.txt length = 300000
>+START: blobTest0
> blobTest0 finished
>+START: blobTest2
> testing Blob.getBytes() with pos 9905 > 0
> EXPECTED SQLSTATE(XJ076): The position argument '9,905' exceeds the size of the Blob/Clob.
> testing Blob.getBytes() with pos 5910 > 0
>@@ -643,6 +672,7 @@
> 9(7) 
> wwHere-I-am-at-position-299003-near-the-end-of-the-clobwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
> blobTest2 finished
>+START: blobTest3
> Found horse in row 2 starting from position 1 at position 16
> Found ouch in row 3 starting from position 1 at position 23
> Found 
>@@ -660,6 +690,7 @@
> Found 
>  in row 8 starting from position 1 at position 100
> blobTest3 finished
>+START: blobTest4
> FAIL -- unexpected exception ****************
> SQLSTATE(XJ077): Got an exception when trying to read the first byte/character of the Blob/Clob pattern using getBytes/getSubString.
> FAIL -- unexpected exception ****************
>@@ -721,12 +752,17 @@
> searchBlob row 13 skipped (too large)
> testBlob row 9 skipped (too large)
> blobTest4 finished
>+START: blobTest51
> blobTest51 finished
>+START: blobTest52
> FAIL -- unexpected exception ****************
> SQLSTATE(22005): An attempt was made to get a data value of type 'java.sql.Blob' from a data value of type 'INTEGER'.
>+START: blobTest53
> blobTest53 finished
>+START: blobTest54
> FAIL -- unexpected exception ****************
> SQLSTATE(22005): An attempt was made to get a data value of type 'INTEGER' from a data value of type 'java.sql.Blob'.
>+START: blobTest6
> EXPECTED SQLSTATE(XJ070): Negative or zero position argument '0' passed in a Blob or Clob method.
> EXPECTED SQLSTATE(XJ071): Zero or negative length argument '-76' passed in a Blob or Clob method.
> EXPECTED SQLSTATE(XJ071): Zero or negative length argument '0' passed in a Blob or Clob method.
>@@ -735,7 +771,9 @@
> EXPECTED SQLSTATE(XJ070): Negative or zero position argument '-42' passed in a Blob or Clob method.
> EXPECTED SQLSTATE(XJ072): Null pattern or searchStr passed in to a Blob or Clob position method.
> blobTest6 finished
>+START: blobTest7
> blobTest7 finished
>+START: blobTest91
> done row 0, length was 0
> done row 1, length was 65
> done row 2, length was 26
>@@ -747,9 +785,12 @@
> done row 8, length was 300000
> row 9 is null, skipped
> blobTest91 finished
>+START: blobTest92
> FAIL -- unexpected exception ****************
> SQLSTATE(40XL1): A lock could not be obtained within the time requested
>+START: blobTest93
> blobTest93 finished
>+START: blobTest94
> shortBlob length after commit is 26
> FAIL -- unexpected exception ****************
> SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>@@ -762,6 +803,7 @@
> FAIL -- unexpected exception ****************
> SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
> blobTest94 finished
>+START: blobTest95
> shortBlob length after closing the connection is 26
> FAIL -- unexpected exception ****************
> SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>@@ -774,19 +816,24 @@
> FAIL -- unexpected exception ****************
> SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
> blobTest95 finished
>+START: blobTest96
> blobTest96 finished
>+START: clobTestSelfDestructive
> length of clob chosen is 10000
> After update
> Row 1 value.substring(0,50) is jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj
> 10000 total bytes read
> clobTestSelfDestructive finished
>+START: clobTestSelfDestructive2
> length of clob chosen is 10000
> After drop
> Expect to get an IOException, container has been closed
> EXPECTED IO Exception:ERROR 40XD0: Container has been closed
>+START: clobNegativeTest_Derby265
> -----------------------------
>-Expected Exception The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>+EXPECTED SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>+START: blobTestNegativeTest_Derby265
> -----------------------------
>-Expected Exception The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
>+EXPECTED SQLSTATE(XJ073): The data in this Blob or Clob is no longer available. Possible reasons are that its transaction committed, or its connection closed.
> FINISHED TEST blobclob :-)
> Test blobclob finished
>
>Modified: incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/blobclob4BLOB.java
>URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/blobclob4BLOB.java?rev=179014&r1=179013&r2=179014&view=diff
>==============================================================================
>--- incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/blobclob4BLOB.java (original)
>+++ incubator/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/blobclob4BLOB.java Sun May 29 22:36:14 2005
>@@ -20,26 +20,34 @@
> 
> package org.apache.derbyTesting.functionTests.tests.jdbcapi;
> 
>-import org.apache.derbyTesting.functionTests.util.TestUtil;
>-import org.apache.derbyTesting.functionTests.util.Formatters;
>-
>+import java.io.File;
>+import java.io.FileInputStream;
>+import java.io.FileNotFoundException;
>+import java.io.FileOutputStream;
>+import java.io.FileReader;
>+import java.io.FileWriter;
>+import java.io.IOException;
>+import java.io.InputStream;
>+import java.io.InputStreamReader;
>+import java.io.OutputStream;
>+import java.io.OutputStreamWriter;
>+import java.io.Reader;
>+import java.io.Writer;
>+import java.sql.Blob;
>+import java.sql.Clob;
> import java.sql.Connection;
>-import java.sql.DriverManager;
>-import java.sql.ResultSetMetaData;
>+import java.sql.PreparedStatement;
> import java.sql.ResultSet;
>-import java.sql.Statement;
>+import java.sql.ResultSetMetaData;
> import java.sql.SQLException;
>+import java.sql.Statement;
> import java.sql.Types;
>-import java.sql.Clob;
>-import java.sql.Blob;
> 
>+import org.apache.derby.tools.JDBCDisplayUtil;
> import org.apache.derby.tools.ij;
>+import org.apache.derbyTesting.functionTests.util.Formatters;
> import org.apache.derbyTesting.functionTests.util.TestUtil;
> 
>-import java.io.*;
>-import java.sql.PreparedStatement;
>-import java.util.Properties;
>-
> /**
>  * Test of JDBC blob and clob
>  *
>@@ -59,6 +67,7 @@
> 
> 	static boolean isDerbyNet = false;
> 	static boolean debug = true;
>+	private static final String START = "\nSTART: ";
> 
> 	static
> 	{
>@@ -135,7 +144,8 @@
>             clobTest93(conn);
>             clobTest94(conn);
>             clobTest95(conn);
>-            // restart the connection
>+  
>+           // restart the connection
>             conn = ij.startJBMS();
>             conn.setAutoCommit(false);
>             clobTest96(conn);
>@@ -158,6 +168,7 @@
>             blobTest93(conn);
>             blobTest94(conn);
>             blobTest95(conn);
>+     
>             // restart the connection
>             conn = ij.startJBMS();
>             conn.setAutoCommit(false);
>@@ -184,7 +195,7 @@
> //            e.fillInStackTrace();
>             if (debug) e.printStackTrace();
> 		}
>-		System.out.println("Test blobclob finished");
>+		System.out.println("Test blobclob finished\n");
>     }
> 
> 
>@@ -224,7 +235,7 @@
>     */
>     private static void prepareCLOBMAIN(Connection conn)
>     {
>-        //System.out.println("prepareCLOBMAIN started");
>+        System.out.println(START +"prepareCLOBMAIN");
> 		ResultSet rs;
> 		Statement stmt;
> 
>@@ -306,7 +317,7 @@
>     */
>     private static void prepareSearchClobTable(Connection conn)
>     {
>-        //System.out.println("prepareSearchClobTable started");
>+        System.out.println(START + "prepareSearchClobTable");
> 		ResultSet rs;
> 		Statement stmt;
> 
>@@ -367,7 +378,7 @@
> 			System.out.println("FAIL -- unexpected exception:" + e.toString());
> 			if (debug) e.printStackTrace();
> 		}
>-        //System.out.println("prepareSearchClobTable finished");
>+        System.out.println("prepareSearchClobTable finished");
>     }
> 
> 
>@@ -383,7 +394,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		 System.out.println(START + "prepareUnicodeTable");
> 		try {
> 			stmt = conn.createStatement();
> 			// creating table small then add large column - that way forcing table to have default small page size, but have large rows.
>@@ -441,7 +452,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		 System.out.println(START + "setCharacterStreamTest");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -517,6 +528,7 @@
>      */
>     private static void prepareUnicodeFile(Connection conn)
>     {
>+    	 System.out.println(START + "prepareUnicodeFile");
> 		try
>         {
>             File file = new File(unicodeFileName);
>@@ -569,6 +581,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		 System.out.println(START + "clobTest0");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -626,7 +639,7 @@
> 		ResultSetMetaData met;
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		 System.out.println(START + "clobTest1");
> 		try {
> 			stmt = conn.createStatement();
> 			rs = stmt.executeQuery("select a,b from testCLOB_MAIN");
>@@ -679,7 +692,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "clobTest12");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -751,7 +764,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "clobTest2");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -812,7 +825,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "clobTest22");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -863,7 +876,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		 System.out.println(START + "clobTest3");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -912,7 +925,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "clobTest32");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -967,7 +980,7 @@
>     {
> 		ResultSet rs, rs2;
> 		Statement stmt, stmt2;
>-
>+		System.out.println(START + "clobTest4");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -1034,7 +1047,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		 System.out.println(START + "clobTest42");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -1116,7 +1129,7 @@
> 		ResultSetMetaData met;
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "clobTest51");
> 		try {
> 			stmt = conn.createStatement();
> 			stmt.execute("create table testCLOB10 (a CLOB(10))");
>@@ -1183,6 +1196,7 @@
> 		Statement stmt;
> 
> 		try {
>+			System.out.println(START + "clobTest52");
> 			stmt = conn.createStatement();
> 			System.out.println("create table testInteger (a integer)");
> 			stmt.execute("create table testInteger (a integer)");
>@@ -1228,7 +1242,7 @@
> 		ResultSetMetaData met;
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "clobTest53"); 
> 		try {
> 			stmt = conn.createStatement();
> 			stmt.execute("create table testClobColumn (a clob(1K))");
>@@ -1253,9 +1267,9 @@
>     {
> 		ResultSet rs;
> 		Statement stmt1, stmt2;
>+		System.out.println(START + "clobTest54");
>         try
>         {
>-			System.out.println("start clobTest54");
> 			stmt1 = conn.createStatement();
> 			stmt1.execute("create table testClob2 (a integer, b integer)");
>             PreparedStatement ps = conn.prepareStatement(
>@@ -1300,6 +1314,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "clobTest6");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -1410,8 +1425,7 @@
>     {
> 		ResultSet rs, rs2;
> 		Statement stmt1, stmt2;
>-
>-		System.out.println("start clobTest7");
>+		System.out.println(START + "clobTest7");
>         try
>         {
> 			stmt1 = conn.createStatement();
>@@ -1471,7 +1485,7 @@
> 	*/
>   	private static void clobTest8(Connection conn)
>     {
>-		System.out.println("start clobTest8");
>+  		System.out.println(START + "clobTest8");
> 		try {
> 			Statement s = conn.createStatement();
> 
>@@ -1629,6 +1643,7 @@
> 	}
> 
> 	private static void checkClob8(Statement s, String pstr) throws SQLException {
>+		
> 		ResultSet rs = s.executeQuery("SELECT ID, DD, POS, L FROM C8.T8POS ORDER BY 1");
> 
> 		while (rs.next()) {
>@@ -1756,6 +1771,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "clobTest91");
> 		try {
> 			stmt = conn.createStatement();
> 			rs = stmt.executeQuery("select a,b from testCLOB_MAIN");
>@@ -1808,12 +1824,13 @@
> 
>     /*
>         test locking
>-        need to run prepareCLOBMAIN first
>+        need to run prepareCLOBMAIN fverirst
>     */
> 	private static void clobTest92(Connection conn)
>     {
> 		ResultSet rs;
> 		Statement stmt,stmt2;
>+		System.out.println(START + "clobTest92");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -1867,6 +1884,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt, stmt2;
>+		System.out.println(START + "clobTest93");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -1929,6 +1947,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "clobTest94");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -1936,8 +1955,10 @@
> 			// fetch row back, get the column as a clob.
>             Clob clob = null, shortClob = null;
>             int clobLength;
>+            int i = 0;
> 			while (rs.next())
>             {
>+				//System.out.println("ACCESSING ROW:" + i++);
>                 clobLength = rs.getInt(2);
>                 if (clobLength == 10000)
>                     clob = rs.getClob(1);
>@@ -2011,6 +2032,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "clobTest95");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -2124,6 +2146,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "clobTest96");
> 		try {
> 			stmt = conn.createStatement();
> 			rs = stmt.executeQuery("select a,b from testCLOB_MAIN");
>@@ -2180,6 +2203,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "bug2");
> 		try {
> 			stmt = conn.createStatement();
> 			rs = stmt.executeQuery("select a,b from testCLOB_MAIN");
>@@ -2235,6 +2259,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt,stmt2;
>+		System.out.println(START + "clobTestGroupFetch");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -2271,6 +2296,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt, stmt2;
>+		System.out.println(START + "bug" );
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -2348,7 +2374,7 @@
> 		ResultSetMetaData met;
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "clobTest9999");
> 		try {
> 			stmt = conn.createStatement();
> 			stmt.execute("call SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY('derby.storage.pageSize','4096')");
>@@ -2403,6 +2429,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "clobTestSelfDestructive");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -2480,6 +2507,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "clobTestSelfDestructive2");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -2576,6 +2604,7 @@
> 
>     private static void unicodeTest()
>     {
>+    	System.out.println(START + "unicodeTest");
>         try
>         {
>             // String to Unicode bytes
>@@ -2630,7 +2659,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "prepareBlobTable");
> 		try {
> 			stmt = conn.createStatement();
> 			// creating table to fit within default 4k table size, then add large column
>@@ -2700,7 +2729,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "prepareBinaryTable");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -2743,7 +2772,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "prepareSearchBlobTable");
> 		try {
> 			stmt = conn.createStatement();
> 			// creating table to fit within default 4k table size, then add large column
>@@ -2804,6 +2833,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest0");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -2855,6 +2885,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest2");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -2915,6 +2946,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest3");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -2963,6 +2995,7 @@
>     {
> 		ResultSet rs, rs2;
> 		Statement stmt, stmt2;
>+		System.out.println(START + "blobTest4");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -3028,6 +3061,7 @@
>         int searchRowNum,
>         Blob searchBlob)
>     {
>+    	
>         try
>         {
>             long result = blob.position(searchBlob,position);
>@@ -3058,7 +3092,7 @@
> 		ResultSetMetaData met;
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "blobTest51");
> 		try {
> 			stmt = conn.createStatement();
> 			stmt.execute("create table testVarbinary (a blob(13))");
>@@ -3121,7 +3155,7 @@
> 		ResultSetMetaData met;
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "blobTest52");
> 		try {
> 			stmt = conn.createStatement();
> 			stmt.execute("create table testInteger2 (a integer)");
>@@ -3155,7 +3189,7 @@
> 		ResultSetMetaData met;
> 		ResultSet rs;
> 		Statement stmt;
>-
>+		System.out.println(START + "blobTest53");
> 		try {
> 			stmt = conn.createStatement();
> 			stmt.execute("create table testBlobColumn (a blob(1K))");
>@@ -3179,7 +3213,8 @@
>     {
> 		ResultSet rs;
> 		Statement stmt1, stmt2;
>-        try
>+		System.out.println(START + "blobTest54");
>+		try
>         {
> 			stmt1 = conn.createStatement();
> 			stmt1.execute("create table testBlob2 (a integer, b integer)");
>@@ -3223,6 +3258,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest6");
> 		try
>         {
> 			stmt = conn.createStatement();
>@@ -3332,6 +3368,7 @@
>     {
> 		ResultSet rs, rs2;
> 		Statement stmt1, stmt2;
>+		System.out.println(START + "blobTest7");
>         try
>         {
> 			stmt1 = conn.createStatement();
>@@ -3394,6 +3431,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest91");
> 		try {
> 			stmt = conn.createStatement();
> 			rs = stmt.executeQuery("select a,b from testBlob");
>@@ -3452,7 +3490,8 @@
>     {
> 		ResultSet rs;
> 		Statement stmt,stmt2;
>-        try
>+		System.out.println(START + "blobTest92");
>+		try
>         {
> 			stmt = conn.createStatement();
> 			rs = stmt.executeQuery("select a,b from testBlob");
>@@ -3473,16 +3512,32 @@
>             // turn off autocommit, otherwise blobs/clobs cannot hang around
>             // until end of transaction
>             conn2.setAutoCommit(false);
>-            // update should go through since we don't get any locks on blobs
>+            if (!TestUtil.isNetFramework())
>+            {
>+            // Note: Locks held until the end of transaction only for embedded.
>+            // Network Server cannot differentiate a getBlob from a getBytes so 
>+            // does not hold locks for blob calls (DERBY-255) 
>+            // The LOB is materialized on the client so we do not need to hold locks.
>+            // One ugly thing about this test is that these rows are used by other tests.
>+            // If this tests fails and the rows get updated, other tests can get 
>+            // NullPointer exceptions.	
>+            
>+            // Update should go through since we don't get any locks on blobs
>             // that are not long columns
>             stmt2 = conn2.createStatement();
>             stmt2.executeUpdate("update testBlob set a = null where b = 26");
>             if (shortBlob.length() != 26)
>                 System.out.println("FAILED: blob length changed to " + shortBlob.length());
>             // should timeout waiting for the lock to do this
>-            stmt2 = conn2.createStatement();
>-            stmt2.executeUpdate("update testBlob set b = b + 1 where b = 10000");
>-
>+            
>+            	stmt2 = conn2.createStatement();
>+            	stmt2.executeUpdate("update testBlob set b = b + 1 where b = 10000");
>+            	throw new Exception("FAIL: Should have gotten lock timeout");
>+            }
>+            else
>+            {
>+            	System.out.println("Locks not held by Network Server for Blobs since they are materialized on client");
>+            }
>             conn.commit();
>             conn2.commit();
>             System.out.println("blobTest92 finished");
>@@ -3504,6 +3559,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt, stmt2;
>+		System.out.println(START + "blobTest93");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -3565,6 +3621,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest94");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -3584,6 +3641,7 @@
>             conn.commit();
> 
>             // no problem accessing this after commit since it is in memory
>+            if (shortBlob != null)
>             System.out.println("shortBlob length after commit is " + shortBlob.length());
>             // these should all give blob/clob data unavailable exceptions
> 
>@@ -3648,6 +3706,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest95");
>         try
>         {
> 			stmt = conn.createStatement();
>@@ -3746,6 +3805,7 @@
>     {
> 		ResultSet rs;
> 		Statement stmt;
>+		System.out.println(START + "blobTest96");
> 		try {
> 			stmt = conn.createStatement();
> 			rs = stmt.executeQuery("select a,b from testBlob");
>@@ -3803,7 +3863,8 @@
>      */
>     private static void blobNegativeTest_Derby265(Connection conn)
>             throws SQLException, FileNotFoundException,IOException {
>-        // basically setup the tables for clob and blob
>+    	System.out.println(START + "blobTestNegativeTest_Derby265");
>+    	// basically setup the tables for clob and blob
>         Statement s = conn.createStatement();
>         s.execute("create table \"MAPS_BLOB\"(MAP_ID int, MAP_NAME varchar(20),REGION varchar(20),AREA varchar(20), PHOTO_FORMAT varchar(20),PICTURE blob(2G))");
>         conn.setAutoCommit(false);
>@@ -3843,11 +3904,10 @@
>             rs2.next();
>             rs2.getBlob(6);
>         } catch (SQLException sqle) {
>-            if ("XJ073".equals(sqle.getSQLState()))
>-                System.out.println("Expected Exception " + sqle.getMessage());
>-            else
>-                System.out.println("FAIL -- unexpected exception:"
>-                        + sqle.toString());
>+        	String sqlstate = sqle.getSQLState();
>+        	boolean expected = (sqlstate != null && 
>+        				(sqlstate.equals("XJ073") || sqlstate.equals("XCL30")));
>+            	TestUtil.dumpSQLExceptions(sqle,expected);            	
>         }
>         finally {
>             rs2.close();
>@@ -3873,7 +3933,8 @@
>     private static void clobNegativeTest_Derby265(Connection conn)
>             throws SQLException, FileNotFoundException,IOException {
> 
>-        // basically setup the tables for clob 
>+    	System.out.println(START + "clobNegativeTest_Derby265");
>+    	// basically setup the tables for clob 
>         Statement s = conn.createStatement();
>         s.execute("create table \"MAPS\"(MAP_ID int, MAP_NAME varchar(20),REGION varchar(20),AREA varchar(20), PHOTO_FORMAT varchar(20),PICTURE clob(2G))");
>         conn.setAutoCommit(false);
>@@ -3911,12 +3972,11 @@
>             rs2.next();
>             rs2.getClob(6); // no longer valid
>         } catch (SQLException sqle) {
>-            if ("XJ073".equals(sqle.getSQLState()))
>-                System.out.println("Expected Exception " + sqle.getMessage());
>-            else
>-                System.out.println("FAIL -- unexpected exception:"
>-                        + sqle.toString());
>-        }
>+        	String sqlstate = sqle.getSQLState();
>+        	boolean expected = (sqlstate != null && 
>+        				(sqlstate.equals("XJ073") || sqlstate.equals("XCL30")));
>+            	TestUtil.dumpSQLExceptions(sqle,expected);
>+        }	
>         finally {
>             rs2.close();
>             s2.close();
>@@ -3959,16 +4019,28 @@
> 
> 
> 			if (pos < 1 || pos > clobLength)
>-				expected = isOutOfBoundException(e);
>-			TestUtil.dumpSQLExceptions(e, expected);
>-			if (!expected) e.printStackTrace();
>+			{
>+				if (isOutOfBoundException(e))
>+					expected = true;
>+			} 
>+			else
>+			{
>+				System.out.println("FAIL -- unexpected exception:" + e.toString());
>+			}
>+			TestUtil.dumpSQLExceptions(e,expected);
> 		}
>+		
> 		catch (Exception e)
> 		{
>+			// Known bug.  JCC 5914.  
> 			if ((pos > clobLength) && isDerbyNet && (e.getMessage() != null &&
> 													e.getMessage().indexOf("String index out of range") >= 0))
>-				System.out.println("Known JCC Bug 5914 - " + e.getMessage());
>-			else System.out.println("Known JCC Bug 5914");
>+				System.out.println("EXPECTED Out of bounds exception");
>+			else
>+			{
>+				System.out.println("FAIL -- unexpected exception:" + e.toString());
>+	            if (debug) e.printStackTrace();
>+			}
> 		}
>     }
> 
>
>
>
>  
>



Mime
View raw message