IMetabaseUpdateProgress.OnProgress

Syntax

OnProgress(Data: IMetabaseUpdateProgressData);

Parameters

Data. Update progress information.

Description

The OnProgress method implements an event of the common status of the update/synchronization progress.

Comments

This event is generated when the update is applied or during synchronization of repository objects with the objects in the update.

Example

Executing the example requires that the file system contains the TSDB.pefx update file. This file contains information to update a time series database. If any objects are updated with the access permissions, the method of transfer of objects permissions is implemented in the query after update of the objects.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MUpdate: IMetabaseUpdate;
    Progress: MyUpdateProgress;
Begin
    // Get the current repository
    MB := MetabaseClass.Active;
    // Create an update object
    MUpdate := MB.CreateUpdate;
    // Load update from file with the *.pefx extension
    MUpdate.LoadFromFileNF("c:\TSDB.pefx");
    // Create events that occur on update execution
    Progress := New MyUpdateProgress.Create;
    MUpdate.Apply(Progress);
End Sub UserProc;

Class MyUpdateProgress: UpdateProgress
    Sub OnProgress(Data: IMetabaseUpdateProgressData);
    Begin
        // Display update execution status in the console
        Select Case Data.Stage
            Case MetabaseUpdateProgressStage.Start: Debug.WriteLine("Start of object update");
            Case MetabaseUpdateProgressStage.Prepare: Debug.WriteLine("Prepare object");
            Case MetabaseUpdateProgressStage.Apply: Debug.WriteLine("Update object");
            Case MetabaseUpdateProgressStage.Finish: Debug.WriteLine("Update of objects is finished");
        End Select;
        Debug.WriteLine("Current " + Data.Current.ToString + " of " + Data.Total.ToString + " Object " + Data.Node.Label);
        // Display old object key in the console
        If Data.Node.NodeType = MetabaseUpdateNodeType.Object Then
            Debug.WriteLine("Old object key: " + (Data.Node As IMetabaseUpdateObjectNode).ObjectOldKey.ToString);
        End If;
    End Sub OnProgress;

    Sub OnAskReflectRights(Var Cancel: Boolean);
    Begin
        Cancel := True;
    End Sub OnAskReflectRights;

End Class MyUpdateProgress;

After executing the example the update from the TSDB.pefx file is executed. The MyUpdateProgress custom class is used to handle events that occur during update. Update status is displayed in the console window. The console also displays object key and version. If the update includes tables, for which it is required to update access permissions, the permissions will be updated only on the platform level.

See also:

IMetabaseUpdateProgress