Page 1 of 1

'00'-terminated strings in MemoFields

Posted: Tue 20 Nov 2007 17:50
by tripunkt
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

Posted: Wed 21 Nov 2007 10:13
by Antaeus
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).

Posted: Wed 21 Nov 2007 11:32
by tripunkt
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

Posted: Wed 21 Nov 2007 14:56
by Antaeus
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.

Posted: Thu 22 Nov 2007 08:35
by tripunkt
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

Posted: Thu 22 Nov 2007 10:03
by Antaeus
It is likely. I also used Delphi 2007 with the third Update Pack when trying to reproduce the problem.
Thank you for this information.