[Melbourne-pm] Perl DBI reference recommendations

Toby Corkindale toby.corkindale at strategicdata.com.au
Thu Jul 16 17:52:52 PDT 2009


Tim Evans wrote:
> I would add to sam's list ...
> 
>         $dbh->{mysql_enable_utf8} or die "couldn't init mysql_enable_utf8";

I think you mean "$dbh->{mysql_enable_utf8} = 1;" here? Since it's off 
by default, wouldn't you always die?

Note that you should preferably set it in the connect options, rather 
than afterwards though. I think you can then avoid having to call the 
other SET.. commands  you listed afterwards. (But please test that 
before changing any production systems on my word! ;)


If you're using PostgreSQL, then you should be using the pg_enable_utf8 
option, of course.
New versions of DBD::Pg enable pg_server_prepare by default, but on 
older versions you might want to enable it yourself.
(Improves performance through precompiled/cached server-side prepared 
statements)

-Toby


More information about the Melbourne-pm mailing list