Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 47830 invoked from network); 22 Aug 2006 00:06:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Aug 2006 00:06:08 -0000 Received: (qmail 99960 invoked by uid 500); 22 Aug 2006 00:06:08 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 99930 invoked by uid 500); 22 Aug 2006 00:06:08 -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 99919 invoked by uid 99); 22 Aug 2006 00:06:07 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Aug 2006 17:06:07 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Aug 2006 17:06:07 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 2755F1A981A; Mon, 21 Aug 2006 17:05:47 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r433434 - in /db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog: SYSALIASESRowFactory.java SystemColumnImpl.java Date: Tue, 22 Aug 2006 00:05:46 -0000 To: derby-commits@db.apache.org From: djd@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060822000547.2755F1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: djd Date: Mon Aug 21 17:05:45 2006 New Revision: 433434 URL: http://svn.apache.org/viewvc?rev=433434&view=rev Log: DERBY-1734 (partial) Change SYSALIASESRowFactory to use the utility methods to obtain SystemColumn implementations to avoid passing redundant parameters leading to bugs (see DERBY-1742). Fix the bug described by DERBY-1742 so that the column descriptor for SYSTEMALIAS BOOLEAN column is created correctly. Remove the calls to convert the case for the SYSTEMALIASES columns as the system tables are an implementation detail of Derby which is fixed at upper case. Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSALIASESRowFactory.java db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSALIASESRowFactory.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSALIASESRowFactory.java?rev=433434&r1=433433&r2=433434&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSALIASESRowFactory.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSALIASESRowFactory.java Mon Aug 21 17:05:45 2006 @@ -22,6 +22,7 @@ package org.apache.derby.impl.sql.catalog; import org.apache.derby.iapi.types.TypeId; +import org.apache.derby.iapi.reference.JDBC30Translation; import org.apache.derby.iapi.sql.dictionary.SystemColumn; import org.apache.derby.catalog.TypeDescriptor; @@ -423,115 +424,31 @@ aliasInfo, specificName); } - /** - * Builds a list of columns suitable for creating this Catalog. - * - * - * @return array of SystemColumn suitable for making this catalog. - */ - public SystemColumn[] buildColumnList() - { - SystemColumn[] columnList = new SystemColumn[SYSALIASES_COLUMN_COUNT]; - - // describe columns - - columnList[0] = - new SystemColumnImpl( - convertIdCase( "ALIASID"), // column name - 1, // column number - 0, // precision - 0, // scale - false, // nullability - "CHAR", // dataType - true, // built-in type - 36 // maxLength - ); - - columnList[1] = - new SystemColumnImpl( - convertIdCase( "ALIAS"), // column name - 2, // column number - false // nullability - ); - - columnList[2] = new SystemColumnImpl( - convertIdCase( "SCHEMAID"), // column name - 3, // column number - 0, // precision - 0, // scale - true, // nullability - "CHAR", // dataType - true, // built-in type - 36 // maxLength - ); - - columnList[3] = - new SystemColumnImpl( - convertIdCase( "JAVACLASSNAME"), // column name - 4, - 0, // precision - 0, // scale - false, // nullability - "LONG VARCHAR", // dataType - true, // built-in type - Integer.MAX_VALUE // maxLength - ); - - columnList[4] = - new SystemColumnImpl( - convertIdCase( "ALIASTYPE"), // column name - 5, - 0, // precision - 0, // scale - false, // nullability - "CHAR", // dataType - true, // built-in type - 1 // maxLength - ); - - columnList[5] = - new SystemColumnImpl( - convertIdCase( "NAMESPACE"), // column name - 6, - 0, // precision - 0, // scale - false, // nullability - "CHAR", // dataType - true, // built-in type - 1 // maxLength - ); - - columnList[6] = - new SystemColumnImpl( - convertIdCase( "SYSTEMALIAS"), // column name - 7, - 0, // precision - 0, // scale - false, // nullability - "BOOLEAN", // dataType - true, // built-in type - 0 // maxLength - ); - - columnList[7] = - new SystemColumnImpl( - convertIdCase( "ALIASINFO"), // column name - 8, // column number - 0, // precision - 0, // scale - true, // nullability - "org.apache.derby.catalog.AliasInfo", // dataType - false, // built-in type - TypeDescriptor.MAXIMUM_WIDTH_UNKNOWN // maxLength - ); - - columnList[8] = - new SystemColumnImpl( - convertIdCase( "SPECIFICNAME"), - 9, // column number - false // nullability - ); - - return columnList; - } + /** + * Builds a list of columns suitable for creating this Catalog. + * DERBY-1734 fixed an issue where older code created the + * BOOLEAN column SYSTEMALIAS with maximum length 0 instead of 1. + * DERBY-1742 was opened to track if upgrade changes are needed. + * + * + * @return array of SystemColumn suitable for making this catalog. + */ + public SystemColumn[] buildColumnList() + { + return new SystemColumn[] { + + SystemColumnImpl.getUUIDColumn("ALIASID", false), + SystemColumnImpl.getIdentifierColumn("ALIAS", false), + SystemColumnImpl.getUUIDColumn("SCHEMAID", true), + SystemColumnImpl.getColumn("JAVACLASSNAME", + java.sql.Types.LONGVARCHAR, false, Integer.MAX_VALUE), + SystemColumnImpl.getIndicatorColumn("ALIASTYPE"), + SystemColumnImpl.getIndicatorColumn("NAMESPACE"), + SystemColumnImpl.getColumn("SYSTEMALIAS", + JDBC30Translation.SQL_TYPES_BOOLEAN, false), + SystemColumnImpl.getJavaColumn("ALIASINFO", + "org.apache.derby.catalog.AliasInfo", true), + SystemColumnImpl.getIdentifierColumn("SPECIFICNAME", false) + }; + } } Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java?rev=433434&r1=433433&r2=433434&view=diff ============================================================================== --- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java (original) +++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SystemColumnImpl.java Mon Aug 21 17:05:45 2006 @@ -62,7 +62,23 @@ return new SystemColumnImpl(name, DataTypeDescriptor .getBuiltInDataTypeDescriptor(jdbcTypeId, nullability)); } - + + /** + * Create a system column for a builtin type. + * + * @param name + * name of column + * @param jdbcTypeId + * JDBC type id from java.sql.Types + * @param nullability + * Whether or not column accepts nulls. + */ + static SystemColumn getColumn(String name, int jdbcTypeId, + boolean nullability,int maxLength) { + return new SystemColumnImpl(name, DataTypeDescriptor + .getBuiltInDataTypeDescriptor(jdbcTypeId, nullability, maxLength)); + } + /** * Create a system column for an identifer with consistent type of * VARCHAR(128)