Openedge Database Row Version

Discussão em 'StackOverflow' iniciado por fdantas, Agosto 29, 2017.

  1. fdantas

    fdantas Administrator Moderador

    I am attempting to implement a row version strategy for tables in our OpenEdge database.

    The simple solution i have come up with would be to add an integer iRowVersion field to each table and have the write trigger validate and increment the field as follows:

    TRIGGER PROCEDURE FOR WRITE OF Customer OLD BUFFER oldCustomer.

    IF Customer.iRowVersion < oldCustomer.iRowVersion THEN
    RETURN ERROR "RowVersion Out Of Date".

    ASSIGN Customer.iRowVersion = Customer.iRowVersion + 1.


    This will prevent any concurrent changes being overwritten, however i am unsure the increment by one per row is the best. SQL ROWVERSION is incremented accross the entire database, and to emulate that approach would use a sequence instead:

    ASSIGN Customer.iRowVersion = NEXT-VALUE(rowVersionSequence).


    In our large database where many records will be changing, this has the potential to increase the sequence very quickly. Having a sequence per table would curtail this but seems over the top and the +1 approach keeps it simple.

    Continue reading...

Compartilhe esta Página