Subject Re: [IBO] IBO 4.7.16 wrong update SQL with alias
Author Helen Borrie
At 08:37 AM 1/05/2007, Rade wrote:
>Hi all,
>
>I have a problem with generating inset, update and delete statements
>with Generate for Table button. If i use an alias for table sql
>generated is totaly wrong (eveything is ok if i don't use an alias).

Could you provide an exact example of the SELECT statement?

>I
>also noticed that use an alias menuitem does not work on a pop-up
>menu. You can click on it as much as you like but state doesn't
>change. It does not metter if i use Interbase 7 or Firebird 2.0.1 it
>workes the same way. So, i suppose that there is something in IBO code.

It could be so; but the parser changes require you to be completely
correct in your usage of table aliases. You cannot, for example, use
a table name for one table and an alias for another; or refer to a
table in one place by its name and in another by its alias. Also, if
you omit the qualifier on any _field reference_ in a multi-table
query, you will get unexpected XxxSQL generated by IBO. Look
particularly at ".*" and your WHERE, ORDER BY and GROUP BY clauses,
where IB and Fb have allowed slackness in the past.

Then, at Prepare time, your SELECT statement will except with
Firebird 2.x if you have not followed the aliasing rules
correctly. As far as I know, IB has not cleaned up in this area yet
and does not return relation aliases in the interface structures...I
believe the IBO changes take this into account and make it so that
the missing RelationAlias member does not cause an AV. However, it
expects you to follow the correct syntax rules even though IB still
allows the bad syntax.

Helen