db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yip Ng (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method
Date Wed, 06 Dec 2006 00:01:22 GMT
     [ 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

        

Mime
View raw message