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

Doug Tomm dctomm at gmail.com
Mon Oct 8 15:30:26 EDT 2012

yes, that was it!  using the readonly pragma solved it; i turned on statement tracing to see for myself.

many thanks!


On Oct 8, 2012, at 12:30 PM, Boris Kolpackov wrote:

> 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