IRdsImportSchema.CheckTable

Fore Syntax

CheckTable(Database: IDatabaseInstance): Boolean;

Fore.NET Syntax

CheckTable(Prognoz.Platform.Interop.Db.IDatabaseInstance): boolean;

Parameters

Database. Database that should be checked for availability of the table specified in the import schema.

Description

The CheckTable method checks if the table specified in import schema of the MDM dictionary, does really exist.

Comments

This method returns True, if the table specified in the import schema does really exist.

Fore Example

Executing the example requires an MDM repository with the NSI identifier and an MDM dictionary with the NSI_DICT identifier in the repository. It is also necessary to create an import schema with the IMPORTSCHEMA identifier in the dictionary.

Add links to the Metabase, Rds, Db system assemblies.

Sub  UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    ImportSchemas: IRdsImportSchemas;
    ImportSchema: IRdsImportSchema;
    Database: IDatabaseInstance;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace("NSI_SEP",  MB.GetObjectKeyById("NSI")).Bind; Dict := MObj As  IRdsDictionary;
    ImportSchemas := Dict.ImportSchemas;
    ImportSchema := ImportSchemas.FindById("IMPORTSCHEMA");
    Debug.WriteLine(ImportSchema.CheckTable(Database)? "Table exists" : "Table not found");
End  Sub  UserProc;

After executing the example the table specified in the import schema is checked for existence, and checking results are output to the console.

Fore.NET Example

Executing the example requires an MDM repository with the NSI identifier and an MDM dictionary with the NSI_DICT identifier placed in this repository. It is also necessary to create an import schema with the IMPORTSCHEMA identifier in the dictionary.

Imports Prognoz.Platform.Interop.Rds;
Imports Prognoz.Platform.Interop.Db;

Public  Sub  UserProc(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Dict: IRdsDictionary;
    ImportSchemas: IRdsImportSchemas;
    ImportSchema: IRdsImportSchema;
    Database: IDatabaseInstance;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemByIdNamespace["NSI_SEP",  MB.GetObjectKeyById("NSI")].Bind();
    Dict := MObj As  IRdsDictionary;
    ImportSchemas := Dict.ExportSchemas;
    ImportSchema := ImportSchemas.FindById("IMPORTSCHEMA");
    Debug.WriteLine(ImportSchema.CheckTable(Database)? "Table exists" : "Table not found");
End  Sub  UserProc;

After executing the example the table specified in the import schema is checked for existence, and checking results are output to the console.

See also:

Rds Assembly Interfaces