<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>It looks like your "updated" column is mapped as a DateTime object (line 26).</div><div><br></div><div>You probably want to do something like this:</div><div><br></div><div><font class="Apple-style-span" face="Courier"><font class="Apple-style-span" color="#FF0000">$delta_row->updated( DateTime->now() );</font></font></div><div><br></div><div>Further resources:</div><div><br></div><div><a href="http://search.cpan.org/dist/DateTime/lib/DateTime.pm">http://search.cpan.org/dist/DateTime/lib/DateTime.pm</a></div><div><br></div><div><a href="http://search.cpan.org/dist/DateTime-Format-Pg/lib/DateTime/Format/Pg.pm">http://search.cpan.org/dist/DateTime-Format-Pg/lib/DateTime/Format/Pg.pm</a></div><div><br></div><div>cheers</div><div><br></div><div>-- frosty</div><div><br><div><div>On Mar 18, 2009, at 4:01 PM, ken uhl wrote:</div><br><blockquote type="cite"><br><br><div>From: ken uhl <<a href="mailto:kenuhl@berkeley.edu">kenuhl@berkeley.edu</a>><br></div><div>Date: March 17, 2009 11:09:22 AM PDT<br></div><div>To: <a href="mailto:beginners@perl.org">beginners@perl.org</a><br></div><div>Subject: class DBI postgres date time format<br></div><br><br>How do I set up table class method to correctly format and write 'updated' column date and time stamp to postgres?<br><br>I have table entry object that contains this - to inflate and deflate :<br><br>I think I need to add "has_timestamp" <br>.....<br><br> 22 __PACKAGE__->table('dhcpmac');<br> 23 __PACKAGE__->columns( Primary => qw/rowid/ );<br> 24 __PACKAGE__->columns( All => qw/rowid mac calnetuid updated updatedby dynhostname ishmael disable/ );<br> 25<br> 26 __PACKAGE__->has_a( updated => 'DateTime',<br> 27 inflate => sub { DateTime::Format::Pg->parse_timestamptz(shift); },<br> 28 deflate => sub { DateTime::Format::Pg->format_timestamptz(shift); } );<br><br>...<br><br>my CGI does this :<br><br>...<br># retrieve old row data 301 my $delta_row = IST::DNSDB::dhcpmac->retrieve($old_rowid) ;<br> 302 my $old_mac = $delta_row->mac();<br>...<br># replace some of the data - including 'updated'<br> 305 $delta_row->mac($new_validated_mac);<br> 306 $delta_row->updated( "now()" );<br>..<br> 308 $delta_row->updatedby($calnetuid);<br>...<br> 313 $delta_row->update();<br> 314 $delta_row->commit();<br><br>( line 306 crashes with invalid SQL command line value, obviously, but what goes here? )<br><br>?<br><br>TIA,<br>Ken Uhl,<br>UC Berkeley<br><br><br><br><br>_______________________________________________<br>SanFrancisco-pm mailing list<br><a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br>http://mail.pm.org/mailman/listinfo/sanfrancisco-pm<br></blockquote></div><br></div></body></html>