Re: Utterly confused about set_db and db_Main

[prev] [thread] [next] [Date index for 2004/04/28]

From: Vince Veselosky
Subject: Re: Utterly confused about set_db and db_Main
Date: 20:08 on 28 Apr 2004
Just FYI, the solution you proposed works well for me using CDBI 0.95=20
and Ima::DBI 0.32. If downgrading is an option for you, it might get you =

going faster.

Cheers,
Vince
http://control-escape.com

Alexander Gr=E4fe wrote:

>Up until now, I loved working with Class::DBI, it has cut down
>development time considerably.
>But now, I have hit a snag.
>The previous projects all had one hardcoded set_db, because they were
>complete packages. But now, I am trying to built a blogging software
>based on Class::DBI and HTML::Mason. And since the CDBI classes for
>different blogs differ only in the database used, I am looking for a way=

>to set the DSN, username and password in httpd.conf via PerlSetEnv, so I=

>don't have to copy and edit the whole class stuff for each blog.
>
>I've read the CDBI POD, as well as the mailing list, and so far, the
>solution is not in sight.
>I've tried removing the set_db from my base class und putting in:
>sub db_Main
>{
>	Ima::DBI->connect_cached(@conn_info);
>}
>as was suggested here:
>http://groups.kasei.com/mail/arc/cdbi-talk/2004-03/msg00037.html
>
>I only got an error, that Ima::DBI has no method "connect_cached".
>(Ima::DBI version: 0.33)
>
>
>Another suggestion was to call set_db (and set_up_table, if using
>CDB::mysql) at runtime, instead of setting it in the base class:
>http://groups.kasei.com/mail/arc/cdbi-talk/2004-04/msg00002.html
>
>With the latest 0.96 release candidate of CDBI, I get this compilation
>error:
>has_a needs a valid column at
>/usr/lib/perl5/site_perl/5.8.0/Class/DBI/Relationship/HasA.pm line 12
>
>This error does NOT appear, if I use set_db in my base class. I assume
>that other classes that are listed in the has_a relationship are missing=

>a db handle.
>
>The question is: What is the best way to have a bunch of CDBI classes,
>that have has_a and has_many relationships with a run-time configurable
>DSN?
>
>I admit, that I might have hosed my CDBI install by installing the
>latest Ima::DBI and the RC Class::DBI. If that's the case, what are
>known working versions, that support either an overriden db_Main or a
>late set_db?
>
>Regards,
>	Alexander Gr=E4fe
> =20
>

Utterly confused about set_db and db_Main
Alexander =?iso-8859-1?Q?Gr=E4fe?= 19:40 on 28 Apr 2004

Re: Utterly confused about set_db and db_Main
Tony Bowden 20:02 on 28 Apr 2004

Re: Utterly confused about set_db and db_Main
Alexander =?iso-8859-1?Q?Gr=E4fe?= 19:47 on 29 Apr 2004

Re: Utterly confused about set_db and db_Main
Vince Veselosky 20:08 on 28 Apr 2004

Re: Utterly confused about set_db and db_Main
Dana Hudes 20:14 on 28 Apr 2004

Re: Utterly confused about set_db and db_Main
Alexander =?iso-8859-1?Q?Gr=E4fe?= 19:55 on 29 Apr 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52