HomeActive Query Builder - Metadata handling and filtrationMetadata handling and filtration in Java, VCL and ActiveX EditionsMetadata pre-filtration

2.1. Metadata pre-filtration


This article is valid for Java, ActiveX and VCL editions.

The appropriate article for Active Query Builder 2 .NET Editon can be found here:

Using metadata filters you can 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 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");

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.

This page was: Helpful | Not Helpful