3.1. Metadata pre-filtration
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 .NET Editon can be found here: Working with Metadata Filters.
Using metadata filters you may prevent loading objects to the Metadata Container from specific schema or with specific object name.
Metadata filters should be defined BEFORE the RefreshMetadata method call.
The following example excludes objects with names starting with "pre_":
MetadataFilterItem mfi = queryBuilder1.MetadataFilter.Add(); mfi.Exclude = true; mfi.ObjectMask = "pre_%";
And the following example excludes all schemas except the "schema":
MetadataFilterItem mfi = queryBuilder1.MetadataFilter.Add(); mfi.Exclude = false; mfi.SchemaMask = "schema";
The Exclude flag set to False instructs to load only objects that meet the mask. Being set to True, this mask instructs to load all objects except those that meet the mask.
Object and Schema masks act similar to the "LIKE" SQL operator added to the metadata fetching query.
You may define more than one filter at a time. In this case, filter items will be applied consistently.
Note that masks are case sensitive by default. Set the SchemaMaskCaseSensitive and ObjectMaskCaseSensitive properties to false to define case insensitive masks.
The LoadMetadataByMask method is an alternative way to load metadata from the database using filtration:
LoadMetadataByMask("%", "%", "database");
First argument is an object name mask, second is a schema mask and the third argument is a database name, that could be omitted if you database server doesn't support multiple databases.
Usage of the LoadMetadataByMask method substitutes simple metadata filter definition (with the Exclude flag set to False) and call of the RefershMetadata method.
Please note that the RefreshMetadata method will clear the Metadata Container before loading, while the LoadMetadataByMask will not clear it.