On 6/30/06, Matt S Trout <[EMAIL PROTECTED]> 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

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to