On 8/7/06 3:40 PM, Sean Davis wrote:
> On 8/7/06 1:31 PM, "Sean Davis" <[EMAIL PROTECTED]> wrote:
>> I am trying to write some code to access a publicly available data source.
>> It consists of a few dozen different databases (mysql), all with the same
>> table structure, pretty much.  I would also like to allow users to query a
>> local mirror of the data source, as well.  Therefore, I would like to make a
>> set of classes that can be "used" to do so, supplying the connection
>> parameters on-the-fly.  I don't see an easy way to supply the variable
>> database connection information to a "default" Rose::DB class.  Is this
>> possible?  If so, can someone give me a little hint?
> 
> I can use ->modify_db, it looks like.  Sorry for the chatter.

Also consider making multiple sets of data sources, either using the
"domain" Rose::DB data source attribute ("local", "mirror", "main") or
perhaps prefixing the "type" attribute  with "local:", "mirror:", or "main:"

Then all you have to do in the classes to get the right db is pick the right
arguments in the init_db method.  Here's an example using just the "type":

    package My::DB::Whatever;
    ...
    sub init_db
    {
      my $type = <figure out correct db type for this class>
      return My::DB->new($type);
    }

The "figure out correct db type for this class" can perhaps look at the
class name and see if it has "::Mirror::" in it or whatever.

-John



-------------------------------------------------------------------------
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