Subject: | DBI::Replication storage fatal error on attempt to connect to master |
When using DBI::Replication storage, a bug in connect_info will cause it
to always fail to connect to the master database for writing as shown below.
Error : DBIx::Class::ResultSet::create(): DBI Connection failed: Can't
connect to data source 'ARRAY(0x983353c)' because I can't work out what
driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the
DBI_DRIVER env var is not set) at
/usr/lib/perl5/site_perl/5.8.5/DBIx/Class/Storage/DBI.pm line 839
-----------------------
Patch :
---
/root/.cpan/build/DBIx-Class-0.08010/lib/DBIx/Class/Storage/DBI/Replication.pm
2007-10-27 18:07:13.000000000 +0100
+++ /usr/lib/perl5/site_perl/5.8.5/DBIx/Class/Storage/DBI/Replication.pm
2008-03-04 09:27:53.000000000 +0000
@@ -89,7 +89,8 @@ sub connect_info {
# We need to copy-pass $global_options, since connect_info clears
it while
# processing options
- $self->write_source->connect_info( [ @{$info->[0]}, {
%$global_options } ] );
+ $self->write_source->connect_info( @{$info->[0]}, {
%$global_options } );
+
@dsns = map { ($_->[3]->{priority} || 10) => $_ }
@{$info}[1..@$info-1];
$global_options->{dsns} = \@dsns;