Subject | Re: [IBO] Fixed, but strange for me |
---|---|
Author | scr0546 |
Post date | 2006-05-10T23:00:01Z |
Hi Jason,
I've tried once more and I think I know the reason now.
The problem: The way how to use keylinks in joined-tables.
--------------------
My question:
Do I always have to specify the tablename in the keylinks when I'm
using joins?
-------------------
If so, it's my mistake and I have to check all my (more than 100)
keylink values in my application (migrated from BDE) :-(
The problem with locating records appears, when the second table has
the same fieldname (as primary key).
For example:
SQL.TEXT :=
'Select A.ID, A.OrderDate, B.CustomerName
From Orders A
Left Join Customers B ON A.CustomerID = B.ID';
Keylinks.Add('ID'); -> LOCATE-Error described below
Keylinks.Add('Orders.ID') -> It works (don't need FetchAll)
Thats very dangerous for me. I thought all works fine until I
detected the problem with locate. Do I need the tablename in
keylinks although the fields in the Select-statements are unique and
B.ID is not listed there?
But Keylinks.Add('ID') works well in most cases (or when I fetch all
records before locating - see below). Therefore I didn't detect any
problems before.
I hope I could explain the issue.
Need I have to mail you an example?
Joe
--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@...>
wrote:
I've tried once more and I think I know the reason now.
The problem: The way how to use keylinks in joined-tables.
--------------------
My question:
Do I always have to specify the tablename in the keylinks when I'm
using joins?
-------------------
If so, it's my mistake and I have to check all my (more than 100)
keylink values in my application (migrated from BDE) :-(
The problem with locating records appears, when the second table has
the same fieldname (as primary key).
For example:
SQL.TEXT :=
'Select A.ID, A.OrderDate, B.CustomerName
From Orders A
Left Join Customers B ON A.CustomerID = B.ID';
Keylinks.Add('ID'); -> LOCATE-Error described below
Keylinks.Add('Orders.ID') -> It works (don't need FetchAll)
Thats very dangerous for me. I thought all works fine until I
detected the problem with locate. Do I need the tablename in
keylinks although the fields in the Select-statements are unique and
B.ID is not listed there?
But Keylinks.Add('ID') works well in most cases (or when I fetch all
records before locating - see below). Therefore I didn't detect any
problems before.
I hope I could explain the issue.
Need I have to mail you an example?
Joe
--- In IBObjects@yahoogroups.com, "Jason Wharton" <jwharton@...>
wrote:
>may have a
> It seems as though there is a possible bug in IBO.
> Would you send me a sample app demonstrating this problem?
>
> I've got another release I'm getting ready and if you are quick I
> fix for this included.[mailto:IBObjects@yahoogroups.com]On
>
> Regards,
> Jason Wharton
>
>
> > -----Original Message-----
> > From: IBObjects@yahoogroups.com
> > Behalf Of scr0546record is
> > Sent: Wednesday, May 10, 2006 1:22 AM
> > To: IBObjects@yahoogroups.com
> > Subject: [IBO] Fixed, but strange for me
> >
> >
> > I've fixed the problem, it's not an issue of joining tables.
> >
> > 1) Searching for a record in a DBGrid, using Filter = 'NR=123'
> > (set by customer in a TEdit)
> > 2) Some resultfields are stored in variables
> > 3) Filtered := false; Filter :='' when closing the Searchform.
> > 4) When I then want to locate the record again, NR=123 is not
> > found ...
> >
> > The solution:
> > Set the property: AutoFetchall = true;
> > or TIBOQuery.InternalDataset.FetchAll after unfiltering.
> >
> > This is very strange for me (coming from BDE), because the
> > located (and fetched) before. After setting Filtered to false, Ihave
> > to fetch (really all?) records again when I want to locate therecord
> > again.
> >
> > joe
>