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:
00244323
Views:
16
>>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

Hi Mike,

This would imply that one would have to start a transaction, select the data desired either to a vfp view or to class properties to map to a form, and keep the transaction open until user decided to update changes from the form. It seems that this would go against trying to keep transactions open for as short a time as possible.

Thanks,
Steve
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform