From 030c65ec382ee96d642b75d9c3c766e215f4b432 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 23 Dec 2019 14:04:40 +0000 Subject: [PATCH] * Fixed merge conflicts git-svn-id: branches/fixes_3_2@43757 - --- packages/fcl-db/src/export/fpdbexport.pp | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/fcl-db/src/export/fpdbexport.pp b/packages/fcl-db/src/export/fpdbexport.pp index 5d792f2afe..db515c7292 100644 --- a/packages/fcl-db/src/export/fpdbexport.pp +++ b/packages/fcl-db/src/export/fpdbexport.pp @@ -69,12 +69,14 @@ Type FCurrencySymbol : String; FDateFormat : String; FIntegerFormat: String; + FHandleNullField: Boolean; FTimeFormat : String; FDateTimeFormat : String; FDecimalSeparator: Char; FUseDisplayText : Boolean; Protected Procedure InitSettings; virtual; + Property HandleNullField : Boolean Read FHandleNullField Write FHandleNullField; Property UseDisplayText : Boolean Read FUseDisplayText Write FUseDisplayText; Property IntegerFormat : String Read FIntegerFormat Write FIntegerFormat; Property DecimalSeparator : Char Read FDecimalSeparator Write FDecimalSeparator; @@ -295,6 +297,7 @@ Procedure UnRegisterExportFormat(Const AName : String); Const StringFieldTypes = [ftString,ftFixedChar,ftWidestring,ftFixedWideChar]; IntFieldTypes = [ftInteger,ftWord,ftSmallint,ftAutoinc]; + FloatFieldTypes = [ftFloat, ftCurrency, ftFMTBcd, ftBCD]; OrdFieldTypes = IntFieldTypes +[ftBoolean,ftLargeInt]; DateFieldTypes = [ftDate,ftTime,ftDateTime,ftTimeStamp]; MemoFieldTypes = [ftMemo,ftFmtMemo,ftWideMemo]; @@ -587,9 +590,11 @@ Var FS : TFormatSettings; begin + if F.IsNull and FormatSettings.HandleNullField then + Exit(''); If (F.DataType in IntFieldTypes) then begin - If (FormatSettings.IntegerFormat)<>'' then + If ((FormatSettings.IntegerFormat)<>'') and (not F.IsNull) then Result:=Format(FormatSettings.IntegerFormat,[F.AsInteger]) else if FormatSettings.UseDisplayText then Result:=F.DisplayText @@ -598,10 +603,11 @@ begin end else if (F.DataType=ftBoolean) then begin - If F.AsBoolean then - Result:=FormatSettings.BooleanTrue - else - Result:=FormatSettings.BooleanFalse; + if (Not F.IsNull) then + If F.AsBoolean then + Result:=FormatSettings.BooleanTrue + else + Result:=FormatSettings.BooleanFalse; If (Result='') then if FormatSettings.UseDisplayText then Result:=F.DisplayText @@ -610,7 +616,7 @@ begin end else if (F.DataType=ftDate) then begin - If (FormatSettings.DateFormat<>'') then + If (FormatSettings.DateFormat<>'') and (not F.IsNull) then Result:=FormatDateTime(FormatSettings.DateFormat,F.AsDateTime) else if FormatSettings.UseDisplayText then Result:=F.DisplayText @@ -619,7 +625,7 @@ begin end else if (F.DataType=ftTime) then begin - If (FormatSettings.TimeFormat<>'') then + If (FormatSettings.TimeFormat<>'') and (not F.IsNull) then Result:=FormatDateTime(FormatSettings.TimeFormat,F.AsDateTime) else if FormatSettings.UseDisplayText then Result:=F.DisplayText @@ -628,7 +634,7 @@ begin end else if (F.DataType in [ftDateTime,ftTimeStamp]) then begin - If (FormatSettings.DateTimeFormat<>'') then + If (FormatSettings.DateTimeFormat<>'') and (not F.IsNull) then Result:=FormatDateTime(FormatSettings.DateTimeFormat,F.AsDateTime) else if FormatSettings.UseDisplayText then Result:=F.DisplayText @@ -637,13 +643,13 @@ begin end else if (F.DataType=ftCurrency) then begin - If (FormatSettings.CurrencySymbol<>'') then + If (FormatSettings.CurrencySymbol<>'') and (not F.IsNull) then begin FS:=DefaultFormatSettings; FS.CurrencyString:=FormatSettings.CurrencySymbol; Result:=CurrToStrF(F.AsCurrency,ffCurrency,FormatSettings.CurrencyDigits,FS); end - else if FormatSettings.UseDisplayText then + else if FormatSettings.UseDisplayText then Result:=F.DisplayText else Result:=F.AsUTF8String; @@ -839,6 +845,7 @@ end; procedure TCustomExportFormatSettings.InitSettings; begin FIntegerFormat:='%d'; + FHandleNullField:=True; FDateFormat:=ShortDateFormat; FTimeFormat:=ShortTimeFormat; FDateTimeFormat:=ShortDateFormat+' '+ShortTimeFormat; @@ -863,6 +870,7 @@ begin If (Source is TCustomExportFormatSettings) then begin FS:=Source as TCustomExportFormatSettings; + FHandleNullField:=FS.FHandleNullField; FBooleanFalse:=FS.FBooleanFalse; FBooleanTrue:=FS.FBooleanTrue; FCurrencyDigits:=FS.FCurrencyDigits;