|
@@ -434,8 +434,7 @@ type
|
|
|
|
|
|
procedure FetchAll;
|
|
procedure FetchAll;
|
|
procedure ProcessFieldsToCompareStruct(const AFields, ADescFields, ACInsFields: TList;
|
|
procedure ProcessFieldsToCompareStruct(const AFields, ADescFields, ACInsFields: TList;
|
|
- const AIndexOptions: TIndexOptions; const ALocateOptions: TLocateOptions; out ACompareStruct: TDBCompareStruct);
|
|
|
|
- procedure BuildIndex(var AIndex : TBufIndex);
|
|
|
|
|
|
+ const AIndexOptions: TIndexOptions; const ALocateOptions: TLocateOptions; out ACompareStruct: TDBCompareStruct);
|
|
function BufferOffset: integer;
|
|
function BufferOffset: integer;
|
|
function GetIndexDefs : TIndexDefs;
|
|
function GetIndexDefs : TIndexDefs;
|
|
function GetCurrentBuffer: TRecordBuffer;
|
|
function GetCurrentBuffer: TRecordBuffer;
|
|
@@ -460,6 +459,9 @@ type
|
|
procedure CurrentRecordToBuffer(Buffer: TRecordBuffer);
|
|
procedure CurrentRecordToBuffer(Buffer: TRecordBuffer);
|
|
procedure SetBufUniDirectional(const AValue: boolean);
|
|
procedure SetBufUniDirectional(const AValue: boolean);
|
|
procedure InitDefaultIndexes;
|
|
procedure InitDefaultIndexes;
|
|
|
|
+ procedure BuildIndex(var AIndex : TBufIndex);
|
|
|
|
+ procedure BuildIndexes;
|
|
|
|
+ procedure RemoveRecordFromIndexes(const ABookmark : TBufBookmark);
|
|
protected
|
|
protected
|
|
function GetNewWriteBlobBuffer : PBlobBuffer;
|
|
function GetNewWriteBlobBuffer : PBlobBuffer;
|
|
procedure FreeBlobBuffer(var ABlobBuffer: PBlobBuffer);
|
|
procedure FreeBlobBuffer(var ABlobBuffer: PBlobBuffer);
|
|
@@ -494,7 +496,7 @@ type
|
|
function IsCursorOpen: Boolean; override;
|
|
function IsCursorOpen: Boolean; override;
|
|
function GetRecordCount: Longint; override;
|
|
function GetRecordCount: Longint; override;
|
|
procedure ApplyRecUpdate(UpdateKind : TUpdateKind); virtual;
|
|
procedure ApplyRecUpdate(UpdateKind : TUpdateKind); virtual;
|
|
- procedure SetOnUpdateError(const aValue: TResolverErrorEvent);
|
|
|
|
|
|
+ procedure SetOnUpdateError(const AValue: TResolverErrorEvent);
|
|
procedure SetFilterText(const Value: String); override; {virtual;}
|
|
procedure SetFilterText(const Value: String); override; {virtual;}
|
|
procedure SetFiltered(Value: Boolean); override; {virtual;}
|
|
procedure SetFiltered(Value: Boolean); override; {virtual;}
|
|
procedure InternalRefresh; override;
|
|
procedure InternalRefresh; override;
|
|
@@ -1050,6 +1052,22 @@ begin
|
|
DblLinkIndex.FLastRecBuf[DblLinkIndex.IndNr].prior:=l;
|
|
DblLinkIndex.FLastRecBuf[DblLinkIndex.IndNr].prior:=l;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TCustomBufDataset.BuildIndexes;
|
|
|
|
+var i: integer;
|
|
|
|
+begin
|
|
|
|
+ for i:=1 to FIndexesCount-1 do
|
|
|
|
+ if (i<>1) or (FIndexes[i]=FCurrentIndex) then
|
|
|
|
+ BuildIndex(FIndexes[i]);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+procedure TCustomBufDataset.RemoveRecordFromIndexes(const ABookmark: TBufBookmark);
|
|
|
|
+var i: integer;
|
|
|
|
+begin
|
|
|
|
+ for i:=0 to FIndexesCount-1 do
|
|
|
|
+ if (i<>1) or (FIndexes[i]=FCurrentIndex) then
|
|
|
|
+ FIndexes[i].RemoveRecordFromIndex(ABookmark);
|
|
|
|
+end;
|
|
|
|
+
|
|
function TCustomBufDataset.GetIndexDefs : TIndexDefs;
|
|
function TCustomBufDataset.GetIndexDefs : TIndexDefs;
|
|
|
|
|
|
begin
|
|
begin
|
|
@@ -1070,7 +1088,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function TCustomBufDataset.GetCanModify: Boolean;
|
|
|
|
|
|
+function TCustomBufDataset.GetCanModify: Boolean;
|
|
begin
|
|
begin
|
|
Result:=not (UniDirectional or ReadOnly);
|
|
Result:=not (UniDirectional or ReadOnly);
|
|
end;
|
|
end;
|
|
@@ -1915,11 +1933,7 @@ begin
|
|
FAllPacketsFetched := True;
|
|
FAllPacketsFetched := True;
|
|
// This code has to be placed elsewhere. At least it should also run when
|
|
// This code has to be placed elsewhere. At least it should also run when
|
|
// the datapacket is loaded from file ... see IntLoadRecordsFromFile
|
|
// the datapacket is loaded from file ... see IntLoadRecordsFromFile
|
|
- if FIndexesCount>0 then for x := 1 to FIndexesCount-1 do
|
|
|
|
- begin
|
|
|
|
- if not ((x=1) and (FIndexes[1].FieldsName='')) then
|
|
|
|
- BuildIndex(FIndexes[x]);
|
|
|
|
- end;
|
|
|
|
|
|
+ BuildIndexes;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2054,9 +2068,7 @@ begin
|
|
// Remove the record from all active indexes
|
|
// Remove the record from all active indexes
|
|
FCurrentIndex.StoreCurrentRecIntoBookmark(@RemRecBookmrk);
|
|
FCurrentIndex.StoreCurrentRecIntoBookmark(@RemRecBookmrk);
|
|
RemRec := FCurrentIndex.CurrentBuffer;
|
|
RemRec := FCurrentIndex.CurrentBuffer;
|
|
- for i := 0 to FIndexesCount-1 do
|
|
|
|
- if (i<>1) or (FIndexes[i]=FCurrentIndex) then
|
|
|
|
- FIndexes[i].RemoveRecordFromIndex(RemRecBookmrk);
|
|
|
|
|
|
+ RemoveRecordFromIndexes(RemRecBookmrk);
|
|
|
|
|
|
if not GetActiveRecordUpdateBuffer then
|
|
if not GetActiveRecordUpdateBuffer then
|
|
begin
|
|
begin
|
|
@@ -2135,9 +2147,7 @@ var StoreRecBM : TBufBookmark;
|
|
begin
|
|
begin
|
|
repeat
|
|
repeat
|
|
if (FCurrentUpdateBuffer<>StoreUpdBuf) then
|
|
if (FCurrentUpdateBuffer<>StoreUpdBuf) then
|
|
- begin
|
|
|
|
CancelUpdBuffer(FUpdateBuffer[FCurrentUpdateBuffer]);
|
|
CancelUpdBuffer(FUpdateBuffer[FCurrentUpdateBuffer]);
|
|
- end;
|
|
|
|
until not GetRecordUpdateBuffer(Bm,True,True);
|
|
until not GetRecordUpdateBuffer(Bm,True,True);
|
|
end;
|
|
end;
|
|
FCurrentUpdateBuffer:=StoreUpdBuf;
|
|
FCurrentUpdateBuffer:=StoreUpdBuf;
|
|
@@ -2153,7 +2163,7 @@ var StoreRecBM : TBufBookmark;
|
|
ScrollLast; // last record will be removed from index, so move to spare record
|
|
ScrollLast; // last record will be removed from index, so move to spare record
|
|
StoreCurrentRecIntoBookmark(@StoreRecBM);
|
|
StoreCurrentRecIntoBookmark(@StoreRecBM);
|
|
end;
|
|
end;
|
|
- FCurrentIndex.RemoveRecordFromIndex(Bm);
|
|
|
|
|
|
+ RemoveRecordFromIndexes(Bm);
|
|
FreeRecordBuffer(TmpBuf);
|
|
FreeRecordBuffer(TmpBuf);
|
|
dec(FBRecordCount);
|
|
dec(FBRecordCount);
|
|
end;
|
|
end;
|
|
@@ -2519,13 +2529,13 @@ begin
|
|
Result := FOpen;
|
|
Result := FOpen;
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function TCustomBufDataset.GetRecordCount: Longint;
|
|
|
|
|
|
+function TCustomBufDataset.GetRecordCount: Longint;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result := FBRecordCount;
|
|
Result := FBRecordCount;
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function TCustomBufDataset.UpdateStatus: TUpdateStatus;
|
|
|
|
|
|
+function TCustomBufDataset.UpdateStatus: TUpdateStatus;
|
|
|
|
|
|
begin
|
|
begin
|
|
Result:=usUnmodified;
|
|
Result:=usUnmodified;
|
|
@@ -2991,9 +3001,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
// rebuild indexes
|
|
// rebuild indexes
|
|
- for x:=1 to FIndexesCount-1 do
|
|
|
|
- if (x<>1) or (FIndexes[x]=FCurrentIndex) then
|
|
|
|
- BuildIndex(FIndexes[x]);
|
|
|
|
|
|
+ BuildIndexes;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TCustomBufDataset.DoFilterRecord(out Acceptable: Boolean);
|
|
procedure TCustomBufDataset.DoFilterRecord(out Acceptable: Boolean);
|
|
@@ -3104,7 +3112,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-Function TCustomBufDataset.Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions) : boolean;
|
|
|
|
|
|
+function TCustomBufDataset.Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions) : boolean;
|
|
|
|
|
|
var CurrLinkItem : PBufRecLinkItem;
|
|
var CurrLinkItem : PBufRecLinkItem;
|
|
bm : TBufBookmark;
|
|
bm : TBufBookmark;
|
|
@@ -3742,6 +3750,7 @@ begin
|
|
// Do nothing
|
|
// Do nothing
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+
|
|
initialization
|
|
initialization
|
|
setlength(RegisteredDatapacketReaders,0);
|
|
setlength(RegisteredDatapacketReaders,0);
|
|
finalization
|
|
finalization
|