[Catalyst] getting the db connection used by catalyst
Daniel McBrearty
danielmcbrearty at gmail.com
Wed Oct 4 10:46:22 CEST 2006
maybe I'm worrying too much about reusing the catalyst connection - I
could just get a connection in new() and keep a ref to it there, and
use that whenever needed.
I don't know much about what goes on internally, or how much overhead
each connection has with it ...
On 10/4/06, Daniel McBrearty <danielmcbrearty at gmail.com> wrote:
> I have. Could do it either way, but on the whole I prefer to seperate the two.
>
> Even if I did that, I think I'd have the same question - how to get a
> connection without creating a new one.
>
> On 10/4/06, Andreas Marienborg <omega at palle.net> wrote:
> > I assume you have considered adding this to your dbic-schema?
> >
> > If it is all to deal with the same DB, and the same structures, you
> > might benefit from that.
> >
> >
> > andreas
> >
> >
> > On 4. okt. 2006, at 04.27, Daniel McBrearty wrote:
> >
> > > basically it does some fancy processing on the db and caches the
> > > results. initially, that will be it. It will present a number of
> > > convenience methods, which can be used to access either the db or
> > > cached data. There will likely be some methods to write to the db,
> > > again convenience stuff.
> > >
> > >
> > >
> > > On 10/4/06, Brandon Black <blblack at gmail.com> wrote:
> > >>
> > >>
> > >> On 10/3/06, Daniel McBrearty <danielmcbrearty at gmail.com> wrote:
> > >>> if you have a (dbix) database, and use it as a model, you generally
> > >>> end up doing this :
> > >>>
> > >>> $c->model-> ....
> > >>>
> > >>> and the database connection is handled internally.
> > >>>
> > >>> I now want to write another model which uses the db. It would be
> > >>> better to use the existing connection that cat has created, rather
> > >>> than create another one.
> > >>>
> > >>> If I write a new() method for this model, does it have access to the
> > >>> context? what is a good way to do this?
> > >>
> > >>
> > >> What kind of model is your new model, and how will it use/store/
> > >> whatever the
> > >> $dbh? There are a lot of ways to do what you're talking about in
> > >> general,
> > >> it all depends on what's right for your design. Be aware that
> > >> once you take
> > >> the raw $dbh from DBIC and start using it yourself, you lose all
> > >> of its
> > >> fancy connection management.
> > >>
> > >> -- Brandon
> > >>
> > >>
> > >> _______________________________________________
> > >> List: Catalyst at lists.rawmode.org
> > >> Listinfo:
> > >> http://lists.rawmode.org/mailman/listinfo/catalyst
> > >> Searchable archive:
> > >> http://www.mail-archive.com/[email protected]/
> > >> Dev site: http://dev.catalyst.perl.org/
> > >>
> > >>
> > >>
> > >
> > >
> > > --
> > > Daniel McBrearty
> > > email : danielmcbrearty at gmail.com
> > > www.engoi.com : the multi - language vocab trainer
> > > BTW : 0873928131
> > >
> > > _______________________________________________
> > > List: Catalyst at lists.rawmode.org
> > > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> > > Searchable archive: http://www.mail-archive.com/
> > > catalyst at lists.rawmode.org/
> > > Dev site: http://dev.catalyst.perl.org/
> >
> >
> > _______________________________________________
> > List: Catalyst at lists.rawmode.org
> > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> > Searchable archive: http://www.mail-archive.com/[email protected]/
> > Dev site: http://dev.catalyst.perl.org/
> >
>
>
> --
> Daniel McBrearty
> email : danielmcbrearty at gmail.com
> www.engoi.com : the multi - language vocab trainer
> BTW : 0873928131
>
--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
More information about the Catalyst
mailing list