How do I set up table class method to correctly format and write 'updated' column date and time stamp to postgres?

I have table entry object that contains this - to inflate and deflate :

I think I need to add "has_timestamp"
.....

    22 __PACKAGE__->table('dhcpmac');
    23 __PACKAGE__->columns( Primary => qw/rowid/ );
24 __PACKAGE__->columns( All => qw/rowid mac calnetuid updated updatedby dynhostname ishmael disable/ );
    25
    26 __PACKAGE__->has_a( updated => 'DateTime',
27 inflate => sub { DateTime::Format::Pg->parse_timestamptz(shift); }, 28 deflate => sub { DateTime::Format::Pg->format_timestamptz(shift); } );

...

my CGI  does this :

...
# retrieve old row data 301 my $delta_row = IST::DNSDB::dhcpmac->retrieve($old_rowid) ;
   302          my $old_mac = $delta_row->mac();
...
#  replace some of the data - including 'updated'
   305          $delta_row->mac($new_validated_mac);
   306              $delta_row->updated( "now()" );
..
   308          $delta_row->updatedby($calnetuid);
...
   313           $delta_row->update();
   314           $delta_row->commit();

( line 306 crashes with invalid SQL command line value, obviously, but what goes here? )

?

TIA,
Ken Uhl,
UC Berkeley


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to