Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I need cascading inserts!
Message
From
08/01/1997 09:10:32
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00016574
Message ID:
00016741
Views:
66
>INSERT INTO works great, but I found that if I attempt to recall the record after deletion the uniquess of my index fails. You know a work around for this? My plans are to add the deleted record to my history table and just recycle the deleted record. Now if I have say, ten deleted records in in my parent and child tables and add a new record, I search the parent for a deleted record, scatter blank to a variable then gather it and assume adding the person. I believe I will have to add this same recycling code in my RI. Do you have any better ideas and a way to recall my records if necessary?
>
>Thanks again Edward
>
>Jon

OK. This is another story. If you delete a record it still is in table and in index file. So if you try to add record with the same primary key as in deleted record you will get error. The solution is to have special mechanism to produce unique primary key. I used to have special table which stores next sequential key for each table (so, we have 2 fields: id, tablename). Moving key value sequentially you will never get duplicate key value. If for some reason you want to recycle key values you can add some code for this purposes (storing them in history table or just using DELETED() filtered index). But remember: you cannot move pointer on the same table inside RI-trigger.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform