Gilles Ganault <gilles.ganault-jG/[EMAIL PROTECTED]>
wrote:
I'd like to use a timestamp column in each table to keep track of
when a column was last updated, so that a user can be notified of a problem when trying to updated a record that has already been updated by another
user while the first user was still working on the original data.

In www.sqlite.org/lang_conflict.html, I read about the "UPDATE OR
ROLLBACK" instructions, so tried the following using Todd Tanner's VBified SQLite DLL... but am not notified of anything special: SQLite doesn't return
any error, and just reports that no row matches:

    'row already updated by someone else, so timestamp=2 -> no row
actually matches constraint
    mQuery = "begin;"
    mQuery = mQuery & "update OR ROLLBACK mytable set name='bart',
timestamp=2 where id=1 and timestamp=1;"

The conflict resolution clause ("OR ROLLBACK" in your case) kicks in, unsurprisingly, when there is a conflict - e.g. when an update would violate a uniqueness or CHECK constraint. It is a normal case, and not a conflict, when the condition in the WHERE clause simply selects zero rows.

See sqlite3_changes:

http://sqlite.org/capi3ref.html#sqlite3_changes

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to