Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Set Exclusive or LockTable?
Wed, Aug 31 2011 8:59 AMPermanent Link

marcioehrlich

I'm quite confused about the practical difference between setting a table to exclusive or locking it. This is what the manual says:

EXCLUSIVE: When the Exclusive property is set to True and the application successfully opens the table, no other application can access the table.

LOCKTABLE: Call the LockTable method to lock all of the records in a table and prevent other sessions from placing a record lock or table lock on the table.

It looks like pretty the same to me. When should I really use each method?

Tks,
Marcio
Wed, Aug 31 2011 9:30 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

marcioehrlich



Opening a table exclusive stops anyone else from even opening the table, locking the table simply prevents them updating the table. Some operations (eg table restructure) require exclusive access to a table, just locking the records wouldn't be sufficient. I've tended to use EXCLUSIVE when I want to carry out operations where other users shouldn't even be in the app whilst they're running and I didn't want to use a transaction because I wanted to be sure the operation ran and completed. Once I've grabbed the table with EXCLUSIVE that's it no one else can even open it.

Roy Lambert [Team Elevate]
Wed, Aug 31 2011 12:48 PMPermanent Link

marcioehrlich

Thanks a lot, Roy.
When using queries to update or insert, how does that work? I haven't seen examples at the manual.
Tks.
Marcio


Roy Lambert wrote:

Opening a table exclusive stops anyone else from even opening the table, locking the table simply prevents them updating the table.
Wed, Aug 31 2011 6:55 PMPermanent Link

Jose Eduardo Helminsky

HPro Informatica

Marcio

<<
When using queries to update or insert, how does that work? I haven't seen
examples at the manual.
>>
Just think the engine need to open the table related with query, perform the
operation (insert, update or delete) and then close the table. If there are
others users with this table opened exclusively, when query needs to open
the table it will fail.
As a general idea, queries are wrappers to access the tables.

Eduardo

Thu, Sep 1 2011 3:14 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

marcioehrlich


You wouldn't use either when using SQL you'd use transactions.

Look at section 2.12 Transactions in the PDF manual

Roy Lambert [Team Elevate]
Image