Subject | Re: How to get table alias from SQL for columns |
---|---|
Author | rogervellacott |
Post date | 2008-02-24T17:30:29Z |
Trying to work out the SQL field number from a column number has a
number of pitfalls, especially if you use calculated fields, or your
column order is different to field order, or you only show some of
the fields as columns.
For what it's worth, I solved the identical problem in Delphi with a
function which takes the SQL text, and a field name, and returns the
field name prefixed with an alias. It only works if there is a
single "*" in the query. You can have the Delphi code if you are
interested, especially if you can improve it for me.
Roger Vellacott
Passfield Data Systems Ltd
--- In Firebird-Java@yahoogroups.com, Roman Rokytskyy
<rrokytskyy@...> wrote:
number of pitfalls, especially if you use calculated fields, or your
column order is different to field order, or you only show some of
the fields as columns.
For what it's worth, I solved the identical problem in Delphi with a
function which takes the SQL text, and a field name, and returns the
field name prefixed with an alias. It only works if there is a
single "*" in the query. You can have the Delphi code if you are
interested, especially if you can improve it for me.
Roger Vellacott
Passfield Data Systems Ltd
--- In Firebird-Java@yahoogroups.com, Roman Rokytskyy
<rrokytskyy@...> wrote:
>the
> > Thanks Roman for the answer. Can you tell me where can I register
> > feature request?table
>
> I have bad news for you - at the moment I'm not able to get the
> alias for the column. I was confused by the new info constant in FB2.1,
> however it turns out that it is used for different purposes. So atthe
> moment 2.1.3 release won't have new method.you can
>
> However, your issue is easily solved by using the column index -
> use "select A.*, B.* from TABLE_A A left outer join TABLE_B on ....you
> order by 1, 3, 5". And this is probably even easier for you, since
> always know the column index when user clicks on the header.
>
> Roman
>