[Maypole] Passing dbh attributes on setup
Roland Moriz
roland@moriz.de
Wed, 09 Jun 2004 23:30:26 +0200
Hello Gaal,
Am Mi, den 09.06.2004 schrieb Gaal Yahas um 23:03:
> I need to pass initialization information to my database handle[1].
>
> But I couldn't figure out how! This doesn't work:
>
> __PACKAGE__->setup($dsn, $user, $password, { mysql_enable_utf8=>1 });
>
> Naive, perhaps, to assume that it should, but the flow in Maypole::setup
> as a little too confusing for me :-(
not sure if this works but have you tried to set the attribut within
$dsn as described in the DBI pod?
http://search.cpan.org/~timb/DBI-1.42/DBI.pm
-------
"The \%attr parameter can be used to alter the default settings of
PrintError, RaiseError, AutoCommit, and other attributes. For example:
$dbh = DBI->connect($data_source, $user, $pass, {
PrintError => 0,
AutoCommit => 0
});
The username and password can also be specified using the attributes
Username and Password, in which case they take precedence over the
$username and $password parameters.
You can also define connection attribute values within the $data_source
parameter. For example:
dbi:DriverName(PrintWarn=>1,PrintError=>0,Taint=>1):...
Individual attributes values specified in this way take precedence over
any conflicting values specified via the \%attr parameter to connect."
-------
Also, Simon maybe wants to extend Maypole::Model::CDBI::setup_database()
to allow extra arguments (as far as i can see Class::DBI::Loader
supports that) in a future release of Maypole...
hth,
with kind regards,
Mit freundlichen Gruessen,
Roland Moriz
--
Muenchen/Germany - http://www.roland-moriz.de/