Home → Active Query Builder - Metadata handling and filtration → Metadata handling and filtration in Java, VCL and ActiveX Editions → Working with the Metadata Container
2.3. Working with the Metadata Container
This article might be obsolete!
It is valid for ASP.NET, Java, ActiveX, VCL editions, and for previous version of Active Query Builder WinForms .NET Edition (1.x).
The appropriate article for Active Query Builder 2 WinForms .NET Editon can be found here:
Metadata Container (QueryBuilder.MetadataContainer) is collection of database objects displayed in the metadata tree. Each object contains collections of Fields and Relations (foreign keys). You can easily add or remove objects of this collection to add or remove database objects from the tree. Some database objects can be hidden, i.e. they are loaded in the metadata container, but not visible in the tree. System objects are hidden by default.
Metadata container is normally filled with RefreshMetadata or LoadMetadataByMask, LoadMetadataByFilter methods. These methods fill the list of database objects and their relations, but not their fields as it may take a long time to do that in case of large databases or slow connections. Fields are usually loaded when object is added to the query building area. To load fields during the RefreshMetadata method call you should set the WorkOffline (OfflineMode) property to True.
The WorkOffline (OfflineMode) property instructs the component to work in offline mode, i.e. it denies any hidden SQL query executions (mostly to load fields of some database objects). But in case of direct calls of metadata loading methods, it instructs the component to load metadata information in complete, i.e. with fields of each loaded database object.
If you already have the list of allowed objects, you don't need to call the RefreshMetadata method. Instead you can fill the Metadata Container programmatically:
For Each AllowedTableName As String In AllowedTables QueryBuilder.MetadataContainer.AddTable("", AllowedTableName, False, "") Next
Fisrt parameter of the AddTable method is a schema name, fourth is a database name, third parameter is a flag for system objects.