OnAskConstraintsHandling(
Update: IMetabaseUpdate;
Node: IMetabaseUpdateNode;
Details: String;
Var Handling: UpdateDataConstraintsHandlingType);
Update. Update applied to the current repository.
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 updated object.
Public Class CUpdateEvents: UpdateEvents
Public Sub OnBeginUpdate(Update: IMetabaseUpdate);
Var
Flag: IMetabaseUpdateProperty;
Begin
Debug.WriteLine("Update repository objects");
Flag := Update.Properties.FindById("Ver");
If Flag <> Null Then
Flag.Value := "1.1";
End If;
End Sub OnBeginUpdate;
Public Sub OnAskConstraintsHandling(Update: IMetabaseUpdate; Node: IMetabaseUpdateNode;
Details: String; Var Handling: UpdateDataConstraintsHandlingType);
Begin
Handling := UpdateDataConstraintsHandlingType.KeepTableUnchanged;
End Sub OnAskConstraintsHandling;
Public Sub OnAskReflectRights(Var Cancel: Boolean);
Begin
Cancel := True;
End Sub OnAskReflectRights;
Public Sub OnUpdateObject(Update: IMetabaseUpdate; CurrentNode: IMetabaseUpdateNode;
Var Skip: Boolean);
Begin
If CurrentNode.NodeType = MetabaseUpdateNodeType.DeleteObject Then
Skip := True;
End If;
End Sub OnUpdateObject;
Public Sub OnEndUpdate(Update: IMetabaseUpdate);
Begin
Debug.WriteLine("Object update is finished");
End Sub OnEndUpdate;
End Class CUpdateEvents;
This example is a template for update unit. On applying of update that contains this unit the following is checked:
If update contains an update flag with the Ver identifier, a value "1.1" is assigned to this flag. Only the objects, for which an update condition equals to "Ver=1.1", are updated.
On data integrity violation the update of the whole object is skipped.
Permissions for objects, for which it is necessary, will be updated only on the platform level.
In update, the elements that delete repository objects are skipped.
See also: