mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 20:00:19 +02:00
fcl-db: sdfdataset: SetRecNo should take into account FDataOffset (aka FirstLineAsSchema). Revealed by TestSetRecNo.
git-svn-id: trunk@30509 -
This commit is contained in:
parent
db4d95be64
commit
ab689edadb
@ -265,7 +265,6 @@ type
|
||||
procedure SetFirstLineAsSchema(Value : Boolean);
|
||||
procedure SetDelimiter(Value : Char);
|
||||
protected
|
||||
function GetRecordCount: Integer; override;
|
||||
procedure InternalInitFieldDefs; override;
|
||||
function GetRecord(Buffer: TRecordBuffer; GetMode: TGetMode; DoCheck: Boolean)
|
||||
: TGetResult; override;
|
||||
@ -501,7 +500,7 @@ end;
|
||||
|
||||
function TFixedFormatDataSet.GetRecordCount: Longint;
|
||||
begin
|
||||
Result := FData.Count;
|
||||
Result := FData.Count - FDataOffset;
|
||||
end;
|
||||
|
||||
function TFixedFormatDataSet.GetRecNo: Longint;
|
||||
@ -516,7 +515,7 @@ end;
|
||||
procedure TFixedFormatDataSet.SetRecNo(Value: Integer);
|
||||
begin
|
||||
CheckBrowseMode;
|
||||
if (Value >= 0) and (Value < FData.Count) and (Value <> RecNo) then
|
||||
if (Value >= 0) and (Value <= RecordCount) and (Value <> RecNo) then
|
||||
begin
|
||||
DoBeforeScroll;
|
||||
FCurRec := Value - 1;
|
||||
@ -888,11 +887,10 @@ begin
|
||||
FData.Append(Schema.DelimitedText);
|
||||
end
|
||||
else if (FData.Count = 0) or (Trim(FData[0]) = '') then
|
||||
begin
|
||||
begin
|
||||
FirstLineAsSchema := FALSE;
|
||||
FDataOffset:=0;
|
||||
end
|
||||
else if (Schema.Count = 0) or (FirstLineAsSchema) then
|
||||
end
|
||||
else if (Schema.Count = 0) or FirstLineAsSchema then
|
||||
begin
|
||||
Schema.Clear;
|
||||
SL:=FData[0];
|
||||
@ -1138,13 +1136,6 @@ begin
|
||||
FDelimiter := Value;
|
||||
end;
|
||||
|
||||
function TSdfDataSet.GetRecordCount: Integer;
|
||||
begin
|
||||
Result:=Inherited GetRecordCount;
|
||||
If Result>0 then
|
||||
Result:=Result-Ord(FirstLineAsSchema);
|
||||
end;
|
||||
|
||||
procedure TSdfDataSet.SetFirstLineAsSchema(Value : Boolean);
|
||||
begin
|
||||
CheckInactive;
|
||||
|
Loading…
Reference in New Issue
Block a user