Re: [CDBI] pass in database name from application

[prev] [thread] [next] [Date index for 2005/10/10]

From: William Ross
Subject: Re: [CDBI] pass in database name from application
Date: 09:35 on 10 Oct 2005
On 10 Oct 2005, at 10:09, Steven Mackenzie wrote:

> I think Class::DBI::Factory is the solution to that problem. I'm  
> looking
> at using it soon, but haven't yet ...
>
> http://search.cpan.org/~wross/Class-DBI-Factory-0.994/lib/Class/DBI/ 
> Factory.pm

It's a good answer, though not the only one. But if you haven't used  
it yet I'd hold off for a day or two: there's a much improved version  
about to go up once the tests are up to date. I might even label it  
version 1, or maybe 3 :)

The standard approach to the many-databases question, and one of the  
main things that CDF does for you, is to omit the connection(...)  
call and supply your own database handles from a db_Main method in  
your base class.

The only thing you have to watch out for is that the handles returned  
by your method are of the same kind as the ones that cdbi normally  
uses. Ed has listed the requirements here:

http://lists.digitalcraftsmen.net/pipermail/classdbi/2005-August/ 
000061.html

and there are lots of other messages in the list archive about this  
topic...

best

will





>
>
>
> Thomas Kwan (eTechfocus) wrote:
>
>> Hello there,
>>
>> Is there anyone knows how to make a Class::DBI object
>> reuseable with multiple databases within the same
>> process?
>>
>> For example, I want to build a User class that extends
>> Class::DBI. Then, I want to read a User object from
>> database A and a User object from database B, using
>> the same User class ideally. Then, I want to compare
>> them.
>>
>> How can I build reuseable DBI object API without hardcoding
>> the database name, user id, password, table name in
>> the class?
>>
>> thanks
>>
>>
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> _______________________________________________
>> ClassDBI mailing list
>> ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
>> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>>
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

[CDBI] pass in database name from application
Thomas Kwan \(eTechfocus\) 04:15 on 10 Oct 2005

Re: [CDBI] pass in database name from application
Steven Mackenzie 09:09 on 10 Oct 2005

Re: [CDBI] pass in database name from application
William Ross 09:35 on 10 Oct 2005

[CDBI] Re: pass in database name from application
Edward J. Sabol 19:36 on 10 Oct 2005

Re: [CDBI] Re: pass in database name from application
Christopher H. Laco 19:44 on 10 Oct 2005

Generated at 15:14 on 14 Oct 2005 by mariachi v0.52