Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Curiousity question; Oracle/SQL-Server...record locking
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00244186
Message ID:
00244222
Views:
15
>Just wondering how an app using Fox on the front and Oracle or some other database on the back locks records if the client desires to have a pessimistic scheme...no other user can edit a record being edited by another.

You can't really get the same behavior that VFP implements. With VFP, the lock is applied when you begin editing the row. But you could implement something similiar.

If you set the connection's Transaction Isolation Level to Repeatable Read, all locks are held until the transaction terminates, either by a commit or rollback. It would look something like this:

hConn = SQLCONNECT(...)
SQLEXEC(hConn, [SET TRANSACTION ISOLATION LEVEL REPEATABLE READ])
SQLEXEC(hConn, [BEGIN TRANSACTION]) or SQLSETPROP(hConn, "Transactions", 2)
SQLEXEC(hConn, [SELECT ... FROM table ...])

At this point, the locks applied by the SELECT will be held until the transaction terminates.

SQLEXEC(hConn, [UPDATE table SET ...])
SQLEXEC(hConn, [COMMIT TRANSACTION]) or SQLCOMMIT()

You ought to be able to get the same behavior using a remote view by hijacking the connection. I'd be wary of views that share a connection.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform