mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 00:29:12 +02:00
* Make GetRecNo return 0 on empty and closed datasets
git-svn-id: trunk@30929 -
This commit is contained in:
parent
e8175ed0cf
commit
a27cee5cfb
@ -790,15 +790,13 @@ function TCustomSqliteDataset.GetRecNo: Integer;
|
|||||||
var
|
var
|
||||||
TempItem, TempActive: PDataRecord;
|
TempItem, TempActive: PDataRecord;
|
||||||
begin
|
begin
|
||||||
Result := -1;
|
Result := 0;
|
||||||
if (FRecordCount = 0) or (State = dsInsert) then
|
if (FRecordCount = 0) or (State = dsInsert) then
|
||||||
Exit;
|
Exit;
|
||||||
TempItem := FBeginItem;
|
TempItem := FBeginItem;
|
||||||
TempActive := PPDataRecord(ActiveBuffer)^;
|
TempActive := PPDataRecord(ActiveBuffer)^;
|
||||||
if TempActive = FCacheItem then // Record is being edited
|
if TempActive = FCacheItem then // Record is being edited
|
||||||
TempActive := FInternalActiveBuffer;
|
TempActive := FInternalActiveBuffer;
|
||||||
//RecNo is 1 based
|
|
||||||
Inc(Result);
|
|
||||||
while TempActive <> TempItem do
|
while TempActive <> TempItem do
|
||||||
begin
|
begin
|
||||||
if TempItem^.Next <> nil then
|
if TempItem^.Next <> nil then
|
||||||
@ -808,9 +806,8 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Result := -1;
|
Result := 0;
|
||||||
DatabaseError('GetRecNo - ActiveItem Not Found', Self);
|
DatabaseError('GetRecNo - ActiveItem Not Found', Self);
|
||||||
break;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user