Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 9045 invoked from network); 6 Dec 2006 00:01:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Dec 2006 00:01:44 -0000 Received: (qmail 7995 invoked by uid 500); 6 Dec 2006 00:01:52 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 7773 invoked by uid 500); 6 Dec 2006 00:01:51 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 7764 invoked by uid 99); 6 Dec 2006 00:01:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 16:01:51 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Dec 2006 16:01:42 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 789647142D7 for ; Tue, 5 Dec 2006 16:01:22 -0800 (PST) Message-ID: <32467788.1165363282491.JavaMail.jira@brutus> Date: Tue, 5 Dec 2006 16:01:22 -0800 (PST) From: "Yip Ng (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Resolved: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method In-Reply-To: <660040393.1122295203849.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/DERBY-469?page=all ] Yip Ng resolved DERBY-469. -------------------------- Fix Version/s: 10.2.1.6 Resolution: Fixed This has been fixed as part of DERBY-1784. > Unnecessary if block in the FromBaseTable.bindTableDescriptor() method > ---------------------------------------------------------------------- > > Key: DERBY-469 > URL: http://issues.apache.org/jira/browse/DERBY-469 > Project: Derby > Issue Type: Task > Components: SQL > Affects Versions: 10.2.1.6 > Reporter: Philip Wilder > Assigned To: Yip Ng > Priority: Trivial > Fix For: 10.2.1.6 > > > In attempting to get a better feel for the bind process of the SQLLayer I stumbled across a rather suspicious (if innocuous) piece of code in the FromBaseTable class. > /** > * Bind the table descriptor for this table. > * > * > * @exception StandardException Thrown on error > */ > private TableDescriptor bindTableDescriptor() > throws StandardException > { > String schemaName = tableName.getSchemaName(); > SchemaDescriptor sd = getSchemaDescriptor(schemaName); > tableDescriptor = getTableDescriptor(tableName.getTableName(), sd); > //There is no local tableDescriptor variable ergo we are just setting tableDescriptor to itself here. > if (tableDescriptor != null) > { > this.tableDescriptor = tableDescriptor; > } > else > { > // Check if the reference is for a synonym. > TableName synonymTab = resolveTableToSynonym(tableName); > if (synonymTab == null) > throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND, tableName); > tableName = synonymTab; > sd = getSchemaDescriptor(tableName.getSchemaName()); > tableDescriptor = getTableDescriptor(synonymTab.getTableName(), sd); > if (tableDescriptor == null) > throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND, tableName); > } > return tableDescriptor; > } > This should probably look something like this: > /** > * Bind the table descriptor for this table. > * > * > * @exception StandardException Thrown on error > */ > private TableDescriptor bindTableDescriptor() > throws StandardException > { > String schemaName = tableName.getSchemaName(); > SchemaDescriptor sd = getSchemaDescriptor(schemaName); > tableDescriptor = getTableDescriptor(tableName.getTableName(), sd); > if (tableDescriptor == null) > { > // Check if the reference is for a synonym. > TableName synonymTab = resolveTableToSynonym(tableName); > if (synonymTab == null) > throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND, tableName); > tableName = synonymTab; > sd = getSchemaDescriptor(tableName.getSchemaName()); > tableDescriptor = getTableDescriptor(synonymTab.getTableName(), sd); > if (tableDescriptor == null) > throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND, tableName); > } > return tableDescriptor; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira