Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Commands w/Inherent EXCLUSIVE or FLOCK()

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I am trying to chase down a list of the VFP commands which, through the use of options, etc., inherently require EXCLUSIVE use of a table or work with an inherent FLOCK().

I already know about the 'standards' such as PACK, ZAP, INDEX, etc. I am looking for the more subtle, lesser known ones.

I have seen them mentioned in this forum at some point in time, but cannot seem to find them now.

As I recall (but my memory has failed me more than once in over the years), they included:
REPLACE ALL ....
DELETE ALL ...
DELETE ... FOR ...

I'd appreciate a memory refresher.

Thanks,
JRB-Bldr
 
JRB-Bldr,

REPLACE ALL, DELETE ALL etc do NOT require exclusive use. In general, anything that simply reads or updates the data can be used in shared mode. You need exclusive use if you are changing the file structure in some way, or copying or deleting the underlying files.

So, in addition to the ones you mentioned, you can add ALTER TABLE and MODIFY STRUCTURE. No doubt other people will come up with some more.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike,

I hate to disagree, but I have run into instances in the past where REPLACE ALL has not worked. It wasn't that I needed exclusive access either. In fact, I USEd the table shared, but if it was open by another workstation, my app would pause attempting to lock.
Now the caveat to this is that it was several years ago using VFP 6 on tables created with FPD 2.x on a Novell server. It could be totally irrelevant now, but it is something to keep in the back of the mind.



-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Dave,

I also hate to disagree, but things like REPLACE ALL do not generally require exclusive use, even under VFP 6 (or even under 2.x) -- although I agree the Novell network operating system might have caused problems.

That said, you might well get multi-user problems in certain cases. If you are doing a bulk update on a large table, it's possible that another user might update one or more individual records while your REPLACE ALL is in progress, and that might give you an undesirable result. But the solution to that is to apply file or record locks, not to go for exclusive use.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike & Dave - thanks for the feedback.

Its somewhat embarrassing that after all these years of developing FP & VFP applications I can't remember which command options might need Exclusive and/or an inherent FLOCK(), but, as I said above, my memory isn't 100% perfect (or so more than a few lady friends have reminded me).

Anyway, my question did not have to do with a development effort, but instead it is to try to help another VFP developer resolve an extremely intermittent "File Access Denied" problem.

They swear that there are no INDEX, PACK, ZAP, etc. commands being used and no explicit EXCLUSIVE so I thought that there may be another more subtle command being used which might be causing the problem on those rare instances when one user was doing Command-1 and another user needed to do Command-2 on the same table.

Regardless, thanks for your input.

Thanks,
JRB-Bldr
 
auomatic locking of DBF header or rlocks of records is done by VFP by REPLACE,UPDATE,DELETE and SQL. But all that does not need exclusive access. REPLACE ALL for example needs a header lock while working. This compares a bit to exclusive access, but it's still different from that.


If a command needs to lock the DBF header and works a while on the table, this is like a temporary exclusive access in respect to writing, but every other client can also have that table used and still read, eg SQL-Select from that table. That is a huge difference to exclusive access.

Bye, Olaf.
 
Also see here:


The INSERT Command is mentioned. That's no error, it's not Insert-SQL, but the Foxpro command to insert a record before another in the file.

Regarding special tables like DBC, VCX files etc, perhaps add the COMPILE command, eg COMPILE CLASSLIB, COMPILE DATABASE. At least you should not compile a database, which is open, even if it just is a change in the Memo fields that could be done in shared access.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top