Skip to main content
Peter Cheney
Participating Frequently
Aug 17, 2023 2:17 AM UTC
Question

Triggers and TransactionProcessing

Hi Everyone,

Been a while since my last interaction here and have been up to my armpits in it all.

Have a question about transaction processing/commits/boundaries etc and the compatibility with file triggers. Can the two co-exist? I have a feeling the answer will be no but thought i should ask. We're on UV11.3.4. Any info would be great thanks.

Regards,

Peter

    2 replies

    Neil Morris
    Rocketeer
    Aug 17, 2023 9:48 AM UTC

    Hi Everyone,

    Been a while since my last interaction here and have been up to my armpits in it all.

    Have a question about transaction processing/commits/boundaries etc and the compatibility with file triggers. Can the two co-exist? I have a feeling the answer will be no but thought i should ask. We're on UV11.3.4. Any info would be great thanks.

    Regards,

    Peter

    Hi Peter,

    I don't have a lot of specific experience in this area but I don't see a general reason why you would not be able to use transaction processing and file triggers. The trigger itself will execute as a transaction. UniVerse supports nested transactions. So if updating a file with a trigger inside a transaction, the trigger transaction would be a nested transaction of the BASIC transaction and would be committed when the top level BASIC transaction was committed. I can probably put a test together to confirm this understanding.

    Thanks,

    Neil

    Manu Fernandes
    Inspiring
    Aug 25, 2023 9:46 AM UTC

    Hi Everyone,

    Been a while since my last interaction here and have been up to my armpits in it all.

    Have a question about transaction processing/commits/boundaries etc and the compatibility with file triggers. Can the two co-exist? I have a feeling the answer will be no but thought i should ask. We're on UV11.3.4. Any info would be great thanks.

    Regards,

    Peter

    Hello 

    As Neil sais, I confirm it works. 

    Pay attention to locks you acquire into the trigger it can be already acquired by the top transaction.

    Then, when write/trigger is done the locks acquired within are still there until final commit / rollback. A real diffence ! 

    If you need to log something before rollback.. Use openseq/writeseq which is not part of transaction. 

    Manu