Hi All,
Anyone know how to turn off/on 'Referential Integrity' using xbasic?
Recently had a nasty experience with Auto Increment field. The field supplies the unique link in the parent table for several child tables.
One of my Runtime users somehow managed to create a completely blank record in the parent with no auto increment value and from then on the auto increment restarted from zero creating duplicated values in the parent linking fields. The child tables contain sensitive tables for payments etcetera and became double linked to the wrong child tables and is not apparent to the user until more damage has occurred.
My users are forced to enter new records by clicking on a New Record button with the field rule Cansave event on Lname"""".
My user admits to having problems with their computer crashing (Not only when using my Runtime App) to the extent they now use their laptop so I am hoping this is a one off problem.
Fortunately, I was able to obtain a recent backup zip and make the repair on my computer.
To repair the parent involved drastic surgery, because even by removing the blank record and the duplicated parent records still forced the increment to duplicate. The answer was to turn off referential integrity then remove both the blank record and the duplicated records and then duplicate the parent table, 'records only' to a temp.dbf, zap the existing parent then append back in again into the original parent with the auto increment still set as on. Finally reset referential integrity.
I would like to swap experiences to see how to avoid this blank record scenario occurring again.
Anyone know how to turn off/on 'Referential Integrity' using xbasic? If so, any future mishaps could be repaired remotely with a patch script.
e.g.
Remove Integrity (Otherwise I loose all existing child records linked to original parent)
Delete duplicates
Duplicate to temp.dbf
Zap parent table
Append back from temp
Re-Set Integrity
Would appreciate any feed back on this subject.
Michael
Anyone know how to turn off/on 'Referential Integrity' using xbasic?
Recently had a nasty experience with Auto Increment field. The field supplies the unique link in the parent table for several child tables.
One of my Runtime users somehow managed to create a completely blank record in the parent with no auto increment value and from then on the auto increment restarted from zero creating duplicated values in the parent linking fields. The child tables contain sensitive tables for payments etcetera and became double linked to the wrong child tables and is not apparent to the user until more damage has occurred.
My users are forced to enter new records by clicking on a New Record button with the field rule Cansave event on Lname"""".
My user admits to having problems with their computer crashing (Not only when using my Runtime App) to the extent they now use their laptop so I am hoping this is a one off problem.
Fortunately, I was able to obtain a recent backup zip and make the repair on my computer.
To repair the parent involved drastic surgery, because even by removing the blank record and the duplicated parent records still forced the increment to duplicate. The answer was to turn off referential integrity then remove both the blank record and the duplicated records and then duplicate the parent table, 'records only' to a temp.dbf, zap the existing parent then append back in again into the original parent with the auto increment still set as on. Finally reset referential integrity.
I would like to swap experiences to see how to avoid this blank record scenario occurring again.
Anyone know how to turn off/on 'Referential Integrity' using xbasic? If so, any future mishaps could be repaired remotely with a patch script.
e.g.
Remove Integrity (Otherwise I loose all existing child records linked to original parent)
Delete duplicates
Duplicate to temp.dbf
Zap parent table
Append back from temp
Re-Set Integrity
Would appreciate any feed back on this subject.
Michael
Comment