[Dbix-class] Deflating a date

Nick Edwards nicke at summerleaze.co.uk
Thu Dec 28 11:18:59 GMT 2006


Hi,

I am using DBIx::Class along with Catalyst. Everything seems to be
working fine, however I am having a problem with deflation of a date
when I am trying to update the database.

I have tried the following:


__PACKAGE__->add_column(date => { data_type => 'date' });  

and on another occasion:

__PACKAGE__->inflate_column('date', {
    inflate => sub { DateTime::Format::MySQL->parse_date(shift) },
    deflate => sub { DateTime::Format::MySQL->format_date(shift) },
});

Now in my app I have:

my $article = $c->model('Pacdb::File::Article')->find_or_create(id =>
$id);
$article->set_column(date => $params{date}); # format dd/mm/yyyy
$article->update;

Now the problem is that DBIx does not seem to be deflating this and
puts it in as 'dd/mm/yyyy'. I have also tried update_or_create which
does not work either. I can't seem to get this working, please any
ideas?

I have read
http://lists.rawmode.org/pipermail/dbix-class/2006-May/001349.html
which seems to indicate that it should work.

-- 
Thanks

Nick Edwards <nicke at summerleaze.co.uk>
Information Systems Administrator
Summerleaze RE-Generation Ltd
Tel: 01628 411943




More information about the Dbix-class mailing list