Re: [CDBI] tables with data_type column names
[prev]
[thread]
[next]
[Date index for 2005/09/20]
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.
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.
P
--
Paul Makepeace .............................. http://paulm.com/inchoate/
"If you sat on my face, then it would be nice."
-- http://paulm.com/toys/surrealism/
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi