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 "Kathey Marsden (JIRA)" <de...@db.apache.org> on 2005/11/30 19:12:31 UTC
[jira] Updated: (DERBY-469) Unnecessary if block in the FromBaseTable.bindTableDescriptor() method
[ 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