From f09825db1a436fcd1ce0cf08318467ebb256f32d Mon Sep 17 00:00:00 2001 From: Wesley Capelari Date: Mon, 14 Oct 2024 08:47:38 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Adicionado=20exporta=C3=A7=C3=A3o=20de=20es?= =?UTF-8?q?trutura=20de=20datasets=20aninhados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- samples/delphi/basic/basic.dproj | 20 +-- .../delphi/configuration/configuration.dproj | 155 ++++++++++++++++-- .../delphi/master-detail/master_detail.dproj | 155 ++++++++++++++++-- 3 files changed, 276 insertions(+), 54 deletions(-) diff --git a/samples/delphi/basic/basic.dproj b/samples/delphi/basic/basic.dproj index 1f4765c..7b7487a 100644 --- a/samples/delphi/basic/basic.dproj +++ b/samples/delphi/basic/basic.dproj @@ -1,7 +1,7 @@  {A3A36D6D-4E03-4080-9131-6EE072988A8A} - 20.1 + 20.2 VCL basic.dpr True @@ -132,7 +132,7 @@ basic.dpr - + @@ -146,16 +146,6 @@ 0 - - - classes - 64 - - - classes - 64 - - res\xml @@ -166,12 +156,6 @@ 1 - - - library\lib\armeabi-v7a - 1 - - library\lib\armeabi diff --git a/samples/delphi/configuration/configuration.dproj b/samples/delphi/configuration/configuration.dproj index f19308d..88bbece 100644 --- a/samples/delphi/configuration/configuration.dproj +++ b/samples/delphi/configuration/configuration.dproj @@ -1,7 +1,7 @@  {7F70D432-1B9F-41E8-B1A0-EE25289D304A} - 19.5 + 20.2 VCL configuration.dpr True @@ -9,6 +9,7 @@ Win32 1 Application + configuration true @@ -142,7 +143,7 @@ Microsoft Office XP Sample Automation Server Wrapper Components - + @@ -156,16 +157,6 @@ 0 - - - classes - 64 - - - classes - 64 - - res\xml @@ -176,12 +167,6 @@ 1 - - - library\lib\armeabi-v7a - 1 - - library\lib\armeabi @@ -234,6 +219,16 @@ 1 + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + res\values @@ -254,6 +249,66 @@ 1 + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + res\values @@ -264,6 +319,16 @@ 1 + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + res\drawable @@ -434,6 +499,56 @@ 1 + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + 1 @@ -674,6 +789,9 @@ 1 + + 1 + @@ -967,6 +1085,7 @@ + True diff --git a/samples/delphi/master-detail/master_detail.dproj b/samples/delphi/master-detail/master_detail.dproj index c3e747e..1607257 100644 --- a/samples/delphi/master-detail/master_detail.dproj +++ b/samples/delphi/master-detail/master_detail.dproj @@ -1,7 +1,7 @@  {DBC652BE-1BF8-463D-9ECB-DB80E75EA408} - 19.5 + 20.2 VCL master_detail.dpr True @@ -9,6 +9,7 @@ Win32 1 Application + master_detail true @@ -131,7 +132,7 @@ master_detail.dpr - + @@ -145,16 +146,6 @@ 0 - - - classes - 64 - - - classes - 64 - - res\xml @@ -165,12 +156,6 @@ 1 - - - library\lib\armeabi-v7a - 1 - - library\lib\armeabi @@ -223,6 +208,16 @@ 1 + + + res\drawable-anydpi-v21 + 1 + + + res\drawable-anydpi-v21 + 1 + + res\values @@ -243,6 +238,66 @@ 1 + + + res\values-v31 + 1 + + + res\values-v31 + 1 + + + + + res\drawable-anydpi-v26 + 1 + + + res\drawable-anydpi-v26 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-anydpi-v33 + 1 + + + res\drawable-anydpi-v33 + 1 + + res\values @@ -253,6 +308,16 @@ 1 + + + res\values-night-v21 + 1 + + + res\values-night-v21 + 1 + + res\drawable @@ -423,6 +488,56 @@ 1 + + + res\drawable-anydpi-v24 + 1 + + + res\drawable-anydpi-v24 + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-night-anydpi-v21 + 1 + + + res\drawable-night-anydpi-v21 + 1 + + + + + res\drawable-anydpi-v31 + 1 + + + res\drawable-anydpi-v31 + 1 + + + + + res\drawable-night-anydpi-v31 + 1 + + + res\drawable-night-anydpi-v31 + 1 + + 1 @@ -663,6 +778,9 @@ 1 + + 1 + @@ -956,6 +1074,7 @@ + True From 948c65e3ca7fe68c36fa82a1444f9bf9372d0cb4 Mon Sep 17 00:00:00 2001 From: Wesley Capelari Date: Mon, 14 Oct 2024 08:52:16 -0300 Subject: [PATCH 2/2] =?UTF-8?q?Adicionado=20exporta=C3=A7=C3=A3o=20de=20es?= =?UTF-8?q?trutura=20de=20datasets=20aninhados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DataSet.Serialize.Export.pas | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/DataSet.Serialize.Export.pas b/src/DataSet.Serialize.Export.pas index d69f20d..9904a82 100644 --- a/src/DataSet.Serialize.Export.pas +++ b/src/DataSet.Serialize.Export.pas @@ -517,7 +517,13 @@ function TDataSetSerialize.HasChildModification(const ADataSet: TDataSet): Boole function TDataSetSerialize.SaveStructure: TJSONArray; var LField: TField; + LFields: TJSONArray; LJSONObject: TJSONObject; + LDataSetName: string; + LNestedDataSet: TDataSet; + LDataSetDetails: TList; + LDataSetSerialize: TDataSetSerialize; + LDataSetNameNotDefinedCount: Integer; begin Result := TJSONArray.Create; if FDataSet.FieldCount <= 0 then @@ -559,6 +565,39 @@ function TDataSetSerialize.SaveStructure: TJSONArray; {$ENDIF} Result.{$IF DEFINED(FPC)}Add{$ELSE}AddElement{$ENDIF}(LJSONObject); end; + if FChildRecord then + begin + LDataSetDetails := TList.Create; + try + LDataSetNameNotDefinedCount := 0; + TDataSetSerializeUtils.GetDetailsDatasets(FDataSet, LDataSetDetails); + for LNestedDataSet in LDataSetDetails do + begin + LDataSetSerialize := TDataSetSerialize.Create(LNestedDataSet); + try + if string(LNestedDataSet.Name).Trim.IsEmpty then + begin + Inc(LDataSetNameNotDefinedCount); + LDataSetName := TDataSetSerializeUtils.FormatDataSetName('dataset_name_not_defined_' + LDataSetNameNotDefinedCount.ToString); + end + else + LDataSetName := TDataSetSerializeUtils.FormatDataSetName(LNestedDataSet.Name); + + LFields := LDataSetSerialize.SaveStructure; + LJSONObject := TJSONObject.Create; + LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('name', LDataSetName); + LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('fields', LFields); + LJSONObject.{$IF DEFINED(FPC)}Add{$ELSE}AddPair{$ENDIF}('count', LFields.Count); + + Result.{$IF DEFINED(FPC)}Add{$ELSE}AddElement{$ENDIF}(LJSONObject); + finally + LDataSetSerialize.Free; + end; + end; + finally + LDataSetDetails.Free; + end; + end; end; constructor TDataSetSerialize.Create(const ADataSet: TDataSet; const AOnlyUpdatedRecords: Boolean = False; const AChildRecords: Boolean = True; const AValueRecords: Boolean = True; const AEncodeBase64Blob: Boolean = True);