Hello,

Koen Deforche wrote:

> See: http://en.wikipedia.org/wiki/Optimistic_concurrency_control and
> http://cwiki.apache.org/CAY/optimistic-locking-explained.html
> 
> ASFAIK, optimistic concurrency control is the most widely form of
> locking used for web applications because you do not need to take
> database locks while the user is thinking (and since HTTP is a
> stateless protocol, you cannot know whether the user's browser has
> crashed or whether he is in fact thinking very long). Therefore it has
> only a very low impact on database performance since you do not need
> to take database locks.
> 
> It requires active support in a table, by having an extra column, and
> thus is not something you would do "behind the back". It also requires
> that SQL update and SQL delete statements take the mechanism into
> account to check for the correct version/timestamp, and if applicable
> to update the version field/timestamp.

I understandd - and as I see, you need the get_affected_row_count to 
have a feedback on whether the operation was actually successful.
You might achieve this effect by (for example) storing the session id of 
the most recent modification instead of the version/timestamp. Then, if 
after the attempted modification the session id is the one that you 
wanted, then the modification was successful (that is, the record 
belongs to the "current" session) and if not, there was a conflict.

Of course, it requires an additional query to the database and avoiding 
it might be a real use-case for the get_affected_row_count.

We should have a look at how this can be implemented. In PostgreSQL the 
appropriate API could be PQcmdTuples. I cannot find any dedicated 
function for Oracle, but the value can be obtained from SQL%ROWNUM variable.

Regards,

-- 
Maciej Sobczak * www.msobczak.com * www.inspirel.com

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to