[Catalyst] DB Functions in the Schema

Trevor Phillips trevor.phillips at gmail.com
Tue Aug 18 09:41:59 GMT 2009


On Tue, Aug 18, 2009 at 5:24 PM, Matthias Dietrich<mdietrich at cpan.org> wrote:
>
> you could ask a single question on the irc channel like I do ;-):
> irc.perl.org#dbix-class

Ooh, I might give that a go when I have a minute! (And at the right time of day)

> Though I don't know the answer, maybe the deflate and inflate hooks can call
> SQL functions?  But for dates you can use Perl functions or define your
> column as datetime (see: DBIx::Class::InflateColumn::DateTime).

I was hoping to be able to do it as part of the query when it gets the
rest of the normal columns, since one of the reasons was to reduce
multiple calls to the DB (or other routines).

And DateTime was what got me pulling my hair out to investigate this
alternative in the first place! A simple query with a dozen lines was
taking around 2 seconds to return, and I'd put in an extra method,
which was doing some DateTime calls. Without calling that method, the
request took a much more reasonable 300ms.

In the end I found the culprit was because I set a timezone of "local"
- if I hard-coded it to my actual timezone, it was fast, but using
"local", was slow-as, even though it translated to the same thing!

> Also good luck from me!

Thanks!

-- 
Trevor Phillips  - http://dortamur.livejournal.com/
"On nights such as this, evil deeds are done. And good deeds, of
course. But mostly evil, on the whole."
      -- (Terry Pratchett, Wyrd Sisters)



More information about the Catalyst mailing list