Database objects usage and other information about the currently loaded SQL query is instantly available through the QueryBuilder.QueryStatistics set of collections.
  1. Used database objects: QueryBuilder.QueryStatistics.UsedDatabaseObjects collection.
    Each item of this collection has link to the MetadataObject object to retrieve detailed information about this database object. Please note that this link might be set to null if such object can not be found in the Metadata Container.
  2. Used database object fields: QueryBuilder.QueryStatistics.UsedDatabaseObjectColumns collection.
    Each item of this collection has name, type of the field. It also has links to the MetadataField and MetadataObject objects to retrieve detailed information about this field and the database object to which it belongs to. The Selected property indicates if this field is used in some of the output columns in the query.
    Please note that this collection does not contain fields that were used in the query without table alias prefix. This because it is impossible to uniquely determine correspondence of this field to a table.
  3. Output query columns: QueryBuilder.QueryStatistics.OutputColumns collection.
    This collection lists output columns of the query. Each item of this collection has the Expression and ExpressionAlias properties to retrieve SQL expression and it's alias (if defined). If SQL expression is a simple database object field, additional information for it is available: field type, object name, links to MetadataField and MetadataObject objects, etc.

This article was helpful for 1 person. Is this article helpful for you?