76 |
|
function GetSQL(UpdateKind: TUpdateKind): TStrings; virtual; abstract; |
77 |
|
procedure InternalSetParams(Params: ISQLParams; buff: PChar); overload; |
78 |
|
procedure InternalSetParams(Query: TIBSQL; buff: PChar); overload; |
79 |
< |
procedure UpdateRecordFromQuery(QryResults: IResults; Buffer: PChar); |
79 |
> |
procedure UpdateRecordFromQuery(UpdateKind: TUpdateKind; QryResults: IResults; Buffer: PChar); |
80 |
|
property DataSet: TIBCustomDataSet read GetDataSet write SetDataSet; |
81 |
|
public |
82 |
|
constructor Create(AOwner: TComponent); override; |
371 |
|
|
372 |
|
TOnValidatePost = procedure (Sender: TObject; var CancelPost: boolean) of object; |
373 |
|
|
374 |
+ |
TOnDeleteReturning = procedure (Sender: TObject; QryResults: IResults) of object; |
375 |
+ |
|
376 |
|
TIBCustomDataSet = class(TDataset) |
377 |
|
private |
378 |
|
FAllowAutoActivateTransaction: Boolean; |
405 |
|
FDeletedRecords: Long; |
406 |
|
FModelBuffer, |
407 |
|
FOldBuffer: PChar; |
408 |
+ |
FOnDeleteReturning: TOnDeleteReturning; |
409 |
|
FOnValidatePost: TOnValidatePost; |
410 |
|
FOpen: Boolean; |
411 |
|
FInternalPrepared: Boolean; |
469 |
|
procedure DoBeforeTransactionEnd(Sender: TObject; Action: TTransactionAction); |
470 |
|
procedure DoAfterTransactionEnd(Sender: TObject); |
471 |
|
procedure DoTransactionFree(Sender: TObject); |
472 |
+ |
procedure DoDeleteReturning(QryResults: IResults); |
473 |
|
procedure FetchCurrentRecordToBuffer(Qry: TIBSQL; RecordNumber: Integer; |
474 |
|
Buffer: PChar); |
475 |
|
function GetDatabase: TIBDatabase; |
735 |
|
write FOnUpdateError; |
736 |
|
property OnUpdateRecord: TIBUpdateRecordEvent read FOnUpdateRecord |
737 |
|
write FOnUpdateRecord; |
738 |
+ |
property OnDeleteReturning: TOnDeleteReturning read FOnDeleteReturning |
739 |
+ |
write FOnDeleteReturning; |
740 |
|
end; |
741 |
|
|
742 |
|
TIBParserDataSet = class(TIBCustomDataSet) |
823 |
|
property OnNewRecord; |
824 |
|
property OnPostError; |
825 |
|
property OnValidatePost; |
826 |
+ |
property OnDeleteReturning; |
827 |
|
end; |
828 |
|
|
829 |
|
{ TIBDSBlobStream } |
1973 |
|
FTransactionFree(Sender); |
1974 |
|
end; |
1975 |
|
|
1976 |
+ |
procedure TIBCustomDataSet.DoDeleteReturning(QryResults: IResults); |
1977 |
+ |
begin |
1978 |
+ |
if assigned(FOnDeleteReturning) then |
1979 |
+ |
OnDeleteReturning(self,QryResults); |
1980 |
+ |
end; |
1981 |
+ |
|
1982 |
|
procedure TIBCustomDataSet.InitModelBuffer(Qry: TIBSQL; Buffer: PChar); |
1983 |
|
var i, j: Integer; |
1984 |
|
FieldsLoaded: integer; |
2334 |
|
begin |
2335 |
|
SetInternalSQLParams(FQDelete.Params, Buff); |
2336 |
|
FQDelete.ExecQuery; |
2337 |
+ |
if (FQDelete.FieldCount > 0) then |
2338 |
+ |
DoDeleteReturning(FQDelete.Current); |
2339 |
|
end; |
2340 |
|
with PRecordData(Buff)^ do |
2341 |
|
begin |
2729 |
|
|
2730 |
|
procedure TIBCustomDataSet.SetDatabase(Value: TIBDatabase); |
2731 |
|
begin |
2732 |
< |
if (FBase.Database <> Value) then |
2732 |
> |
if (csLoading in ComponentState) or (FBase.Database <> Value) then |
2733 |
|
begin |
2734 |
|
CheckDatasetClosed; |
2735 |
|
InternalUnPrepare; |
5010 |
|
InternalSetParams(Query.Params,buff); |
5011 |
|
end; |
5012 |
|
|
5013 |
< |
procedure TIBDataSetUpdateObject.UpdateRecordFromQuery(QryResults: IResults; |
5014 |
< |
Buffer: PChar); |
5013 |
> |
procedure TIBDataSetUpdateObject.UpdateRecordFromQuery(UpdateKind: TUpdateKind; |
5014 |
> |
QryResults: IResults; Buffer: PChar); |
5015 |
|
begin |
5016 |
|
if not Assigned(DataSet) then Exit; |
5017 |
< |
DataSet.UpdateRecordFromQuery(QryResults, Buffer); |
5017 |
> |
case UpdateKind of |
5018 |
> |
ukModify, ukInsert: |
5019 |
> |
DataSet.UpdateRecordFromQuery(QryResults, Buffer); |
5020 |
> |
ukDelete: |
5021 |
> |
DataSet.DoDeleteReturning(QryResults); |
5022 |
> |
end; |
5023 |
|
end; |
5024 |
|
|
5025 |
|
function TIBDSBlobStream.GetSize: Int64; |