On 12/4/05 4:36 PM, Michael Alan Dorman wrote: > The one thing that I can easily do with my existing bits of manual SQL > construction and handle management is split requests between a master > and slave server---sending modifications to the master, and pulling > data from the slave.
Did you ask about this before, or was it someone else? When it was asked earlier, I had a simple answer which I now seem to have forgotten... :) > I was wondering if, somewhere down in the twisty little passages of > the Rose::DB framework, there was some reasonably straightforward way > to achieve this with RDBO? Right now, the best I can come up with is this. * Override save() in your RDBO-derived base class upon which all your other db classes are based. (You do have one, right? The tutorial demands it! ;) * In your overridden version of save(), pull out the db() and swap it if appropriate. For example, make a "master" db type and a "slave" db type. Then do something like this: sub save { my $self = shift; my $db = $self->db; if($db->type ne 'master') { $self->db(My::DB->new('master')); } # XXX: also propagate the new $db to all the sub-objects here $self->SUPER::save(@_); } * Finally, make all your db classes init with the slave: sub init_db { My::DB->new('slave') } This is all totally untested and by the seat of my pants, BTW. I can imagine a new feature or RDBO subclass that formalizes this, but I'd like it to be generic. I'm not sure how that'd look. Maybe a mapping of actions to dbs? Like save() in foo db, load() from bar db, maybe even insert() in blah db, update() in blag db. Suggestions welcome :) -John ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object