'00'-terminated strings in MemoFields

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for MySQL in Delphi and C++Builder
Post Reply
tripunkt
Posts: 13
Joined: Wed 06 Jun 2007 11:33

'00'-terminated strings in MemoFields

Post by tripunkt » Tue 20 Nov 2007 17:50

Hello CoreLab-Team,

after updating to the latest dbexpress-driver, tmemo-fields have a '00' value at the end of an updated or inserted memo-value (mysql-type 'TEXT'). So If I search in this memo with a statement like "... where field Like '%.exe' "
the query-result is empty. If i remove this trailing '00' with a database-tool the sql-statement works fine again. Any fast help is highly appreciated.

best regard
sebastian

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 21 Nov 2007 10:13

This question should be addressed to MySQL AB, as the comparison of field values with the patterns given in your query is performed at the server.
You can reproduce this behaviour with the standard MySQL client application (mysql.exe).

tripunkt
Posts: 13
Joined: Wed 06 Jun 2007 11:33

Post by tripunkt » Wed 21 Nov 2007 11:32

Hi Antaeus,

thank you for your fast reply. Yes, the statement is executed at the server's side. How the query performs with a trailing '00' at the end of the fieldvalue is not the problem. The problem is that there is a trailing '00' appended to each memo-string when you update a field. The command line-tool mysql.exe does not do that. (I am refering to mysql 5.0.45 community-nt on windows or 5.0.38-Ubuntu_0ubuntu1.1; its the same behaviour on both)
If i execute a statement like "UPDATE Table SET strDescription = 'teststring' " when Field 'strDescription' is of type 'TEXT' i do not have a trailing '00 neither at windows-mysql nor linux-mysql.

But if i call ApplyUpdates on a clientdataset (using latest CoreLabs dbExpress-Drivers to access a linux or windows-mysql) that maps the column 'strDescription' to a TMemoField and assign TMemoField.Value := 'teststring' i do have a trailing '00' at the updated value. It really looks like a C-string-issue and someone forgot to write len-1 instead of len into the buffer.

Thanks for your help,
with regards
sebastian

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 21 Nov 2007 14:56

I could not reproduce the problem. Please provide table definition and Delphi code to demonstrate it.

Also supply me the following information:
- exact version of DbxMda;
- exact version of your IDE;
- exact version of MySQL server and MySQL client.

tripunkt
Posts: 13
Joined: Wed 06 Jun 2007 11:33

Post by tripunkt » Thu 22 Nov 2007 08:35

Hello Anaeus,

i checked the Delphi 2007-Version and updated delphi to the latest update Pack 3. (v 11.0.2804.9245). The problem seems to be gone now. It was probably a bug within dbx4. Thanks for your time.

with regards,
Sebastian

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 22 Nov 2007 10:03

It is likely. I also used Delphi 2007 with the third Update Pack when trying to reproduce the problem.
Thank you for this information.

Post Reply