I
I
Ilya T.2020-10-27 08:51:51
MySQL
Ilya T., 2020-10-27 08:51:51

Why does Lazarus truncate the string while reading?

I am writing logs to MySQL database. I'm trying to read them from Lazarus. Faced with the fact that Lazarus cuts some lines.
It looks like this:
e6ec8ff8.png

In fact, the database looks like this:
af50d0dd.png

Lazarus 2.0.10. Components from the standard library. The type of the problematic field in the text database (tried varchar - did not help). Clipping occurs in TSQLQuery or earlier (not in render components). Those. if you execute a query in the query editor, it will be displayed already truncated. DBMS - was originally MariaDB, but switching to MySQL 5.7 did not solve the problem.

In mysqldump the line looks like this:

'2020-10-26T21:06:41.142Z\011INFO\011piecestore\011upload started\011{\"Piece ID\": \"AXM2YT6GJVAPK6JHWW7SJT4K34IFS3TONWQNO2TUXR7X36FR23CA\", \"Satellite ID\": \"12EayRS2V1kEsWESU9QMRseFhdxYxKicsiFmxrsLZHeLUtdps3S\", \"Action\": \"PUT\", \"Available Space\": 478335599584}',8,'2020-10-27 00:07:54'


Those. it apparently considers \0 the end of the line. The question is how to get around this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Tsvetkov, 2020-10-27
@tsklab

apparently \0 considers the end of the line
The BINARY and VARBINARY Types .

I
Ilya T., 2020-10-29
@Insaned

Finally did so. I'm not sure if this is a good solution, but I didn't come up with anything.
On the server side:

delimiter |
create trigger replace_data
before insert on logs
for each row
begin
SET NEW.msg = replace(NEW.msg,'\011',' ');
end;
|
delimiter ;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question