You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Philip Wilder (JIRA)" <de...@db.apache.org> on 2005/07/25 14:40:03 UTC

[jira] Created: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method

Unnecessary if block in the FromBaseTable.bindTableDescriptor() method
----------------------------------------------------------------------

         Key: DERBY-469
         URL: http://issues.apache.org/jira/browse/DERBY-469
     Project: Derby
        Type: Bug
  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


[jira] Updated: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method

Posted by "Kathey Marsden (JIRA)" <de...@db.apache.org>.
     [ 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


[jira] Resolved: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method

Posted by "Yip Ng (JIRA)" <ji...@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

        

[jira] Assigned: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method

Posted by "Yip Ng (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-469?page=all ]

Yip Ng reassigned DERBY-469:
----------------------------

    Assignee: Yip Ng

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