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

Boris Kolpackov boris at codesynthesis.com
Mon Oct 8 15:30:19 EDT 2012


Hi Doug,

Doug Tomm <dctomm at gmail.com> writes:

>   #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.

This is probably because the UPDATE statement executed by ODB
also includes a value for the 'modified' column. One way to
prevent ODB from doing this would be to make the member
readonly. You can either declare it const:

const boost::posix_time::ptime m_modified;

Or mark it as readonly:

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

Boris



More information about the odb-users mailing list