From 6f215e6f9c6edc76bc06cc1e901556aee8c47256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Duarte?= Date: Wed, 17 Apr 2019 11:47:07 -0300 Subject: [PATCH] Fixed bug when serializing dataset. When the first dataset record has a field that is null, it would serialize all records in this field to null, even if the next records have data --- sources/MVCFramework.Serializer.JsonDataObjects.pas | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sources/MVCFramework.Serializer.JsonDataObjects.pas b/sources/MVCFramework.Serializer.JsonDataObjects.pas index e9db7b16..20f59f9f 100644 --- a/sources/MVCFramework.Serializer.JsonDataObjects.pas +++ b/sources/MVCFramework.Serializer.JsonDataObjects.pas @@ -50,10 +50,9 @@ uses type TMVCDataSetField = record - FieldName: String; + FieldName: string; DataType: TFieldType; I: Integer; - IsNull: Boolean; end; TMVCDataSetFields = TList; @@ -377,7 +376,7 @@ begin for lField in ADataSetFields do begin begin - if lField.IsNull then + if ADataSet.Fields[lField.I].IsNull then AJsonObject[lField.FieldName] := Null else begin @@ -1315,7 +1314,6 @@ begin ADataSet.Fields[I].FieldName); lField.DataType := ADataSet.Fields[I].DataType; lField.I := I; - lField.IsNull := ADataSet.Fields[I].IsNull; case ANameCase of ncUpperCase: lField.FieldName := UpperCase(ADataSet.Fields[I].FieldName);