Page 1 of 1

Assertion failure with a DATE field

Posted: Tue 14 Mar 2006 19:25
by wesson
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.

Posted: Wed 15 Mar 2006 16:21
by Antaeus
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.