IMetabaseUpdateSqlNode.IsDatabaseValid

Syntax

IsDatabaseValid: Boolean;

Description

The IsDatabaseValid property returns whether there is a database, to which SQL command executes query in the current repository.

Comments

The property is read-only.

Available values:

NOTE. Before checking if a database exists in the current repository, to which SQL command executes query, it is necessary to check correctness of update. To do this, use the IMetabaseUpdate.Prepare method.

Example

Executing the example requires the update file C:\Update.pef. The repository must contain a database with the OBJ_DB identifier.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    Update: IMetabaseUpdate;
    UFN: IMetabaseUpdateFolderNode;
    i: Integer;
    UpdateObj: IMetabaseUpdateSqlNode;
    DbNode: IMetabaseUpdateObjectNode;
Begin
    MB := MetabaseClass.Active;
    Update := Mb.CreateUpdate;
    Update.LoadFromFile("C:\Update.pef");
    Update.Prepare;
    UFN := Update.RootFolder;
    For i := 0 To UFN.Count - 1 Do
        If UFN.Item(i) Is IMetabaseUpdateSqlNode Then
            UpdateObj := UFN.Item(i) As IMetabaseUpdateSqlNode;
            If Not UpdateObj.IsDatabaseValid Then
                DbNode := UpdateObj.DatabaseNode;
                If DbNode <> Null Then
                    DbNode.Object := MB.ItemById("OBJ_DB");
                    Else UpdateObj.Database := MB.ItemById("OBJ_DB").Key;
                End If;
            End If;
        End If;
    End For;
    Update.SaveToFileNF("C:\Update.pefx");
End Sub UserProc;

After executing the example the update C:\Update.pef is opened. For all SQL commands the existence of necessary DB is checked in update. If DB does not exist in the current repository, it will be replaced with the OBJ_DB DB. Changes are saved.

See also:

IMetabaseUpdateSqlNode