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 Daniel John Debrunner <dj...@debrunners.com> on 2005/11/17 21:29:08 UTC

UpdateNode/DeleteNode and SYNONYM

I was fixing some code in the bind() for UpdateNode and DeleteNode for
DERBY-571 and noticed that the methods are very similar and possibly
could be combined.

One thing that stood out is that UpdateNode has this code at the
beginning of bind() related to SYNONYMs

		// check if targetTable is a synonym
		if (targetTableName != null)
		{
			TableName synonymTab = resolveTableToSynonym(this.targetTableName);
			if (synonymTab != null)
				this.targetTableName = synonymTab;
		}

DeleteNode does not have this code.

However, both nodes call verifyTargetTable(), which also performs the
same SYNONYM lookup.

Is the code in UpdateNode required, or is it just left over from the
implementation by mistake?

Any ideas?
Dan.


Re: UpdateNode/DeleteNode and SYNONYM

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
It may be possible to differ this synonym resolution to
verifyTargetTable(), but this is currently called after some cursor bind
checking that expects correct target table name. If verifyTargetTable()
can be performed before this cursor checking, which resolves synonyms
correctly, the following code can be removed.

Satheesh

Daniel John Debrunner wrote:

>I was fixing some code in the bind() for UpdateNode and DeleteNode for
>DERBY-571 and noticed that the methods are very similar and possibly
>could be combined.
>
>One thing that stood out is that UpdateNode has this code at the
>beginning of bind() related to SYNONYMs
>
>		// check if targetTable is a synonym
>		if (targetTableName != null)
>		{
>			TableName synonymTab = resolveTableToSynonym(this.targetTableName);
>			if (synonymTab != null)
>				this.targetTableName = synonymTab;
>		}
>
>DeleteNode does not have this code.
>
>However, both nodes call verifyTargetTable(), which also performs the
>same SYNONYM lookup.
>
>Is the code in UpdateNode required, or is it just left over from the
>implementation by mistake?
>
>Any ideas?
>Dan.
>
>
>
>  
>