[Catalyst] Re: Adding relationships to loaded CDBI models

Bill Moseley moseley at hank.org
Wed Jun 22 20:19:57 CEST 2005


On Wed, Jun 22, 2005 at 10:28:40AM -0400, James Tolley wrote:
> > Would that be Class::DBI::Loader::Generic?  Why is that mysql
> > specific?
> 
> I think that it would have to be, since finding foreign keys is a
> RDBMS specific activity. However, in the future, people could offer to
> include might_have and has_many mapping relationships to all systems
> possible.

Oh -- I was looking at the CDBI::Loader::Pg and saw that it uses the
::Generic _relationships() method with $dbh->foreign_key_info().
I don't think foreign_key_info() works with mysql, even with innodb.

> > BTW -- would having CDBI::Loader set up has_a with inflate/deflate
> > be a nice addition for timestamps and boolean?  I have a lot of
> > timestamp columns and it would be nice to automatically setup those
> > up with DateTime or Time::Piece.
> 
> There's already Time::Piece::MySQL (which doesn't handle time fields,
> though). For those of you not using MySQL, I very much agree that this
> would be terrific.

Class::DBI::mysql has "autoinflate" which will set those up.  Could
Loader provide an option to call autoinflate() after calling
set_up_table()?

It would also be a nice addition to the other database CDBI extensions
(like CDBI::Pg).  I suppose even if Loader looked at
$dbh->column_info() for setting up common inflate/deflates it would
still be database specific and not something Loader could do in a
Generic way.  I'm using Loader and CDBI in part to not have to worry
about the database specifics, of course.

BTW -- does anyone have examples how to best setup inflate/deflate
with Postgresql booleans?


-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list