Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Semaphore Locking
Message
From
05/12/2001 07:11:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00589685
Message ID:
00589709
Views:
22
>Hi folks,
>
>I am upsizing a system from VFP to SQL Server and want to carry on using semaphore locking. In VFP I could do something like
>
>IF semaphorelock("tablename", id)
> *-- ok
>
>This would add a new record to the table for the tablename/id combination (if it didn't exist) and also RLOCK() it at the same time (in case user crashes).
>
>However whilst I know I could write a stored proc to do the writing to table etc I'm not really sure how to explicitly do a RLOCK in SQL Server. From what I've read SQL Server seems to perform a dynamic lock i.e. it determines itself whether the table should be page locked etc.
>
>Any ideas ?
>
>Kal

Kalim,
You seem to describe a row locking for an insert operation. An insert on SQL server by default uses row locking. You don't need to insert and than hold a lock on it I think. Instead do just one insert when your new record is ready.
OTOH you could use SQL server's implicit and explicit locking via transactions setting transaction isolation level to your taste. You could use table hints for locks too (like updlock, holdlock etc)
Another option is to use remote views. Now with SQL server 7 and up it's arguable that SQL pass through is faster than remote views. If I were you I'd use RVs till I understand SQL server side semantics and continue to use what I already know.
PS: I think SemaphoreLock() is now arguable too (I assume you were referring to semaphomore lock in fox2x plbs).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform