IMetabaseUpdateProgress.OnAskConstraintsHandling

Syntax

OnAskConstraintsHandling(

Node: IMetabaseUpdateNode;

Details: String;

Var Handling: UpdateDataConstraintsHandlingType);

Parameters

Node - update object, for which the event is generated.

Details - information about error.

Handling - variable that determines a method of integrity constraint handling.

Description

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.

Example

Executing the example requires an update file with the NSIDictionary.pef name. This update contains information about 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;

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:

IMetabaseUpdateProgress