db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r571611 - in /db/derby/code/trunk/java/engine/org/apache/derby: catalog/types/RowMultiSetImpl.java iapi/types/DataTypeDescriptor.java impl/sql/compile/FromVTI.java
Date Fri, 31 Aug 2007 21:51:04 GMT
Author: djd
Date: Fri Aug 31 14:51:04 2007
New Revision: 571611

URL: http://svn.apache.org/viewvc?rev=571611&view=rev
Log:
DERBY-2917 (partial) Ensure that the type defintion for a table function (MULTISET) writes
out catalog types (TypeDescriptor) and not runtime types (DataTypeDescriptor)

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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RowMultiSetImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RowMultiSetImpl.java?rev=571611&r1=571610&r2=571611&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RowMultiSetImpl.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/types/RowMultiSetImpl.java Fri
Aug 31 14:51:04 2007
@@ -20,9 +20,9 @@
  */
 
 package org.apache.derby.catalog.types;
+import org.apache.derby.catalog.TypeDescriptor;
 import org.apache.derby.iapi.services.sanity.SanityManager;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
-import org.apache.derby.iapi.types.DataTypeDescriptor;
 import java.io.ObjectOutput;
 import java.io.ObjectInput;
 import java.io.IOException;
@@ -63,7 +63,7 @@
     ///////////////////////////////////////////////////////////////////////////////////
 
     private String[]                            _columnNames;
-    private DataTypeDescriptor[]    _types;
+    private TypeDescriptor[]    _types;
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -84,7 +84,7 @@
      * Construct from column names and their types.
      * </p>
      */
-    public RowMultiSetImpl( String[] columnNames, DataTypeDescriptor[] types )
+    public RowMultiSetImpl( String[] columnNames, TypeDescriptor[] types )
     {
         _columnNames = columnNames;
         _types = types;
@@ -110,7 +110,7 @@
     public  String[]    getColumnNames()    { return _columnNames; }
     
     /** Get the types of the columns in this row set */
-    public  DataTypeDescriptor[]    getTypes() { return _types; }
+    public  TypeDescriptor[]    getTypes() { return _types; }
     
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -195,10 +195,10 @@
         int     count = in.readInt();
 
         _columnNames = new String[ count ];
-        _types = new DataTypeDescriptor[ count ];
+        _types = new TypeDescriptor[ count ];
 
         for ( int i = 0; i < count; i++ ) { _columnNames[ i ] = in.readUTF(); }
-        for ( int i = 0; i < count; i++ ) { _types[ i ] = (DataTypeDescriptor) in.readObject();
}
+        for ( int i = 0; i < count; i++ ) { _types[ i ] = (TypeDescriptor) in.readObject();
}
     }
 
     /**

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=571611&r1=571610&r2=571611&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 Fri
Aug 31 14:51:04 2007
@@ -110,7 +110,15 @@
 		** be wrapped in.
 		*/
         TypeId wrapperTypeId = new TypeId(typeId.wrapperTypeFormatId(), typeId);
-		return new DataTypeDescriptor(typeDescriptor, wrapperTypeId);
+		DataTypeDescriptor dtd =
+            new DataTypeDescriptor(typeDescriptor, wrapperTypeId);
+        
+        // By definition, any catalog type (column in a table,
+        // procedure etc.) is derivation implicit.
+        dtd.setCollationDerivation(
+                StringDataValue.COLLATION_DERIVATION_IMPLICIT);
+        
+        return dtd;
 	}
     
     /**
@@ -306,7 +314,11 @@
 		DataTypeDescriptor[]	types
 	)
 	{
-		RowMultiSetImpl       rms = new RowMultiSetImpl( columnNames, types );
+        TypeDescriptor[] catalogTypes =
+            new TypeDescriptor[types.length];
+        for (int i = 0; i < types.length; i++)
+            catalogTypes[i] = types[i].getCatalogType();
+		RowMultiSetImpl rms = new RowMultiSetImpl(columnNames, catalogTypes);
 		TypeId              typeID = new TypeId( StoredFormatIds.ROW_MULTISET_CATALOG_ID, rms );
 
 		return new DataTypeDescriptor( typeID, true);
@@ -319,7 +331,10 @@
 	private TypeDescriptorImpl	typeDescriptor;
 	private TypeId			typeId;
     
-    /** @see TypeDescriptor#getCollationDerivation() */
+    /**
+     * Derivation of this type. All catalog types are
+     * by definition implicit.
+     */
     private int collationDerivation = StringDataValue.COLLATION_DERIVATION_IMPLICIT;
 
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java?rev=571611&r1=571610&r2=571611&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/FromVTI.java Fri Aug
31 14:51:04 2007
@@ -1589,12 +1589,13 @@
         DataTypeDescriptor      returnType = (DataTypeDescriptor) td;
         RowMultiSetImpl         rmsi = (RowMultiSetImpl) returnType.getTypeId().getBaseTypeId();
         String[]                        columnNames = rmsi.getColumnNames();
-        DataTypeDescriptor[]    types = rmsi.getTypes();
+        TypeDescriptor[]    types = rmsi.getTypes();
         int                                     count = columnNames.length;
         
         for ( int i = 0; i < count; i++ )
         {
-            resultColumns.addColumn( exposedName, columnNames[ i ], types[ i ] );
+            resultColumns.addColumn( exposedName, columnNames[ i ],
+                    DataTypeDescriptor.getType(types[i]));
         }
 
     }



Mime
View raw message