Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleted record re-use
Message
From
09/10/2001 09:54:40
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
09/10/2001 01:53:07
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00565803
Message ID:
00565894
Views:
14
>Hi Stuart
>
>There are lots of solutions to this and I am sure you will get several here at the UT. I would
>
>1) Create an index key on DELETED().

This is dangerous. If the index exists, it will automatically be used for Rushmore Optimization! This is bad for this specific index (see my FAQ #8109 for details). As a workaround, you can disable the use of this index for R.O., using a filtered index.

>2) When I want to add a new record I would first try to see if a deleted record exists by setting the files index to the deleted tag and using SEEK(.T.). (You would need to SET DELETED OFF for this so that deleted records can be found. You can SET DELETED ON to hide deleted records again but only after step 3).
>3) If a record is found then use RECALL to undelete it and update the field values.
>4) If no deleted record found then I would create a new record with INSERT INTO or APPEND ... whichever is appropiate.
>5) To employ FIFO/LIFO you would set the file to the Deleted index tag and use the Asecnding or Descending options as the case may be.
>
>Hope this gets you started.

To the suggestions, I want to add:

  • You can use BLANK to wipe out the contents of the record.
  • I suggest to automate the procedure outlined above with an appropriate method / function, which would be applied in all forms, to all tables.

    Hilmar.
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Previous
    Reply
    Map
    View

    Click here to load this message in the networking platform