Subject Re: [IBO] FieldByName with table alias
Author Jason Wharton
It is this way because of how InterBase/Firebird returns the column
information in the API. I don't have control over this. If you need to, use
an alias for each column and then you can control what name it has more
exactly.

I prefer that it uses the table names instead of the alias names too.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com

-- We may not have it all together --
-- But together we have it all --


----- Original Message -----
From: "Boris Schlüszler" <boris@...>
Newsgroups: egroups.ibobjects
To: <IBObjects@yahoogroups.com>
Sent: Friday, August 23, 2002 8:48 AM
Subject: Re: [IBO] FieldByName with table alias


> Hi Jason!
>
> Is it true, that TableName returns the name of the source table and not
> of the alias from the query?
>
> Hence:
>
> select * from bla customers
>
> TableName returns "bla", and not "customers".
> This gets problematic, if fields with same name are to be picked via
> FieldByName...
>
> I set up my own x-ref-list: TableAlias+FieldName->FieldIndex.
> I feel, this is much effort for an easy thing...
>
> Regards, Boris
>
>
> Jason Wharton schrieb:
> >
> > What does the FullFieldName of the Fields[n] objects say?
> > I use table names.
> >
> > Jason Wharton
> > CPS - Mesa AZ
> > http://www.ibobjects.com
> >
> > -- We may not have it all together --
> > -- But together we have it all --
> >
> > ----- Original Message -----
> > From: "Boris Schlüszler" <boris@...>
> > Newsgroups: egroups.ibobjects
> > To: <IBObjects@yahoogroups.com>
> > Sent: Friday, August 23, 2002 12:57 AM
> > Subject: Re: [IBO] FieldByName with table alias
> >
> > > Hi Helen!
> > >
> > > Helen Borrie schrieb:
> > > >
> > > > At 12:48 AM 23-08-02 +0200, you wrote:
> > > > >Hi!
> > > > >
> > > > >select * from table customer
> > > > >left join table copyto on copyto.id=:copyto
> > > > >left join table secondcopy on secondcopy.id=:secondcopy
> > > >
> > > > This syntax won't work.
> > >
> > > The SQL query works perfectly well.
> > > My problem is, that I can't access the result set from IBO because I
> > > can't uniquely name the columns (I could get them via index []
however).
> > >
> > > Say, in table are two fields:
> > >
> > > ID integer
> > > NAME char(40)
> > >
> > > The above query results (FullFieldNames):
> > >
> > > TABLE.ID (customer)
> > > TABLE.NAME (customer)
> > > TABLE.ID (copyto)
> > > TABLE.NAME (copyto)
> > > TABLE.ID (secondcopy)
> > > TABLE.NAME (secondcopy)
> > >
> > > The table aliases (customer, copyto, and secondcopy) are not
interpreted
> > > by IBO.
> > > I don't want to use FieldIndexes. So, how can I access "copyto.NAME"
> > > from IBO?
> > > With ParamByName('ID').AsString I will get customer.ID and not
> > > copyto.ID.
> > >
> > > Regards, Boris