CheckTable(Database: IDatabaseInstance): Boolean;
CheckTable(Prognoz.Platform.Interop.Db.IDatabaseInstance): boolean;
Database. Database checked for availability of the table specified in the import scheme.
The CheckTable method checks if the table specified in export 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. Create an export scheme with the EXPORTSCHEMA identifier in the dictionary.
Add links to the Metabase, Rds, Db system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Dict: IRdsDictionary;
ExportSchemas: IRdsExportSchemas;
ExportSchema: IRdsExportSchema;
Database: IDatabaseInstance;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemByIdNamespace("NSI_SEP", MB.GetObjectKeyById("NSI")).Bind; Dict := MObj As IRdsDictionary;
ExportSchemas := Dict.ExportSchemas;
ExportSchema := ExportSchemas.FindById("EXPORTSCHEMA");
Debug.WriteLine(ExportSchema.CheckTable(Database)? "Table exists" : "Table not found");
End Sub UserProc;
After executing the example the table specified in the export 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. Create an export scheme with the EXPORTSCHEMA 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;
ExportSchemas: IRdsExportSchemas;
ExportSchema: IRdsExportSchema;
Database: IDatabaseInstance;
Begin
MB := Params.Metabase;
MObj := MB.ItemByIdNamespace["NSI_SEP", MB.GetObjectKeyById("NSI")].Bind();
Dict := MObj As IRdsDictionary;
ExportSchemas := Dict.ExportSchemas;
ExportSchema := ExportSchemas.FindById("EXPORTSCHEMA");
Debug.WriteLine(ExportSchema.CheckTable(Database)? "Table exists" : "Table not found");
End Sub UserProc;
After executing the example, the table specified in the export scheme is checked for existence, and checking results are output to the console.
See also: