From c99ddf91b3e7d0a46688a51076723ca1f15d956e Mon Sep 17 00:00:00 2001 From: Roland Bengtsson Date: Sat, 7 Dec 2024 22:39:04 +0200 Subject: [PATCH] Changed TBoldPMString.ValueToParam We already had a workaround to avoid truncation of strings with size >= 8000. But in case we are using Unicode, we need to check for 4000 chars, because when using Unicode each char requires twice as much space #26 --- Source/BoldPMappersAttributeDefault.pas | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/BoldPMappersAttributeDefault.pas b/Source/BoldPMappersAttributeDefault.pas index e1100fc..dd1e992 100644 --- a/Source/BoldPMappersAttributeDefault.pas +++ b/Source/BoldPMappersAttributeDefault.pas @@ -425,6 +425,14 @@ function TBoldPMString.CompareField(const ObjectContent: IBoldObjectContents; co procedure TBoldPMString.ValueToParam(const ObjectContent: IBoldObjectContents; const Param: IBoldParameter; ColumnIndex: Integer; TranslationList: TBoldIdTranslationList); +const +{$IFDEF BOLD_UNICODE} + // check for 4000 chars, because since using unicode + // each char requires twice as much space + cnMaxMSSQLStringLength = 4000; +{$ELSE} + cnMaxMSSQLStringLength = 8000; +{$ENDIF} var aString: IBoldStringContent; begin @@ -435,7 +443,7 @@ procedure TBoldPMString.ValueToParam(const ObjectContent: IBoldObjectContents; c else begin // the setting of Param DataType is a workaround for UniDAC MSSQL param trim to 8000 bug. - if Length(aString.AsString) >= 8000 then + if Length(aString.AsString) >= cnMaxMSSQLStringLength then Param.DataType := GetColumnBDEFieldType(0); Param.AsString := aString.AsString; end;