[odb-users] commits don't change "on update current timestamp" column

Doug Tomm dctomm at gmail.com
Mon Oct 8 14:02:22 EDT 2012


ODB version:  2.0.0
MySQL version:  5.1.35
OS:  CentOS 5

i have an object model for which i want to store modification times in the database.  the table looks something like this:

CREATE TABLE `record` (
  `update_me` tinyint(4) NOT NULL DEFAULT '0',
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8

and the corresponding data members for the object look like this:

  #pragma db type("timestamp") column("modified") not_null
  boost::posix_time::ptime m_modified;

and the problem i'm having is that after committing an update to the object, the 'modified' column is never changed.  when i manually update the update_me column in a row with an UPDATE statement, the modified time is correctly updated.  but i can't seem to cause this to change programmatically.  

i am using the boost/date-time and boost/date-time/posix-time profiles with the ODB compiler.

thanks for any pointers or clues.

doug




More information about the odb-users mailing list