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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete and Pack

Status
Not open for further replies.

ryupb

MIS
Aug 31, 2004
25
US
Hi,

I have a program that uses tables which is shared with other users, the dilemma is this, whenever I delete some records, using the SQL Delete From which also uses Transaction, and Tableupdate, the records are successfully deleted.... that's what I thought...

But if I check the actual tables, The records are still there only marked for deletion...

question is this, is there a Pack Equivalent that I can use in a multi-user environment?? Something that would permanently delete the records and not just marking it for deletion...

thanks for your time guys....
 
There is no pack equivalent for files being "multi-used".
For a pack you will ALWAYS need EXCLUSIVE access.

Rob.

 
is there a Pack Equivalent that I can use in a multi-user environment??
as what sir rob said, nope - there is none. why is this, you might ask? well, "when you use PACK, vfp copies all records not marked for deletion to a temporary table. after PACK is finished executing, vfp deletes the original table from disk and renames the temporary table with the original table name, thus, the need for EXCLUSIVE use. if you press ESC to interrupt PACK, the temporary table is deleted, and the original table remains unchanged. the original table is also recovered if you run out of disk space while PACK is executing."

hope this helps. peace! [peace]

kilroy [trooper]
philippines

"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cost $100, get one million miles to the gallon, and explode once a year, killing everyone inside."
 
If the app only opens tables as and when needed you can write and opportunistic routine that will pack a table when it finds that nobody else is using it. Another way out is to run a pack and backup routine when the first user logs on in the morning.

You might find it safer to forget PACK and write your own routine based on copying undeleted records to a new temporary table.


Geoff Franklin
 
Ryupb,

I agree completely with the other replies you have received. However, are you sure you have a problem?

In many circumstances, packing is not an issue. The main reason to pack a table is to improve performance or reduce disk space, and that's only relevant with large, volatile tables. If that's not the case, just ignore the deleted records.

If you want the deleted records to be no longer be visible to the user (or your programs), then just SET DELETED ON. You can do that at any time, regardless of file sharing and multi-user issues.

Mike

Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Some hints on deleted records

a) SET DELETED ON sets a default filter for showing only undeleted records.
b) PACK must have exclusive access to the table
c) You may/should have a maintanance routine for backup of the database and pack tables at that time.
d) you can BLANK records before deleting them (but must be cautious with primary or candidate indexes on fields: These include values of deleted records!).
e) you may recycle records with RECALL and thereby reduce the amount of deleted records.

Bye, Olaf.
 
Mike,

This is something I have done when recycling records because sometimes when they are reused, I don't replace all fields in the record with new data. So if I use GATHER MEMVAR, and only some fields are populated, there may be residual data in other fields.


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

This is something I have done when recycling records because sometimes when they are reused, I don't replace all fields in the record with new data.

I see. Makes sense. Thanks.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Hi Mike.

Blanking records may be nice, if you want to be able to reuse some fields values in another new record. Well, if you blank ALL fields of records you delete you may get a problem with candidate indexes already with the second record deleted.

Well, in most cases it may be better to BLANK records when RECALLing them, not before DELETE. But BLANK is a useful command in this area, isn't it?

Bye, Olaf.
 
Thaks for the replies guys...

I decided that I will just have to make a Maintenance code that will make all deleted records permanent at the end of the day, or after closing hours..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top