Assertion failure with a DATE field

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
wesson

Assertion failure with a DATE field

Post by wesson » Tue 14 Mar 2006 19:25

I'm a registered user and I use registered version of MyDAC, latest version.

Drop on a form a TMyConnection with Options.UseUnicode set to TRUE and Charset set to UTF-8

Then drop a TMyQuery

in runtime, set the following SQL command on a table that contains a DATETIME datefield and is not empty:

MyQuery.SQL.Text := 'SELECT DATE(datefield) as aDay, COUNT(*) as aCount FROM some_table GROUP BY aDay;';

then MyQuery.Execute() and BANG, the following assertion failure :

"Result + 1 >= MaxDestBytes, Result = 14, MaxDestBytes = 14 (D:\Projects\Delphi\Mydac\Source\MyClasses.pas, line 3475)"

Exactly the same request with the TMyConnection.Options.UseUnicode set to FALSE execute without problem and without assertion.

With the stack trace, It seems it's something related to the conversion of the DATE field into a WideString. transcoding from UTF-8 to unicode is something that changes the number of characters of the string, could it be the cause of the problem.

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

Post by Antaeus » Wed 15 Mar 2006 16:21

This is MySQL Server bug. It's related to using property UseUnicode=True. Server returns wrong field length in this mode. Unfortunately we can't fix this bug. Please see this topic.

Post Reply