odbc: bind string parameters as SQL_WLONGVARCHAR only for more than 2000 characters

(cherry picked from commit f57adee862)
This commit is contained in:
Ondrej Pokorny 2022-04-27 16:24:47 +02:00 committed by marcoonthegit
parent 5874dc3cca
commit 6236a5f558

View File

@ -505,10 +505,11 @@ begin
ColumnSize:=Size; //The defined or maximum column size in characters of the column or parameter
BufferLength:=Size;
CType:=SQL_C_WCHAR;
case AParams[ParamIndex].DataType of
ftFixedChar, ftFixedWideChar: SqlType:=SQL_WVARCHAR;
else SqlType:=SQL_WLONGVARCHAR;
end;
if (AParams[ParamIndex].DataType in [ftMemo, ftWideMemo])
or (Length(WideStrVal)>2000) then // long texts (more than 2000 unicode characters) must be bound as SQL_WLONGVARCHAR
SqlType:=SQL_WLONGVARCHAR
else
SqlType:=SQL_WVARCHAR;
end;
ftSingle:
begin