[CDBI] HOW TO populate creation date automatically?

[prev] [thread] [next] [Date index for 2005/12/31]

From: Vitaliy Babiy
Subject: [CDBI] HOW TO populate creation date automatically?
Date: 22:40 on 31 Dec 2005
Hi 

I have table with column 'dateCreated' which supposed to have date when
record was created. How can I populate that field automatically with
CDBI?

I tried to use trigger 'before_create' to populate that field, but it
doesn't work. What I'm missing here?

__PACKAGE__->add_trigger(before_create  => 
sub { my $self = shift;                         
      $self->_attribute_store( { dateCreated => Class::Date->now } );
      } );

Regards, Vit


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

(message missing)

[CDBI] Simple join
Jon Molin 00:16 on 30 Dec 2005

Re: [CDBI] Simple join
Peter Speltz 20:13 on 30 Dec 2005

[CDBI] HOW TO populate creation date automatically?
Vitaliy Babiy 22:40 on 31 Dec 2005

Generated at 01:21 on 10 Jan 2006 by mariachi v0.52