[Dbix-class] Multiple connections

Dave Howorth dhoworth at mrc-lmb.cam.ac.uk
Thu Jan 16 16:44:14 GMT 2014


Lianna Eeftinck wrote:
> Afaik, 'mysql_enable_utf8 => 1' (and there are similar options for
> Postgress and SQLite at least) just tells the mysql driver that if a column
> is marked as having a UTF8 charset in the table, it'll try to return the
> data as such. If your column has a different character set the option won't
> do much, nor would it be active if your data isn't marked UTF8 or not
> inserted as UTF8 properly.

The option changes the mysql connection protocol. When I try to retrieve
the so-called latin1 data using a utf8 connection, I get:

DBIx::Class::ResultSet::find(): DBI Exception: DBD::mysql::st execute
failed: COLLATION 'latin1_general_ci' is not valid for CHARACTER SET 'utf8'

If you know how to avoid that, I'd be very happy to learn.

> You certainly don't need two database handles to solve this problem. The
> difficulty lies in making sure you're converting the right character data
> to the right character data, no matter where you do this (you can do it in
> the database itself just as well). Two database handles won't make that bit
> any easier.

You'd have to back that assertion up with some detail (working code, for
example) for me to believe it :)

I think I already mentioned that the database is read-only.



More information about the DBIx-Class mailing list