db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r564791 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/types/DataTypeDescriptor.java impl/sql/catalog/SYSCOLUMNSRowFactory.java
Date Fri, 10 Aug 2007 22:41:58 GMT
Author: djd
Date: Fri Aug 10 15:41:57 2007
New Revision: 564791

URL: http://svn.apache.org/viewvc?view=rev&rev=564791
Log:
DERBY-2917 Add a method to get a DataTypeDescriptor from a TypeDescriptor

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java?view=diff&rev=564791&r1=564790&r2=564791
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java Fri
Aug 10 15:41:57 2007
@@ -89,6 +89,22 @@
 	{
 		return DataTypeDescriptor.getBuiltInDataTypeDescriptor(jdbcType, true, length);
 	}
+	
+	/**
+	 * Return a runtime type for a catalog type.
+	 */
+	public static DataTypeDescriptor getType(TypeDescriptor catalogType)
+	{
+		TypeDescriptorImpl typeDescriptor = (TypeDescriptorImpl) catalogType;
+        BaseTypeIdImpl typeId = typeDescriptor.getTypeId();
+
+		/*
+		** The BaseTypeIdImpl tells what type of TypeId it is supposed to
+		** be wrapped in.
+		*/
+        TypeId wrapperTypeId = new TypeId(typeId.wrapperTypeFormatId(), typeId);
+		return new DataTypeDescriptor(typeDescriptor, wrapperTypeId);
+	}
     
     /**
      * Return a nullable catalog type for a JDBC builtin type and length.
@@ -457,10 +473,10 @@
 	 *
 	 * @param source	The TypeDescriptorImpl to construct this DTSI from
 	 */
-	public DataTypeDescriptor(TypeDescriptorImpl source, TypeId typeId)
+	private DataTypeDescriptor(TypeDescriptorImpl source, TypeId typeId)
 	{
 		typeDescriptor = source;
-		this.typeId = typeId;;
+		this.typeId = typeId;
 	}
 
 	/* DataTypeDescriptor Interface */

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java?view=diff&rev=564791&r1=564790&r2=564791
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLUMNSRowFactory.java
Fri Aug 10 15:41:57 2007
@@ -25,12 +25,9 @@
 
 import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.catalog.UUID;
-import org.apache.derby.catalog.types.BaseTypeIdImpl;
 import org.apache.derby.catalog.types.DefaultInfoImpl;
-import org.apache.derby.catalog.types.TypeDescriptorImpl;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.reference.Property;
-import org.apache.derby.iapi.services.monitor.Monitor;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.services.uuid.UUIDFactory;
 import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;
@@ -402,19 +399,10 @@
 		** and TypeId objects that contain the full implementations for
 		** language processing.
 		*/
-		TypeDescriptorImpl typeDescriptor = (TypeDescriptorImpl) row.getColumn(SYSCOLUMNS_COLUMNDATATYPE).
+		TypeDescriptor catalogType = (TypeDescriptor) row.getColumn(SYSCOLUMNS_COLUMNDATATYPE).
 													getObject();
-        BaseTypeIdImpl typeId = typeDescriptor.getTypeId();
-
-		/*
-		** The BaseTypeIdImpl tells what type of TypeId it is supposed to
-		** be wrapped in.
-		*/
-        TypeId wrapperTypeId = new TypeId(typeId.wrapperTypeFormatId(), typeId);
-
-		/* Wrap the TypeDescriptorImpl in a full DataTypeDescriptor */
-		DataTypeDescriptor dataTypeServices = new DataTypeDescriptor(typeDescriptor,
-													wrapperTypeId);
+		DataTypeDescriptor dataTypeServices = 
+			DataTypeDescriptor.getType(catalogType);
 
 		/* 7th column is AUTOINCREMENTVALUE, not cached in descriptor (long) */
 



Mime
View raw message