Skip to content

Commit c99ddf9

Browse files
committed
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
1 parent 4479dbc commit c99ddf9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Source/BoldPMappersAttributeDefault.pas

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,14 @@ function TBoldPMString.CompareField(const ObjectContent: IBoldObjectContents; co
425425

426426

427427
procedure TBoldPMString.ValueToParam(const ObjectContent: IBoldObjectContents; const Param: IBoldParameter; ColumnIndex: Integer; TranslationList: TBoldIdTranslationList);
428+
const
429+
{$IFDEF BOLD_UNICODE}
430+
// check for 4000 chars, because since using unicode
431+
// each char requires twice as much space
432+
cnMaxMSSQLStringLength = 4000;
433+
{$ELSE}
434+
cnMaxMSSQLStringLength = 8000;
435+
{$ENDIF}
428436
var
429437
aString: IBoldStringContent;
430438
begin
@@ -435,7 +443,7 @@ procedure TBoldPMString.ValueToParam(const ObjectContent: IBoldObjectContents; c
435443
else
436444
begin
437445
// the setting of Param DataType is a workaround for UniDAC MSSQL param trim to 8000 bug.
438-
if Length(aString.AsString) >= 8000 then
446+
if Length(aString.AsString) >= cnMaxMSSQLStringLength then
439447
Param.DataType := GetColumnBDEFieldType(0);
440448
Param.AsString := aString.AsString;
441449
end;

0 commit comments

Comments
 (0)