[Dbix-class] using load_classes selectively

Frazer Irving superfraz at clumsyjedi.com
Fri Feb 8 14:30:47 GMT 2008


DBIx::Class::Schema::Loader it is!

Many thanks

f


On Feb 8, 2008 1:43 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:

> On Fri, Feb 08, 2008 at 09:52:28AM +0000, Frazer Irving wrote:
> > >
> > >
> > > On Feb 8, 2008 7:59 AM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> > >
> > > >
> > > > What business requirement is leading you to want on-demand loading?
> > > >
> > >
> > Oops sorry about that last reply.
> >
> > Basically I work on a poorly structured application, the in-house method
> of
> > determining the columns for a table is to query the INFORMATION_SCHEMA
> of
> > the mysql database at runtime, or to embed column names in SQL
> statements
> > (eww). I have opted to place the results of INFORMATION_SCHEMA queries
> in
> > __PACKAGE__->add_columns but this is going to result in a lot of
> unnecessary
> > DB calls. I think I will write some additional code to pre-cache the
> column
> > names somewhere.
>
> Why don't you just use DBIx::Class::Schema::Loader ?
>
> That can dump column and rel info to disk, or grab it at startup, and
> supports
> only doing so for some tables.
>
> > In the interim, can you tell me if my approach of placing calls to
> > DB::Main->load_classes inside the body of DB::Main::Foo a sane approach?
> I
> > happened upon it through experimentation.
>
> Sane? ... well, I don't think anything that requires that approach is
> sane.
> But once you -do- require something like that, it's probably not so
> horrific
> a way of making it work :)
>
> --
>      Matt S Trout       Need help with your Catalyst or DBIx::Class
> project?
>   Technical Director
> http://www.shadowcat.co.uk/catalyst/
>  Shadowcat Systems Ltd.  Want a managed development or deployment
> platform?
> http://chainsawblues.vox.com/
> http://www.shadowcat.co.uk/servers/
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.rawmode.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080208/1d6=
34818/attachment.htm


More information about the DBIx-Class mailing list