Swedish Collation used on Cast

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
John Bell
Posts: 17
Joined: Mon 25 Sep 2006 17:38

Swedish Collation used on Cast

Post by John Bell » Sat 12 Jul 2014 14:37

if I run the following in HeidiSQL, I get the collation for CFC is (blank) which I assume refers to the default collation for the database of utf8_general_ci. If I run it with TMyQuery, the default collation is latin1_swedish_ci. Is there a setting I am missing for this or is MyDAC doing something odd? I am running XE3 and version 8.3.8 for RAD Studio XE3. I am running MySQL 5.5.27.

drop table if exists _answer;
create table _answer
select distinct d.id, cast("" as char(1)) as CFC from donmail d
where d.id <280

John Bell
Posts: 17
Joined: Mon 25 Sep 2006 17:38

Re: Swedish Collation used on Cast

Post by John Bell » Sat 12 Jul 2014 18:03

ok, I found that you need to set Charset in the TMyConnection component. I guess it defaults to Swedish if left blank even though I had the default set in MySQL to utf8.

PavloP
Devart Team
Posts: 149
Joined: Fri 24 Jan 2014 12:33

Re: Swedish Collation used on Cast

Post by PavloP » Mon 14 Jul 2014 14:49

It is good to see that the problem has been solved.
The default collation for MySQL is latin1_swedish_ci. If you don't set the TMyConnection.Options.Charset property, then when creating a char or varchar field, the latin1_swedish_ci collation is used by default.
More details about the default collation for MySQL can be found at http://dev.mysql.com/doc/refman/5.6/en/ ... mysql.html

Post Reply