Metadata pre-filtration (VCL, ActiveX and Java)
This article is valid for Java, ActiveX, and VCL editions.
The appropriate article for Active Query Builder .NET Editon can be found here:
Using metadata filters, you can prevent loading objects to the Metadata Container from the particular schema or with the 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. When this flag is set to True, this mask instructs to load all objects except those that suit the mask.
Object and Schema masks act similar to the "LIKE" SQL operator added to the metadata fetching query.
You can 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");
The 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 the 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.