Tuesday, 14 April 2015

On Row Versioning

By popular request (!), Pyrrho now has row versioning. This enables two things: (1) during a long transaction you can check if someone else has changed or deleted a row that you have read; (2) at any subsequent time (using the same or another connection) you can see if the row you have read has been changed or deleted.

The manual says:

Pyrrho supplies a pseudocolumn in all base tables called CHECK. The value is a string that includes the transaction log name, defining position and current offset of the row version. When retrieved it refers to the version valid at the start of the transaction, but it can be used at any time subsequently (inside or outside the transaction) to see if the row has been updated by this or any other transaction (this is the only violation of transaction isolation in Pyrrho).

The method of checking is a method of the PyrrhoConnect subclass of IDbConnection:

bool Check(string ch)
Check to see if a given CHECK pseudocolumn value is still current, i.e. the row has not been modified by a later transaction.
The Open Source Pyrrho OSPDemo folder includes a demo of this CHECK feature.

No comments:

Post a Comment