Board index » delphi » Bug in TIBQuery ?

Bug in TIBQuery ?

Hello,

i am using D5 prof. and IBX 5.03.
In my program i have a TIBQuery with a simple
'select id from myTable order by myDate'
this select brings me 3 records with the values 22, 25, 21
in the first
while not query.EOF do begin
   ...
  query.Next;
end;
i get the values shown as above.
but when i now do a   query.first  and i execute the loop
again, i get the values 21, 25, 21 - the first record shows
the value of the last record from the first loop.
Only if i do a query.close/query.open instead of a query.first
between the two loops the values in the second loop are equal
to the values in the first loop.

Is this a bug or the normal behavior of TIBQuery ??

TIA,
Helmut

 

Re:Bug in TIBQuery ?


Quote
"Helmut W?ss" wrote:

> Hello,

> i am using D5 prof. and IBX 5.03.
> In my program i have a TIBQuery with a simple
> 'select id from myTable order by myDate'
> this select brings me 3 records with the values 22, 25, 21
> in the first
> while not query.EOF do begin
>    ...
>   query.Next;
> end;
> i get the values shown as above.
> but when i now do a   query.first  and i execute the loop
> again, i get the values 21, 25, 21 - the first record shows
> the value of the last record from the first loop.

You have unidirectional set to true.  Unidirectional only maintains two records,
the currentone and the last one.   You can not go backwards in a unidirectional
dataset so you are seeing the same two records over and over again.

Quote
> Only if i do a query.close/query.open instead of a query.first
> between the two loops the values in the second loop are equal
> to the values in the first loop.

> Is this a bug or the normal behavior of TIBQuery ??

Normal behavior for a unidirectional dataset that you try to go backwards on.

Quote

> TIA,
> Helmut

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
This sad little lizard told me that he was a brontosaurus on his mother's
side.  I did not laugh; people who boast of ancestry often have little else
to sustain them.  Humoring them costs nothing and adds to happiness in
a world in which happiness is in short supply.   (RAH)

Re:Bug in TIBQuery ?


thank you very much, Jeff
i think i was blind .

"Jeff Overcash (TeamB)" <jeffoverc...@mindspring.com> schrieb im Newsbeitrag
news:3CB1B0AC.D41329E@mindspring.com...

Quote

> "Helmut W?ss" wrote:

> > Hello,

> > i am using D5 prof. and IBX 5.03.
> > In my program i have a TIBQuery with a simple
> > 'select id from myTable order by myDate'
> > this select brings me 3 records with the values 22, 25, 21
> > in the first
> > while not query.EOF do begin
> >    ...
> >   query.Next;
> > end;
> > i get the values shown as above.
> > but when i now do a   query.first  and i execute the loop
> > again, i get the values 21, 25, 21 - the first record shows
> > the value of the last record from the first loop.

> You have unidirectional set to true.  Unidirectional only maintains two
records,
> the currentone and the last one.   You can not go backwards in a
unidirectional
> dataset so you are seeing the same two records over and over again.

> > Only if i do a query.close/query.open instead of a query.first
> > between the two loops the values in the second loop are equal
> > to the values in the first loop.

> > Is this a bug or the normal behavior of TIBQuery ??

> Normal behavior for a unidirectional dataset that you try to go backwards
on.

> > TIA,
> > Helmut

> --
> Jeff Overcash (TeamB)
>       (Please do not email me directly unless  asked. Thank You)
> This sad little lizard told me that he was a brontosaurus on his mother's
> side.  I did not laugh; people who boast of ancestry often have little
else
> to sustain them.  Humoring them costs nothing and adds to happiness in
> a world in which happiness is in short supply.   (RAH)

Other Threads