- Fixed insertion at buffer-limit

- Added TDataset.InternalInsert
  - The deDatasetScrollEvent was not always raised
  - Changed resync-order in AppendRecord
This commit is contained in:
joost 2005-02-07 11:19:27 +00:00
parent c2c174e29a
commit 6ecf61688f

View File

@ -931,6 +931,12 @@ begin
DoInsertAppend(True); DoInsertAppend(True);
end; end;
Procedure TDataset.InternalInsert;
begin
//!! To be implemented
end;
Procedure TDataset.AppendRecord(const Values: array of const); Procedure TDataset.AppendRecord(const Values: array of const);
begin begin
@ -1087,6 +1093,8 @@ Procedure TDataset.DoInsertAppend(DoAppend : Boolean);
move(FBuffers[FActiveRecord],FBuffers[FActiveRecord+1],(Fbuffercount-FActiveRecord)*sizeof(FBuffers[0])); move(FBuffers[FActiveRecord],FBuffers[FActiveRecord+1],(Fbuffercount-FActiveRecord)*sizeof(FBuffers[0]));
FBuffers[FActiveRecord]:=TempBuf; FBuffers[FActiveRecord]:=TempBuf;
end end
else if FRecordcount=FBuffercount then
shiftbuffersbackward
else else
inc(FActiveRecord); inc(FActiveRecord);
@ -1103,8 +1111,13 @@ Procedure TDataset.DoInsertAppend(DoAppend : Boolean);
else else
begin begin
fBOF := false; fBOF := false;
// 29:01:05, JvdS: Why is this here?!? It can result in records with the same bookmark-data?
// I would say that the 'internalinsert' should do this. But I don't know how Tdbf handles it
if FRecordcount > 0 then SetBookMarkData(ActiveBuffer,pointer(BookBeforeInsert)); if FRecordcount > 0 then SetBookMarkData(ActiveBuffer,pointer(BookBeforeInsert));
end; end;
InternalInsert;
// update buffer count. // update buffer count.
If FRecordCount<FBufferCount then If FRecordCount<FBufferCount then
Inc(FRecordCount); Inc(FRecordCount);
@ -1465,6 +1478,7 @@ begin
exit; exit;
DoBeforeScroll; DoBeforeScroll;
Try Try
Scrolled := 0;
If Distance>0 then If Distance>0 then
Scrolled:=ScrollForward Scrolled:=ScrollForward
else else
@ -1473,7 +1487,8 @@ begin
{$ifdef dsdebug} {$ifdef dsdebug}
WriteLn('ActiveRecord=', FActiveRecord,' FEOF=',FEOF,' FBOF=',FBOF); WriteLn('ActiveRecord=', FActiveRecord,' FEOF=',FEOF,' FBOF=',FBOF);
{$Endif} {$Endif}
If FRecordCount<>PrevRecordCount then // If FRecordCount<>PrevRecordCount then
if Scrolled = 0 then
DataEvent(deDatasetChange,0) DataEvent(deDatasetChange,0)
else else
DataEvent(deDatasetScroll,Scrolled); DataEvent(deDatasetScroll,Scrolled);
@ -1525,9 +1540,10 @@ begin
writeln ('Post: Internalpost succeeded'); writeln ('Post: Internalpost succeeded');
{$endif} {$endif}
FreeFieldBuffers; FreeFieldBuffers;
// SetCurrentRecord(FActiverecord); // First set the state to dsBrowse, then the Resync, to prevent the calling of
Resync([]); // the deDatasetChange event, while the state is still 'editable', while the db isn't
SetState(dsBrowse); SetState(dsBrowse);
Resync([]);
{$ifdef dsdebug} {$ifdef dsdebug}
writeln ('Post: Browse mode set'); writeln ('Post: Browse mode set');
{$endif} {$endif}
@ -1742,7 +1758,13 @@ end;
{ {
$Log$ $Log$
Revision 1.30 2005-01-12 10:27:57 michael Revision 1.31 2005-02-07 11:19:27 joost
- Fixed insertion at buffer-limit
- Added TDataset.InternalInsert
- The deDatasetScrollEvent was not always raised
- Changed resync-order in AppendRecord
Revision 1.30 2005/01/12 10:27:57 michael
* Patch from Joost Van der Sluis: * Patch from Joost Van der Sluis:
- implemented ControlsDisabled - implemented ControlsDisabled