On 8/7/06 4:27 PM, "John Siracusa" <[EMAIL PROTECTED]> wrote:

> On 8/7/06 4:14 PM, Sean Davis wrote:
>> This is what I thought of first, but the user of a "mirror" or "local"
>> database will want to set up his/her username/password, hostname, etc.  So,
>> I probably need finer, more flexible control than this; the level of the
>> Rose::DB subclass seems the right level, with users just calling class
>> methods before doing any object instantiation.  Is there a big downside to
>> doing things this way?
> 
> Well, the downside is that you're making changes to the data source registry
> that other code in the same process can see.  Maybe it's better to clone and
> then modify instead of doing modify_db() directly.  IOW:
> 
> 1. Get requested data source of the right type (e.g., "mirror:widgets_db")
> 
> 2. Clone it and register a new user-specific variant of the data source
> under an obscure name (e.g., "temp_johnsmith:mirror:widgets_db")
> 
> 3. Make a new db object pointing to your newly created data source.
> 
> You can skip step 2 if you've already got a clone set up for this
> datasource/user combination, and the "temp" (user-specific) data sources
> disappear once the process ends.  The good thing is that the "protptype"
> data sources (the ones registered in the actual .pm file) never get
> modified.  This avoids any bugs where you might end up with someone else's
> user/pass in your data source.

I see your points.  But perhaps I can even get away without cloning.  It
looks like the best option might be to set up a single data source to the
public data source as a default (which is not meant to be modified).  Then I
can ask end-users who want a different connection to register a new db
connection (or clone the default, if they like) and then update the
Rose::DB->default_type and ->default_domain to reflect the change before
utilizing any RDBO classes.  Since this will always be a single-user
environment (basically a scripting mechanism), there shouldn't be too big a
problem with stepping on each others' connections.  I'll try this solution
and see how it works out.  In simple testing, it looks like it does what I
want with minimal fuss.

Sean


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to