db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r532404 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ColumnMetaData.java testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java
Date Wed, 25 Apr 2007 16:46:17 GMT
Author: kmarsden
Date: Wed Apr 25 09:46:16 2007
New Revision: 532404

URL: http://svn.apache.org/viewvc?view=rev&rev=532404
Log:
DERBY-2425 ResultSetMetaData.getColumnDisplaySize() returns a negative value for BLOB columns
for client

After multiplication (by 2 ) if the display size overflows int range, then assign Int.MAX_SIZE
to display size.
This behavior is same as that in Embedded mode. 


Contributed by Mayuresh Nirhali (Mayuresh.Nirhali@Sun.COM)



Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java?view=diff&rev=532404&r1=532403&r2=532404
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ColumnMetaData.java Wed Apr
25 09:46:16 2007
@@ -313,7 +313,13 @@
             case Types.VARBINARY:
             case Types.LONGVARBINARY:
             case Types.BLOB:
-                return (int) (2 * sqlLength_[column - 1]); // eg. "FF" represents just one
byte
+		// Derby-2425. For long length values, size overflows the int 
+		// range. In such cases, the size is limited to the max. int value
+		// This behavior is consistent with the same in Embedded mode.
+		int size = (int) (2 * sqlLength_[column - 1]);  // eg. "FF" represents just one byte
+		if ( size < 0 )
+		    size = Integer.MAX_VALUE;
+                return size;
             default:
                 throw new SqlException(logWriter_, 
                 		new ClientMessageId (SQLState.UNSUPPORTED_TYPE));

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java?view=diff&rev=532404&r1=532403&r2=532404
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java
Wed Apr 25 09:46:16 2007
@@ -436,11 +436,8 @@
         assertTrue(met.isSearchable(16));
         assertFalse(met.isCurrency(16));
         assertEquals(ResultSetMetaData.columnNullable, met.isNullable(16));
-        assertFalse(met.isSigned(16));
-        // DERBY-2425 Client returns negative value for getColumnDisplaySize()
-        // enable for client once fixed.
-        if (usingEmbedded())
-            assertEquals(2147483647, met.getColumnDisplaySize(16));
+        assertFalse(met.isSigned(16));       
+        assertEquals(2147483647, met.getColumnDisplaySize(16));
         assertEquals("BL", met.getColumnLabel(16));
         assertEquals("BL", met.getColumnName(16));
         // beetle 5323



Mime
View raw message