Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 22566 invoked from network); 10 Aug 2007 22:42:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Aug 2007 22:42:29 -0000 Received: (qmail 40392 invoked by uid 500); 10 Aug 2007 22:42:27 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 40308 invoked by uid 500); 10 Aug 2007 22:42:27 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 40293 invoked by uid 99); 10 Aug 2007 22:42:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 15:42:27 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 22:42:30 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EABA71A981A; Fri, 10 Aug 2007 15:42:05 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: derby-commits@db.apache.org From: djd@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070810224205.EABA71A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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) */