On 1/8/07, Peter Leonard <[EMAIL PROTECTED]> wrote:
> I know that I can add the 'db => $db_ro' parameter to all the get_*()
> methods, but I'm wondering if anyone has come up with a more
> comprehensive solution by subclassing Rose::DB::Object::Manager?
>
> I'm especially curious because it seems like best-practices with
> Rose::DB are to create your own subclass that everything you write
> inherits from, but the tutorials seem to suggest the other direction
> with respect to RDBO.

Where do you get that impression in the tutorial?  I had the opposite
intent (thus the "Setting up your own base class" section).  Although
no custom Rose::DB::Object::Manager-derived vase class is shown in the
tutorial (IIRC), it's definitely something that's allowed and
encouraged for cases where you want to modify the behavior of the
standard methods.

As for your question about RO/RW db handles, I've considered adding
support for named handle types to RDBO.  For example, when the save()
method needs a db, it'd call $self->db(type => 'read') or something
internally, instead of just the $self->db call that it uses now.

But I've always run into the issue of deciding which operations only
require a RO handle and which might need a RW handle.  (Remember that
these db handles are shared with sub-objects and so on.)  Thus far,
I've punted and recommended the explicit solution: you choose what db
to use for each call.  It should be easy to automate whatever
decisions are appropriate for your project, but it's hard to come up
with a system that works for everyone.

-John

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to