sqldb: Empty dataset is not EOF after Dataset.first
Original Reporter info from Mantis: Jesus @jramx
-
Reporter name: Jesus Reyes
Original Reporter info from Mantis: Jesus @jramx
- Reporter name: Jesus Reyes
Description:
in 2.0.3 SVN, firebird 2.xx.rc2, doing something like:
....
SqlQuery1.SQL.add('SELECT * from Table');
SqlQuery1.Open;
SqlQuery1.First;
while not SQLQuery1.EOF do begin
[code]
end;
Even if table "Table" is empty SQLQuery is not in EOF state, and [code] gets executed.... See additional information....
Additional information:
in TBufDataSet.InternalOpen, FCurrentRecBuf is set to FLastRecBuf
but in TBufDataset.InternalFirst, FCurrentRecBuf is nil.
so the following check in TBufDataset.GetRecord fails, and the result is not set to grEOF but to grOk.
139 gmNext :
140 if FCurrentRecBuf = FLastRecBuf then // Dataset is empty (just opened)
141 begin
142 if getnextpacket = 0 then result := grEOF;
143 end
I dont' know if adding FLastRecBuf to nil in TBufDataset.InternalFirst or setting its value to FFirstRecBuf is the fix, I tried the first option and it worked.
Mantis conversion info:
- Mantis ID: 7211
- Version: 2.0.4
- Fixed in revision: r4327 (#d979196d)