Hello

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:

=========== CODE ===============
Private Declare Sub sqlite3_open Lib "SQLite3VB.dll" (ByVal FileName As String, ByRef handle As Long) Private Declare Function sqlite_get_table Lib "SQLite3VB.dll" (ByVal DB_Handle As Long, ByVal SQLString As String, ByRef ErrStr As String) As Variant()

Private Declare Function number_of_rows_from_last_call Lib "SQLite3VB.dll" () As Long

'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;"
    mQuery = mQuery & "commit"

    sqlite3_open DBFile, DB
    If DB > 0 Then
        mVar = sqlite_get_table(DB, QueryStr, mErrStr)
        If mErrStr <> "" Then
            ErrStr = mErrStr
            sqlite3_close DB
            Exit Function
        Else
            'No error + empty array! How to be notified of conflict?
=========== CODE ===============

Thank you
G.


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

Reply via email to