Skip to content

Commit

Permalink
Changed TBoldPMString.ValueToParam
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bero committed Dec 7, 2024
1 parent 4479dbc commit c99ddf9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/BoldPMappersAttributeDefault.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit c99ddf9

Please sign in to comment.