Result + 1 >= MaxDestBytes, Result = 4, MaxDestBytes = 4

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Result + 1 >= MaxDestBytes, Result = 4, MaxDestBytes = 4

Post by ben » Tue 21 Mar 2006 15:52

Result + 1 >= MaxDestBytes, Result = 4, MaxDestBytes = 4

any idea about this error?

when I set UseUnicode to true I got this message to one of my queries.

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Tue 21 Mar 2006 15:53

in MyClasses.pas line 3570

and I use the latest version. downloaded today

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

Post by Antaeus » Tue 21 Mar 2006 16:11

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.

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Tue 21 Mar 2006 16:20

why MySQLFront, Navicat and phpAdmin return correct result? Only MyDAC complains about that. I also never hear about such bug in MySQL.

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

Post by Antaeus » Wed 22 Mar 2006 13:53

MyDAC allocates for data as much memory as MySQL server reports. This helps our components work quickly. But when unicode is used, MySQL server returns wrong field length for the fields that are the result of conversion functions. For example, DATE_FORMAT.

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Wed 22 Mar 2006 14:52

until mysql fix this problem can you please add a small property

IgnoreReturnLength or something similar?

also I would like to point me a URL that shows that mysql bug, from mysql.com site.

Can you provide us a solution or we have to make a research for another DAC component? We just CANT work with it.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 23 Mar 2006 10:04

This bug concerns only MySQL 4.1 and 5.0 and does not concerns MySQL 4.0. As we can see (http://bugs.mysql.com/bug.php?id=16678), it will be fixed in nearest time by MySQL AB.

Also, we will try to avoid this problem in nearest MyDAC build.

As temporary solution you can use something like this:

Code: Select all

'SELECT DATE_FORMAT(''2006-01-01'',''%m %Y'                              ')'
instead of

Code: Select all

'SELECT DATE_FORMAT(''2006-01-01'',''%m %Y'')'

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Thu 23 Mar 2006 11:19

my query is

Code: Select all

select * from (select                                                                                                           
   prepay_offers.*, date_format(now(), '%H:%i') as timenow,                                                                     
   case                                                                                                                         
      when offertype = 'NORMAL' then                                                                                            
         cast(concat(prepay_offers.description, ' (' , format(prepay_offers.price, 2), ' +', format(prepay_offers.a_price, 2), ')') as char(64))
      when offertype ='RANGE' then                                                                                
         cast(concat(prepay_offers.description, ' ', format(prepay_offers.price, 2), ' (', fromtime, '-', totime, ')') as char(64))
   end as description1
from
   prepay_offers
order by
   prepay_offers.position asc) as inlinequery
where
   (offertype = 'NORMAL')
   or ((offertype = 'RANGE') and (timenow >= fromtime and timenow <= totime))
what can I do as temporary solution?
i use v5.0 or 4.1 cause I have subqueries, I cant use 4 !

Thanks

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Thu 23 Mar 2006 11:27

ok i fixed the date_format with your tip and it works.
i can also set active to TRUE while design mode with no problems.

but during runtime i receive the error:

illegal mix of collations for operation 'concat'

all my tables, fields are utf8, i double checked it.

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Thu 23 Mar 2006 11:41

ok I fixed everything, and wait until 5.0.20 for the final fix.

thanks Ikar, you were addressful and helpful!

Post Reply