summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlmindor <Almindor@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-03-25 17:28:58 +0000
committerAlmindor <Almindor@3ad0048d-3df7-0310-abae-a5850022a9f2>2008-03-25 17:28:58 +0000
commit21e47d348dd2b520e713f209038ccba800aa004b (patch)
treeea7b4ef3b6d83b5a20439eb806ca848c76c2b068
parent686994f3ad377f5e110485a55c53f2c331764095 (diff)
downloadfpc-cleanroom.tar.gz
* fix cleanroom TDataLink.CalcFirstRecord (passes tests now)cleanroom
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/cleanroom@10565 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r--packages/fcl-db/src/base/datasource.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/fcl-db/src/base/datasource.inc b/packages/fcl-db/src/base/datasource.inc
index ce3af0baf6..bccb1db5bd 100644
--- a/packages/fcl-db/src/base/datasource.inc
+++ b/packages/fcl-db/src/base/datasource.inc
@@ -58,10 +58,12 @@ end;
Function TDataLink.CalcFirstRecord(Index : Integer) : Integer;
-var
- n: Integer;
begin
- Result := DataSource.DataSet.FActiveRecord - (FFirstRecord + Index + FBufferCount - 1);
+ if DataSource.DataSet.FActiveRecord > FFirstRecord + Index + FBufferCount - 1 then
+ Result := DataSource.DataSet.FActiveRecord - (FFirstRecord + Index + FBufferCount - 1)
+ else if DataSource.DataSet.FActiveRecord < FFirstRecord + Index then
+ Result := DataSource.DataSet.FActiveRecord - (FFirstRecord + Index)
+ else Result := 0;
Inc(FFirstRecord, Index + Result);
end;