CheckTable(Database: IDatabaseInstance): Boolean;
CheckTable(Prognoz.Platform.Interop.Db.IDatabaseInstance): boolean;
Database. Database that should be checked for availability of the table specified in the import scheme.
The CheckTable method checks if the table specified in import scheme of the MDM dictionary, does really exist.
The method returns True if the table specified in the import scheme does really exist.
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 scheme 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 scheme is checked for existence, and checking results are output to the console.
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 scheme 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 scheme is checked for existence, and checking results are output to the console.
See also: