You are not logged in.
Pages: 1
The normal way to retrieve some records is this, which is quite clear and handsome
if MyRecord.FillPrepare( MyClient, 'IntData=?', [], [1] ) then
while MyRecord.FillOne do
begin
// do something very important
end;
But if we get no result from FillPrepare we will get an Exception from FillOne
// Fill with definitive no Rows just for testing
if MyRecord.FillPrepare( MyClient, '1=0', [], [] ) then // is true because the statement is correct
while MyRecord.FillOne do // <-- here we get an exception
begin
// do something very important
end;
Is this behavior a feature?
The fix is really simple to do
function TSQLRecord.FillOne: boolean;
begin
if (self=nil) or (fFill=nil) or (fFill.Table=nil) or
(fFill.Table.RowCount=0) or // <-- also check if FillTable is emtpy
(cardinal(fFill.FillCurrentRow)>cardinal(fFill.Table.RowCount)) then
result := false else begin
FillRow(fFill.FillCurrentRow);
inc(fFill.FillCurrentRow);
result := true;
end;
end;
Offline
I think this is a failure, not a feature.
I've added your fix in http://synopse.info/fossil/info/967c1cb0dc
Thanks for the report and the associated fix!
Offline
Pages: 1