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 } |
1131 |
|
3, {Assume UNICODE_FSS is really UTF8} |
1132 |
|
4: {Include GB18030 - assuming UTF8 routines work for this codeset} |
1133 |
|
if DisplayWidth = 0 then |
1134 |
< |
Result := ValidUTF8String(TextToSingleLine(Result)) |
1134 |
> |
Result := Utf8EscapeControlChars(TextToSingleLine(Result)) |
1135 |
|
else |
1136 |
|
if UTF8Length(Result) > DisplayWidth then {Show truncation with elipses} |
1137 |
< |
Result := ValidUTF8String(TextToSingleLine(UTF8Copy(Result,1,DisplayWidth-3))) + '...'; |
1137 |
> |
Result := Utf8EscapeControlChars(TextToSingleLine(UTF8Copy(Result,1,DisplayWidth-3))) + '...'; |
1138 |
|
end; |
1139 |
|
end |
1140 |
|
end; |
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 |
2769 |
|
fn: string; |
2770 |
|
st: RawByteString; |
2771 |
|
OldBuffer: Pointer; |
2757 |
– |
ts: TTimeStamp; |
2772 |
|
Param: ISQLParam; |
2773 |
|
begin |
2774 |
|
if (Buffer = nil) then |
3814 |
|
FieldType: TFieldType; |
3815 |
|
FieldSize: Word; |
3816 |
|
FieldDataSize: integer; |
3803 |
– |
charSetID: short; |
3817 |
|
CharSetSize: integer; |
3818 |
|
CharSetName: RawByteString; |
3819 |
|
FieldCodePage: TSystemCodePage; |
5008 |
|
InternalSetParams(Query.Params,buff); |
5009 |
|
end; |
5010 |
|
|
5011 |
< |
procedure TIBDataSetUpdateObject.UpdateRecordFromQuery(QryResults: IResults; |
5012 |
< |
Buffer: PChar); |
5011 |
> |
procedure TIBDataSetUpdateObject.UpdateRecordFromQuery(UpdateKind: TUpdateKind; |
5012 |
> |
QryResults: IResults; Buffer: PChar); |
5013 |
|
begin |
5014 |
|
if not Assigned(DataSet) then Exit; |
5015 |
< |
DataSet.UpdateRecordFromQuery(QryResults, Buffer); |
5015 |
> |
case UpdateKind of |
5016 |
> |
ukModify, ukInsert: |
5017 |
> |
DataSet.UpdateRecordFromQuery(QryResults, Buffer); |
5018 |
> |
ukDelete: |
5019 |
> |
DataSet.DoDeleteReturning(QryResults); |
5020 |
> |
end; |
5021 |
|
end; |
5022 |
|
|
5023 |
|
function TIBDSBlobStream.GetSize: Int64; |