Subject | Strange behavior of 2 TIB_Cursor |
---|---|
Author | ac.hi@switzerland.org |
Post date | 2001-05-24T10:42:17Z |
Hi!
I have the following problem:
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 of
tables. The reason why I have to split it, is because the command 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 based on
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 are
missing. The cursor I open first seems to return the correct (amount
of) records, but in the second query some records are missing: The
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?
Thank's for any help!
Daniel Achermann
I have the following problem:
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 of
tables. The reason why I have to split it, is because the command 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 based on
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 are
missing. The cursor I open first seems to return the correct (amount
of) records, but in the second query some records are missing: The
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?
Thank's for any help!
Daniel Achermann