main logo
Subject: Re: Valentina - cursor record locking against reading with
Author: Ruslan Zasukhin
Posted: 2001/05/31 06:21:08
 
View Entire Thread
New Search


on 5/31/01 5:56, Steven at srt AT bigpond D.O.T net.au wrote:

> Hi Ruslan,
>
> With valentina server, will I be able to lock the records in a cursor so
> that no-one else can even READ these records until the cursor is destroyed?
> And if this is possible, what is the behaviour of the template when it
> reaches the line
> cursorRef = SELECT A from Table WHERE B=id
> and finds that those records are locked by another cursor?-does it pause
> execution of the template until the records are unlocked by the other
> cursor being destroyed, and then proceeds (like the acquireSem command)?
>
> ---------this is an example to illustrate my question------------
>
> Say I have a Table in a valentina db with two fields, A and B.
>
> A user adds a record to this Table according to the following algorithm:
>
> //user submits a value for the variable id to the template
> cursorRef = SELECT A from Table WHERE B=id
> list=valgetrecords(cursorRef)
> sum=0
> repeat with i in list
> sum=sum+i'1
> end repeat
> valaddrecord(cursorRef,["A",sum])
> valremovecursor(cursorRef)
>
> Now assume that there are multiple users with the same id trying to add
> records near simultaneously - say there are 10 records trying to be added
> with the same id, and the intention is that each added record includes in
> it's value for the field A the contribution of any of the 10 records that
> might have been previously added.
>
> On a single Mac, with V4WS, I can make sure the algorithm works properly
> like this:
>
> acquireSem(id)
> cursorRef = SELECT A from Table WHERE B=id
> list=valgetrecords(cursorRef)
> sum=0
> repeat with i in list
> sum=sum+i'1
> end repeat
> valaddrecord(cursorRef,["A",sum])
> valremovecursor(cursorRef)
> releaseSem(id)
>
> If I dont semaphore, then it is possible that in between one user reading
> the records and then adding a new record, another user could read the same
> list of records the first user did, and therefore misses the contribution
> of the first user's added record.
>
> Without using semaphores but rather record locking, what is needed is
> therefore the ability to lock records in a cursor against others reading
> these records, with the behaviour that the template pauses execution until
> the records are unlocked by the cursor being destroyed.

Steve, I will not answer on your question exactly now.

The dream-target to get isolation levels of cursor executions like in SQL
Server for example. This means that one cursor during its work DO NOT see
any changes of other parallel cursors...

In ideal you will not work with record locks directly...


--
Best regards,
Ruslan Zasukhin

-------------------------
Paradigma.

e-mail: ruslan@paradigmasoft.com
web : http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on AT lists D.O.T macserve.net



-------------------------------------------------------------
The Valentina mailing list is brought to you by MacServe.net
For info on lists services, see http://www.macserve.net/lists.html
 
©2001 Ruslan Zasukhin
<-- Prior Message New Search Next Message -->