Subject | Re: Strange behavior of 2 TIB_Cursor |
---|---|
Author | ac.hi@switzerland.org |
Post date | 2001-05-24T18:51:05Z |
I did some more testing. Maybe that can help to find the cause a bit
easier. I found the following:
When I check the RecNo too, I find, that I have for both cursors
sequent numbers. There is nothing like a jump in the RecNo. But at
least one query doesn't return enough records and I miss some
records in between (based on PersonID).
RecordCount (called after the First method) returns for both cursors
the same number. It's the number I expected. But one query runs out of
records (I mean is EOF with Next command) much earlier. i.e
RecordCount is 17436, EOF is reached after RecNo 142.
When I do both SELECT statements in IBConsole the result is as
expected: I find all records.
Replacing the TIB_Cursor with a TIBOQuery doesn't change anything.
Daniel Achermann
easier. I found the following:
When I check the RecNo too, I find, that I have for both cursors
sequent numbers. There is nothing like a jump in the RecNo. But at
least one query doesn't return enough records and I miss some
records in between (based on PersonID).
RecordCount (called after the First method) returns for both cursors
the same number. It's the number I expected. But one query runs out of
records (I mean is EOF with Next command) much earlier. i.e
RecordCount is 17436, EOF is reached after RecNo 142.
When I do both SELECT statements in IBConsole the result is as
expected: I find all records.
Replacing the TIB_Cursor with a TIBOQuery doesn't change anything.
Daniel Achermann
> > >I have the following problem:of
> > >
> > >I create two TIB_Cursor at runtime, set the properties for
> connection
> > >and add a SQL-Command. The command is similar for both, it should
> > >return records with the same ID but different fields, something
> like
> > >
> > > SELECT PersonID, Fld1, Fld2, Fld3
> > > FROM Person
> > > ORDER BY PersonID
> > >
> > > and
> > >
> > > SELECT PersonID, Fld4, Fld5, Fld6
> > > FROM Person
> > > ORDER BY PersonID
> > >
> > >The real Sql-Command is much more complex and is a join of a lot
> > >tables. The reason why I have to split it, is because the commandbased
> is
> > >too complex.
> > >
> > >Afterwards I want to step through the two cursor. I'm doing that
> like
> > >this:
> > >
> > > cursor1.First;
> > > cursor2.First;
> > > while not cursor1.Eof do begin
> > > do several things
> > > cursor1.Next;
> > > cursor2.Next;
> > > end;
> > >
> > >I expect that both cursor have the same records, that means the
> > >PersonID should always be the same.
> > >
> > >But it isn't. One can argue that this is based on the
> Sql-statement.
> > >
> > >But the really strange thing is, that I get different results
> onare
> > >the order which cursor I open first. When I write the statements
> above
> > >different:
> > >
> > > cursor2.First;
> > > cursor1.First;
> > > while not cursor1.Eof do begin
> > > do several things
> > > cursor1.Next;
> > > cursor2.Next;
> > > end;
> > >
> > >opening first cursor2, the results is different, other records
> > >missing. The cursor I open first seems to return the correctThe
> (amount
> > >of) records, but in the second query some records are missing:
> > >first few records seem to be correct but suddenly I have a gap.
> > >
> > >I'm using:
> > > - IBO 3.6Dg
> > > - Delphi 5.1
> > > - Interbase 6
> > >
> > >Has anyone an idea what could be the problem about it?
> >
> >
> > Yes: you need to put these two datasets under the control of the
> same
> > transaction and start that transaction before you call Open (or
> First) on
> > the ib_cursors. Make sure the Isolation level is tiCommitted.
> >
> > Helen