db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method
Date Wed, 30 Nov 2005 18:12:31 GMT
     [ http://issues.apache.org/jira/browse/DERBY-469?page=all ]

Kathey Marsden updated DERBY-469:
---------------------------------

    type: Task  (was: Bug)

I am changing this to task because I think it is just a code cleanup and not a bug.  Hopefully
Task is the correct category.

> Unnecessary if block in the FromBaseTable.bindTableDescriptor() method
> ----------------------------------------------------------------------
>
>          Key: DERBY-469
>          URL: http://issues.apache.org/jira/browse/DERBY-469
>      Project: Derby
>         Type: Task
>   Components: SQL
>     Versions: 10.2.0.0
>     Reporter: Philip Wilder
>     Priority: Trivial

>
> 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


Mime
View raw message