OnAskConstraintsHandling(
Node: IMetabaseUpdateNode;
Details: String;
Var Handling: UpdateDataConstraintsHandlingType);
Node. Update object, for which event is generated.
Details. Error information.
Handling. Variable that determines integrity constraint handling method.
The OnAskConstraintsHandling method implements an event that occurs if it is necessary to handle data integrity constraint of the object to be updated. This event is generated when the update is applied.
Executing the example requires an update file with the NSIDictionary.pef name. This update contains information about MDM dictionary.
Sub UserProc;
Var
MB: IMetabase;
MUpdate: IMetabaseUpdate;
Progress: MyUpdateProgress;
Begin
MB := MetabaseClass.Active;
MUpdate := MB.CreateUpdate;
MUpdate.LoadFromFile("c:\NSIDictionary.pef");
Progress := New MyUpdateProgress.Create;
MUpdate.Apply(Progress);
End Sub UserProc;
Class MyUpdateProgress: UpdateProgress
Sub OnAskConstraintsHandling(Node: IMetabaseUpdateNode; Details: String; Var Handling: UpdateDataConstraintsHandlingType);
Begin
Handling := UpdateDataConstraintsHandlingType.KeepTableUnchanged;
End Sub OnAskConstraintsHandling;
Sub OnProgress(Data: IMetabaseUpdateProgressData);
Begin
Select Case Data.Stage
Case MetabaseUpdateProgressStage.Start: Debug.WriteLine("Object update start");
Case MetabaseUpdateProgressStage.Prepare: Debug.WriteLine("Prepare object");
Case MetabaseUpdateProgressStage.Apply: Debug.WriteLine("Update object");
Case MetabaseUpdateProgressStage.Finish: Debug.WriteLine("Object update is finished");
End Select;
Debug.WriteLine("Current " + Data.Current.ToString + " of " + Data.Total.ToString + " Object " + Data.Node.Label);
End Sub OnProgress;
End Class MyUpdateProgress;
After executing the example the MDM dictionary is updated from the NSIDictionary.pef update file. The MyUpdateProgress custom class is used to handle the events that occur during update. Status of update progress is displayed in the development environment console. If the destination dictionary contains elements, to which there are links and which are absent in the update, the dictionary is not updated.
See also: