Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 33794
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: TEEJAY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.08010
Fixed in: (no value)



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;
On Tue Mar 04 04:34:27 2008, TEEJAY wrote: Show quoted text
> 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.
Also always fails to connect to slave database for reading. New patch below --- /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 17:20:23.000000000 +0000 @@ -89,9 +89,9 @@ 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]; + @dsns = map { ($_->[3]->{priority} || 10) => $_ } @{$info->[0]}[1..@{$info->[0]}-1]; $global_options->{dsns} = \@dsns; $self->read_source->connect_info( [ 'dbi:Multi:', undef, undef, { %$global_options } ] );
Closed on the grounds that I'm pretty sure you already fixed this yourself. Yay for new committers.