[VXCMD] Record Locks

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Aug 23 21:59:14 CDT 2004


On 8/23/04 8:01 PM, "Ken Ray" <kray at sonsothunder.com> wrote:

>> I did ask, IF WE NEED add 3 parameters into the first function.
> 
> Actually, Ruslan, if you're thinking about changing the SqlSelectRecords()
> function, why not just change the kReadOnly flag internally to kNoLocks?
> That would prevent the cursor that SQLSelectRecords creates from locking
> everyone out (solving the 363 error) and also prevents the need to add 3
> params.

Interesting idea, Ken.

BTW, I wonder. 
So you get 363 when you do SqlSelectRecords() ?

Or some other thread/user get this error, because he cannot lock record
which proceed now SqlSelectRecords() ?

 
> (BTW: The main reason Bobby and I experienced this is that we have someone
> from New York accessing a database in LA, and the latency caused by the
> long-distance access caused our SQLSelectRecords call to tie up all the
> records during that period.)

Aha! this is an answer.

So SqlSelectRecords() have lock records with READ LOCK,
And other users could not access them for WRITE LOCK, right Ken?

Other users still must be able READ that records.


Now let's thinks.
If NY user will not set READ LOCK, and he will read his records e.g. 30
seconds, AND somebody else will CHANGE a record which he have SELECT but
have not yet read. Then NY user will get wrong data. You see Ken?

This is why record locks exists. They prevent from broken logic.

BTW, note, that SqlSelectRecords() use kForwardOnly().
This means that if NY user have select 100 records, then read first 50 then
these 50 records are unlocked already. And only last 50 still yet are
locked.

What you think now?

I think SqlSelectRecords() works now in the correct way.

At last of end if you want OTHER way, you simply should use
Cursor_GetRecords() and own cursor with parameters as you want.
Right ?



-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list