[Catalyst] DB Functions in the Schema

Lee Aylward lee at laylward.com
Mon Aug 17 15:41:25 GMT 2009


I have done stuff like that in the past by using the
DBIx::Class::DynamicDefault module. There may be a better way to do it,
though, so it is probably worth asking on the DBIC mailing list.

-- 
Lee

On Mon, 17 Aug 2009 16:12:58 +0800
Trevor Phillips <trevor.phillips at gmail.com> wrote:

> Is there an easy way to represent a DB function call as a named column
> within a DBIx::Class schema?
> 
> eg;
> 
> If at the DB level I would do something like:
>   select updated, from_unixtime(updated) as updated2 from mytable;
> ... can I have;
> 
> __PACKAGE__->add_columns(
>    "updated", { data_type => "TIMESTAMP" }
>    "updated2", { something => "from_unixtime(updated)", etc...}
> ...
> );
> 
> Thanks.
> 



More information about the Catalyst mailing list