[VXCMD] Record Locks

Ken Ray kray at sonsothunder.com
Mon Aug 23 15:07:38 CDT 2004


On 8/23/04 1:59 PM, "Ruslan Zasukhin" <sunshine at public.kherson.ua> wrote:

> 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() ?

It must be, because that is the only thing that happens at the time the
record lock is reported.
 
> 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?

Sorry, Ruslan, but no. ALL of our cursors that are done with SQLSelect() are
NoLock cursors. So we only have NoLock SQLSelect() cursors and
SQLSelectRecords() cursors (which are as you said ReadOnly and so run into
each other and cause the 363).

> What you think now?
> 
> I think SqlSelectRecords() works now in the correct way.

I don't... personally since SQLSelectRecords() only retrieves data and does
not change it, I think you should use kNoLocks rather than kReadOnly.... I
don't see the advantage of using kReadOnly instead of kNoLocks with
SQLSelectRecords.

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

Well, I would prefer to not have to replace my one line SQLSelectRecords
calls with three lines of SQLSelect(), Cursor_GetRecords(), Cursor_Remove().

Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com




More information about the Valentina mailing list