db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r633308 - in /db/derby/code/trunk/java/engine/org/apache/derby: catalog/types/TypeDescriptorImpl.java iapi/services/io/StoredFormatIds.java iapi/types/DataTypeDescriptor.java iapi/types/TypeId.java
Date Mon, 03 Mar 2008 22:35:42 GMT
Author: djd
Date: Mon Mar  3 14:35:39 2008
New Revision: 633308

URL: http://svn.apache.org/viewvc?rev=633308&view=rev
Log:
DERBY-2917 Cleanup of TypeId to localize creation of a TypeId from a TypeDescriptor in TypeId.
Lead to RowSetMulti being an attribute of a catalog type (TypeDescriptor) only, and not a
runtime type (DataTypeDescriptor).

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataTypeDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/TypeId.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java?rev=633308&r1=633307&r2=633308&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/TypeDescriptorImpl.java
Mon Mar  3 14:35:39 2008
@@ -21,21 +21,15 @@
 
 package org.apache.derby.catalog.types;
 
-import org.apache.derby.shared.common.reference.JDBC40Translation;
-
-import org.apache.derby.iapi.services.io.StoredFormatIds;
-import org.apache.derby.iapi.services.io.Formatable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.sql.Types;
 
 import org.apache.derby.catalog.TypeDescriptor;
-
-import org.apache.derby.iapi.types.DataTypeDescriptor;
+import org.apache.derby.iapi.services.io.Formatable;
+import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.types.StringDataValue;
-import org.apache.derby.iapi.reference.Property;
-
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
-import java.io.IOException;
-import java.sql.Types;
                              
 public class TypeDescriptorImpl implements TypeDescriptor, Formatable
 {

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java?rev=633308&r1=633307&r2=633308&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
Mon Mar  3 14:35:39 2008
@@ -892,8 +892,8 @@
     static public final int XML_TYPE_ID_IMPL =
             (MIN_ID_2 + 457);
 
-    public static final int ROW_MULTISET_CATALOG_ID = 
-            (MIN_ID_2 + 468);
+    // 468 unused
+    //        (MIN_ID_2 + 468);
 
     public static final int ROW_MULTISET_TYPE_ID_IMPL = 
             (MIN_ID_2 + 469);

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?rev=633308&r1=633307&r2=633308&view=diff
==============================================================================
--- 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 Mon
Mar  3 14:35:39 2008
@@ -148,15 +148,11 @@
 	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);
+        
+        TypeId typeId = TypeId.getTypeId(catalogType);
+ 
 		DataTypeDescriptor dtd =
-            new DataTypeDescriptor(typeDescriptor, wrapperTypeId);
+            new DataTypeDescriptor(typeDescriptor, typeId);
         
         // By definition, any catalog type (column in a table,
         // procedure etc.) is derivation implicit.
@@ -403,9 +399,7 @@
             TypeDescriptor[] catalogTypes)
     {
 		RowMultiSetImpl rms = new RowMultiSetImpl(columnNames, catalogTypes);
-		TypeId              typeID = new TypeId( StoredFormatIds.ROW_MULTISET_CATALOG_ID, rms );
-
-		return new DataTypeDescriptor( typeID, true).getCatalogType();
+        return new TypeDescriptorImpl(rms, true, -1);
 	}
 
 	/*
@@ -1165,14 +1159,6 @@
 	public int	getCollationDerivation()
 	{
 		return collationDerivation;
-	}
-
-	/**
-	* @see TypeDescriptor#isRowMultiSet
-	 */
-	public	boolean isRowMultiSet()
-	{
-		return getTypeId().isRowMultiSetTypeId();
 	}
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/TypeId.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/TypeId.java?rev=633308&r1=633307&r2=633308&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/TypeId.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/TypeId.java Mon Mar  3 14:35:39
2008
@@ -21,31 +21,18 @@
 
 package org.apache.derby.iapi.types;
 
-import org.apache.derby.iapi.services.io.Formatable;
-import org.apache.derby.iapi.services.io.StoredFormatIds;
-import org.apache.derby.iapi.services.monitor.Monitor;
-import org.apache.derby.iapi.services.loader.ClassFactory;
-
-import org.apache.derby.iapi.error.StandardException;
+import java.sql.Types;
 
+import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.catalog.types.BaseTypeIdImpl;
 import org.apache.derby.catalog.types.DecimalTypeIdImpl;
 import org.apache.derby.catalog.types.UserDefinedTypeIdImpl;
-
+import org.apache.derby.iapi.reference.JDBC40Translation;
 import org.apache.derby.iapi.reference.Limits;
-
-import java.io.ObjectOutput;
-import java.io.ObjectInput;
-import java.io.IOException;
+import org.apache.derby.iapi.services.io.StoredFormatIds;
+import org.apache.derby.iapi.services.loader.ClassFactory;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 
-import org.apache.derby.iapi.types.*;
-import org.apache.derby.iapi.types.*;
-
-import org.apache.derby.iapi.reference.JDBC40Translation;
-
-import java.sql.Types;
-
 /**
  * TypeId describes the static information about a SQL type
  * independent of any specific attributes of the type such
@@ -576,6 +563,26 @@
         }
         return null;
     }
+      
+    /**
+     * Get the TypeId (fundemental type information)
+     * for a catalog type.
+     * @param catalogType
+     * @return TypeId that represents the base type, null if not applicable.
+     */
+    static TypeId getTypeId(TypeDescriptor catalogType)
+    {
+        final int jdbcType = catalogType.getJDBCTypeId();
+        TypeId typeId = TypeId.getBuiltInTypeId(jdbcType);
+        if (typeId != null)
+            return typeId;
+        
+        if (jdbcType == Types.JAVA_OBJECT) {
+            return TypeId.getUserDefinedTypeId(catalogType.getTypeName(), false);
+        }
+        
+        return null;
+    }
 
         /*
          * * Instance fields and methods
@@ -1051,16 +1058,6 @@
         {
                return (formatId == StoredFormatIds.XML_TYPE_ID);
         }
-
-        /** 
-         *Is this a ROW MULTISET?
-         * @return true if this is XML
-         */
-        public boolean isRowMultiSetTypeId()
-        {
-               return (formatId == StoredFormatIds.ROW_MULTISET_CATALOG_ID);
-        }
-
 
 	
         /**



Mime
View raw message