Re: [CDBI] tables with data_type column names

[prev] [thread] [next] [Date index for 2005/09/20]

From: Matt S Trout
Subject: Re: [CDBI] tables with data_type column names
Date: 09:33 on 20 Sep 2005
On Tue, Sep 20, 2005 at 10:10:08AM +0100, Paul Makepeace wrote:
> Je 2005-09-20 08:48:12 +0100, David Baird skribis:
> > On 9/20/05, Paul Makepeace <digitalcraftsmen.net@xxxxx.xxx> wrote:
> > > I'm re-learning CDBI after quite an absence and have discovered a legacy
> > > system I'm working on has a table with 'data_type' as a column name,
> > > which clashes with an internal CDBI method.
> > > 
> > > The twist is that I'm trying to use the barely-documented
> > > Class::DBI::Loader.
> > > 
> > > http://search.cpan.org/dist/Class-DBI/lib/Class/DBI.pm#Changing_Your_Column_Accessor_Method_Names
> > > seems like it might've helped otherwise.
> > > 
> > > Anyone solved this? Not using ::Loader is an option if there's another
> > > similarly dynamic option.
> > 
> > I haven't used it yet, but SQL::Translator can generate CDBI classes
> > from a schema, and it can generate a schema from a DBI connection.
> 
> Ah! Great, thanks - this is very close to what I was after. Anyone who's
> as lazy as I am trying it might like to start with,
> 
> sqlt --parser DBI --dsn 'dbi:mysql:dbname=X;host=127.0.0.1' --db-user X --db-password X --producer 'ClassDBI' | perl -pe "s/use base 'DBI'/use base 'My::DBI'/; s/^DBI::/My::DBI::/"
> 
> ...a hack to change the base class which isn't offered by sqlt (yet).
> Note also that the producer somehow loses the DSN & auth.

That's actually rather cute.

We have some stuff in-house that generates CDBI classes and SQL CREATE TABLE
statements off a common XML format; it *will* get released eventually but is
currently too well intertwined with client source trees to just tar up.

Anybody who wants this to happen is welcome to kick me by e-mail periodically;
it may not help but I should get round to doing it :)

> Thanks also to Matt Trout and John Siracusa for extensive help with
> their products off list; look forward to checking that out when I'm
> back from holidays.

Aye, well, see my 'horses for courses' comment in another post. Analyze
them all and see which works best for you (and tell the respective authors
if you manage to break anything so we can fix it :)

        -- 
             Matt S Trout       Specialists in perl consulting, web development, and
  Technical Director    UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +

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

[CDBI] tables with data_type column names
Paul Makepeace 00:54 on 20 Sep 2005

Re: [CDBI] tables with data_type column names
David Baird 07:48 on 20 Sep 2005

Re: [CDBI] tables with data_type column names
Paul Makepeace 09:10 on 20 Sep 2005

Re: [CDBI] tables with data_type column names
Matt S Trout 09:33 on 20 Sep 2005

Generated at 17:55 on 28 Sep 2005 by mariachi v0.52