2009/3/17 ken uhl <ken...@berkeley.edu>: > 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); } ); >
I don't recognise this as DBI. Is it DBIx::Class? If so I think you might want to look at: DBIx::Class::InflateColumn::DateTime DBIx::Class::TimeStamp and http://search.cpan.org/~ribasushi/DBIx-Class-0.08099_07/lib/DBIx/Class/Manual/Cookbook.pod#Using_database_functions_or_stored_procedures HTH, Dp. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/