Skip Menu |

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

Report information
The Basics
Id: 24204
Status: new
Priority: 0/
Queue: Class-DBI-Replication

People
Owner: Nobody in particular
Requestors: mt [...] nta-monitor.com
Cc:
AdminCc:

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



Subject: slave db connections not being used
Date: Wed, 03 Jan 2007 16:59:51 +0000
To: bug-Class-DBI-Replication [...] rt.cpan.org
From: Mark Terry <mt [...] nta-monitor.com>
When using the set_slave() method as follows: __PACKAGE__->set_master("dbi:Pg:dbname=$name;host=$masterHost", $masterUser, $masterPass); __PACKAGE__->set_slaves( ["dbi:Pg:dbname=$name;host=$slaveHost", $slaveUser, $slavePass] ); The slave connection is not being used. I think this is due to the naming of the Class::DBI database connections. At present slave connections are named "Slaves" not "Slaves_0" "Slaves_1" etc.. I have attached a patch for Replication.pm to fix this -- Mark Terry Research and Development NTA Monitor Ltd
--- Replication.pm 2001-07-02 05:49:22.000000000 +0100 +++ /tmp/Replication.pm 2007-01-03 16:49:28.000000000 +0000 @@ -37,6 +37,11 @@ my $howmany = $class->__Slaves; $class->SUPER::set_db("Slaves_" . ++$howmany, @{$slave}); + + __PACKAGE__->set_sql('GetMe', "SELECT %s FROM %s WHERE %s = ?", 'Slaves_' . $howmany); + __PACKAGE__->set_sql('Search', "SELECT %s FROM %s WHERE %s = ?", 'Slaves_' . $howmany); + __PACKAGE__->set_sql('SearchLike', "SELECT %s FROM %s WHERE %s LIKE ?", 'Slaves_' . $howmany); + $class->__Slaves($howmany); } @@ -102,20 +107,6 @@ # Below is what I have to deal with. # Other ones should be gone to Master, thus no cnange is required. -__PACKAGE__->set_sql('GetMe', <<"", 'Slaves'); -SELECT %s -FROM %s -WHERE %s = ? - -__PACKAGE__->set_sql('Search', <<"", 'Slaves'); -SELECT %s -FROM %s -WHERE %s = ? - -__PACKAGE__->set_sql('SearchLike', <<"", 'Slaves'); -SELECT %s -FROM %s -WHERE %s LIKE ? 1; __END__