Azure, String parameter in TUniQuery lose line feed character

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

Azure, String parameter in TUniQuery lose line feed character

Post by StefanDWC » Wed 07 Jun 2017 11:56

Hello, i have a simple insert into statement which add a new record to a table.
Like :

Code: Select all

WorkerQuery.SQL.Text :=
    'INSERT INTO Activities (Duration, Text) VALUES (:Duration, :Text)';
WorkerQuery.ParamByName('Duration').AsInteger := 1;
WorkerQuery.ParamByName('Text').AsString := 'First line of text'+#13+'Second line of text';
WorkerQuery.ExecSQL;
However, if i read the Text column later via a SQL statement, get i one line of text only instead of the expected two lines. The #13 character is not more there.
if i use a TUniTable and a grid component to enter a multi line text, then work it as expected.

It seems that the #13 character will be removed before or while sending the script. If this is true, why?

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Azure, String parameter in TUniQuery lose line feed character

Post by azyk » Thu 08 Jun 2017 08:06

To solve the problem, use the sLineBreak constant instead of #13 . More details about it in Embarcadero documentation:
http://docs.embarcadero.com/products/ra ... Break.html

StefanDWC
Posts: 24
Joined: Mon 22 May 2017 08:42

Re: Azure, String parameter in TUniQuery lose line feed character

Post by StefanDWC » Thu 08 Jun 2017 08:55

Thanks for you reply, Azyk.
My use of character #13 was only an example. Strings can be build from 256 differend character (#0..#255).
Every combination, including #0, should be possible in Delphi since the String data type have it's own field for the length.

However, the problem seems solved. I used another way to display the string data and all character was there, including #0.

Thanks.

Post Reply