OnAskConstraintsHandling(
Node: IMetabaseUpdateNode;
Details: String;
Var Handling: UpdateDataConstraintsHandlingType);
Node - an update object for which the event was generated.
Details - the information about the error.
Handling - the variable that determines the way of integrity constraint processing.
The OnAskConstraintsHandling method implements an event that occurs if it is necessary to process constraint of the data integrity of the object that is 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 the information about the MDM dictionary.
Sub Main;
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 Main;
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("Start of objects updating");
Case MetabaseUpdateProgressStage.Prepare: Debug.WriteLine("Object preparation");
Case MetabaseUpdateProgressStage.Apply: Debug.WriteLine("Object updating");
Case MetabaseUpdateProgressStage.Finish: Debug.WriteLine("Object updating was finished");
End Select;
Debug.WriteLine("Current " + Data.Current.ToString + " from " + Data.Total.ToString + " Object " + Data.Node.Label);
End Sub OnProgress;
End Class MyUpdateProgress;
The MDM dictionary is updated from the NSIDictionary.pef update file after executing this example. The MyUpdateProgress custom class is used for processing the events that occur during update. Status of update progress is displayed in the development environment console. If there are elements to which the links exist and that are not present in the update in the consumer dictionary, the dictionary is not updated.
See also: