mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 01:51:21 +02:00
* Improved error-handling in TBufDataset.ApplyUpdates
git-svn-id: trunk@6353 -
This commit is contained in:
parent
125136d069
commit
99b15e95a1
@ -746,6 +746,7 @@ var r : Integer;
|
|||||||
FailedCount : integer;
|
FailedCount : integer;
|
||||||
Response : TResolverResponse;
|
Response : TResolverResponse;
|
||||||
StoreRecBuf : PBufRecLinkItem;
|
StoreRecBuf : PBufRecLinkItem;
|
||||||
|
AUpdateErr : EUpdateError;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
CheckBrowseMode;
|
CheckBrowseMode;
|
||||||
@ -771,13 +772,21 @@ begin
|
|||||||
Inc(FailedCount);
|
Inc(FailedCount);
|
||||||
if failedcount > word(MaxErrors) then Response := rrAbort
|
if failedcount > word(MaxErrors) then Response := rrAbort
|
||||||
else Response := rrSkip;
|
else Response := rrSkip;
|
||||||
if assigned(FOnUpdateError) then FOnUpdateError(Self,Self,EUpdateError.Create(SOnUpdateError,E.Message,0,0,E),FUpdateBuffer[r].UpdateKind,Response)
|
if assigned(FOnUpdateError) then
|
||||||
else if Response = rrAbort then Raise EUpdateError.Create(SOnUpdateError,E.Message,0,0,E)
|
begin
|
||||||
|
AUpdateErr := EUpdateError.Create(SOnUpdateError,E.Message,0,0,Exception(AcquireExceptionObject));
|
||||||
|
FOnUpdateError(Self,Self,AUpdateErr,FUpdateBuffer[r].UpdateKind,Response);
|
||||||
|
AUpdateErr.Free;
|
||||||
|
if Response in [rrApply, rrIgnore] then dec(FailedCount);
|
||||||
|
if Response = rrApply then dec(r);
|
||||||
|
end
|
||||||
|
else if Response = rrAbort then
|
||||||
|
Raise EUpdateError.Create(SOnUpdateError,E.Message,0,0,Exception(AcquireExceptionObject));
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise;
|
raise;
|
||||||
end;
|
end;
|
||||||
if response = rrApply then
|
if response in [rrApply, rrIgnore] then
|
||||||
begin
|
begin
|
||||||
FreeRecordBuffer(FUpdateBuffer[r].OldValuesBuffer);
|
FreeRecordBuffer(FUpdateBuffer[r].OldValuesBuffer);
|
||||||
FUpdateBuffer[r].BookmarkData := nil;
|
FUpdateBuffer[r].BookmarkData := nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user