Trimmed string param bug

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Romano
Posts: 42
Joined: Tue 10 Feb 2009 11:21

Trimmed string param bug

Post by Romano » Thu 15 Apr 2021 08:07

Hi,

SDAC 9.4.3
Bug a string parameter getting trimmed is fixed

Can you describe some scenario of this bug please? I need to know how it can affect our customers.

Thanks
Roman

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: Trimmed string param bug

Post by Stellar » Thu 15 Jul 2021 12:05

Hi Roman,

The loss of the string value part occurred when storing a Unicode string in a VARCHAR field in the database, for instance:

Code: Select all

CREATE TABLE T1 ( 
    [fid] [int] NOT NULL, 
    [fname] [varchar](50) NULL) 
 

Code: Select all

MSQuery1.SQL.Text := 'INSERT INTO t1 ( fid, fname ) VALUES ( :fid, :fname )' ; 
MSQuery1.Params[0].ParamType := ptInput; 
MSQuery1.Params[0].DataType := ftInteger; 
MSQuery1.Params[1].ParamType := ptInput; 
MSQuery1.Params[1].dataType := ftWideString; 

MSQuery1.Prepare; 
MSQuery1.Params[0].AsInteger := 1; 
MSQuery1.Params[1].AsWideString := '121222'; 
MSQuery1.Execute; 
Regards,
Sergey

Post Reply