On Mon, 2007-01-08 at 06:55 -0800, jfbaro wrote:
> Hi,
> 
> We need to use a trigger to update the column sync into a table when any
> column is changed (except the sync column itself), so by looking in the
> SQLite website we came across that:
> 
> CREATE TRIGGER syncTransactions AFTER
> UPDATE OF transactionId, transactionJourneyId, transactionDeviceId,
> transactionSignificant ON transactions
> BEGIN
>   UPDATE transactions SET sync = 0 WHERE transactionId = old.transactionId;
> END;
>
> But even when we change sync column (by issuing a update command on SQLite
> Expert tool) the trigger is executed. Shouldn't it be execute only when we
> update one of the columns specified in the clause UPDATE OF??

The trigger will fire if any of the (transactionId, transactionJourneyId
etc.) are specified in the UPDATE statement, even if the value doesn't
change. i.e. the following:

UPDATE syncTransactions SET transactionId = transactionId;

will fire the trigger once for each row in the table. Could it be that
the tool you're using is generating an UPDATE statement that specifies
values for all columns?



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

Reply via email to