IMetabaseUpdateLog.Records

Syntax

Records: IMetabaseUpdateLogRecords;

Description

The Records property returns the collection of update process log records.

Comments

Each record contains information about update of a single object included in the update.

Example

Executing the example requires the update file D:\Work\update.pefx.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    Mb: IMetabase;
    Update: IMetabaseUpdate;
    Progress: CUpdateProgress;
    Records: IMetabaseUpdateLogRecords;
    Record: IMetabaseUpdateLogRecord;
    Resolver: IMetabaseUpdateResolver;
    Unresolved: IMetabaseUpdateUnresolved;
Begin
    Mb := MetabaseClass.Active;
    // Load update from file
    Update := Mb.CreateUpdate;
    Update.LoadFromFileNF("D:\Work\update.pefx");
    // Apply update
    Progress := New CUpdateProgress.Create;
    Update.Apply(Progress);
    // View general information in update log
    Records := Update.Log.Records;
    For Each Record In Records Do
        Debug.WriteLine("Object to be updated: " + Record.Node.Label);
        Debug.Indent;
        If Mb.Security.Policy.CheckObjectVerionOnUpdateFromPef Then
            Debug.WriteLine("Local version before update: " + Record.LocalObjectVersion.ToString);
            Debug.WriteLine("Local repository: " + Record.LocalOriginalMetabase);
            Debug.WriteLine("Version in update: " + Record.UpdateObjectVersion.ToString);
            Debug.WriteLine("Repository in update: " + Record.UpdateOriginalMetabase);
        End If;
        If Record.IsFinished Then
            Debug.WriteLine("Update is applied.")
        Else
            Debug.WriteLine("Errors occurred during update.")
            If Record.HasError Then
                Debug.WriteLine("Update error: " + Record.Error.Message);
                Debug.WriteLine(Record.ErrorSkipped ? "Error skipped." : "Error requires handling.");
            Elseif Record.HasConflicts Then
                Debug.WriteLine("Object type in update does not correspond to object type in repository");
            Elseif Record.HasOnResolve Then
                Debug.WriteLine("Conflict related to presence of object dependences.");
                Resolver := Record.OnResolve;
                Debug.WriteLine("Number of unresolved dependences: " + Resolver.Count.ToString);
                For Each Unresolved In Resolver Do
                    Debug.WriteLine("Dependency with " + Unresolved.Name + '(' + Unresolved.Id + ')');
                End For;
            End If;
        End If;
        Debug.Unindent;
    End For;
End Sub UserProc;

Class CUpdateProgress: UpdateProgress
    Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
    Begin
        Ignore := True;
    End Sub OnError;
End Class CUpdateProgress;

After executing the example the update from the specified file is loaded and installed. Information about results of single update elements installation will be displayed in the development environment console.

See also:

IMetabaseUpdateLog