[Dbix-class] [DBIx::Class] problems after update of Loader to 03003

Brandon Black blblack at gmail.com
Sat Jul 1 01:32:39 CEST 2006


On 6/30/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> Daniel McBrearty wrote:
> > Thanks. That was it. It is clearly stated in the perldoc, silly me.
> >
> > Maybe the class could emit a slightly better error message though?
> > would a bug report be amiss?
> >
> > But how do I now call on_connect_do?
> >
> > my $mysql = My::Schema->connect( ... );
> > $mysql->storage->on_connect_do(["SET NAMES 'utf8'"]);
> >
> > doesn't cut it, no surprise, as I expect to tell it this before
> > connecting. I tried it in loader options, and as options in the
> > connect call itself, no avail ... ?
>
> $mysql->storage->disconnect;
>
> will disconnect the $dbh so it gets re-connected complete with on_connect_do
> on the next query.
>

[ from earlier in the thread: yes, a better error message is due there... ]

Also, once DBIC 0.07 is out, you can specify on_connect_do as a part
of your connect arguments, which frees from all of this
chicken-and-egg stuff with that.  See the docs for connect_info at:

http://search.cpan.org/~jrobinson/DBIx-Class-0.06999_04/lib/DBIx/Class/Storage/DBI.pm#connect_info

Catalyst::Model::DBIC::Schema forces the same syntax to work for
current release series as well (for
->config->{My::Model}->connect_info), but you can't use it outside of
a Cat model yet until 0.07 is out.

-- Brandon



More information about the Dbix-class mailing list