Selaa lähdekoodia

* Fix getrecno, needs a 1-based number

michael 7 vuotta sitten
vanhempi
commit
6bf2506960
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      packages/fcl-db/jsondataset.pas

+ 2 - 2
packages/fcl-db/jsondataset.pas

@@ -456,7 +456,7 @@ Var
 
 
 begin
 begin
   bkmIdx:=Integer(ActiveBuffer.bookmark);
   bkmIdx:=Integer(ActiveBuffer.bookmark);
-  Result:=FCurrentIndex.FindRecord(bkmIdx);
+  Result:=FCurrentIndex.FindRecord(bkmIdx)+1;
 end;
 end;
 
 
 procedure TBaseJSONDataSet.InternalInitFieldDefs;
 procedure TBaseJSONDataSet.InternalInitFieldDefs;
@@ -816,7 +816,7 @@ end;
 
 
 procedure TBaseJSONDataSet.SetRecNo(Value: Integer);
 procedure TBaseJSONDataSet.SetRecNo(Value: Integer);
 begin
 begin
-  if (Value < 0) or (Value > FCurrentIndex.Count) then
+  if (Value < 1) or (Value > FCurrentIndex.Count) then
     raise EJSONDataset.CreateFmt('%s: SetRecNo: index %d out of range',[Name,Value]);
     raise EJSONDataset.CreateFmt('%s: SetRecNo: index %d out of range',[Name,Value]);
   FCurrent := Value - 1;
   FCurrent := Value - 1;
   Resync([]); 
   Resync([]);