GetClassObjectRange - Teradata Meta Data Services

Teradata Meta Data Services Programmer Guide

Product
Teradata Meta Data Services
Release Number
15.00
Language
English (United States)
Last Update
2018-09-28
Product Category
Teradata Tools and Utilities

GetClassObjectRange

Purpose

The CMetaObject class GetClassObjectRange returns the specified subset of CMetaObjects in the class that matches the selection criteria. The GetClassObjectRange only returns the current version for objects matching the search criteria.

Description

The function allows the programmer to specify the property id, property value and comparison operator on which to perform the search. The properties upon which to sort the returned list can also be specified. This function allows specifying the start number and number of objects to return. The properties to be returned can be restricted by using a columns filter.

For more information on building the strObjName parameter for a search, see “Name Search” on page 131.

For more information on building the sortList parameter, see “Sort List” on page 130.

For more information on using the columnFilters parameter, see “Column Filter” on page 132.

Requirements

  • The class ID (internal or globally unique) must be set.
  • The propFilter list may contain zero or more CMetaFilterInfo objects.
  • The PropertyID (SetPropertyID()) or PropertyName (SetName()) of the value attribute in each CMetaFilterInfo object must contain a valid Relative Property ID or name of a property description in the class.
  • The value attribute in each CMetaFilterInfo object must also be set to the value on which the search will be made. This value must be of the same type as the property description. For example, if the search is to be made on Relative Property ID = 1 and Relative Property ID 1 is defined as an integer, Value must be set to an integer (SetInt()). If relative Property ID 1 is a string, Value must be set to a string (SetString()).
  • The default ComparisonOperator in each CMetaFilterInfo object is EQUAL and the default LogicalOperator is META_AND.
  • If the propFilter list contains zero objects, the function will perform a search by strObjName only. If strObjName is also NULL, the API will return all the objects in the collection.
  • If the propFilter list contains objects and strObjName is set, the logical operator between the properties and the name will the “AND”. To perform a search of a name “OR” a property, set strObjName to NULL and add a CMetaFilterInfo object to the propFilter list for a name search.
  • Syntax

    HRESULT GetClassObjectRange (
    vector<CMetaObject>&objectList,
    int *totalCount,
    const MetaFilterInfoVector &propFilter,
    const MetaObjectKeyVector &sortList,
    const int startNum, 
    const int returnCount,
    const GUID &gClassID, 
    const OBJECTID_t lClassID = 0,
    LPCTSTR strObjName = NULL, 
    const bool WithLock = false);
     
    HRESULT GetClassObjectRange (
    vector<CMetaObject>&objectList,
    int *totalCount,
    const MetaFilterInfoVector &propFilter,
    const MetaObjectKeyVector &sortList,
    const MetaObjectIDVector &columnFilters
    const int startNum, 
    const int returnCount,
    const GUID &gClassID, 
    const OBJECTID_t lClassID = 0,
    LPCTSTR strObjName = NULL, 
    const bool WithLock = false);
     

    See Table 50 for examples of setting the startNum and returnCount.

     

    Table 50: GetClassObjectRange Example 

    Total # of objects in search results

    Start Number

    Return Count

    Number of objects returned

    Objects returned

    100

    1

    20

    20

    1-20

    100

    41

    50

    50

    41-90

    100

    91

    20

    10

    91-100

    100

    200

    20

    0

     

    0

    20

    20

    0

     

    For more information on creating the propFilter for the search, see Chapter 8: “CMetaFilterInfo Class.”

    For more information on using the columnFilters parameter, see “Column Filter” on page 132.

     

    Argument

    In/Out

    Description

    objectList

    In/out

    Reference to the list of CMetaObjects that will hold the collection returned. The list is cleared before adding the return collection.

    totalCount

    out

    Returns the total number of objects that were in the search results. Set totalCount to NULL if you do not want the total.

    propFilter

    In

    List of FilterInfo objects containing the property id and value to use to perform the search

    sortList

    In

    List of property identifiers (relative property id or name) to sort the collection by. The return list will be returned in ascending order and the sort will not be case specific.

    columnFilters

    In

    List of property IDs defining the common and unique properties to be set in each object. An empty vector means to return all properties.

    gClassID

    In

    Class GUID.

    lClassID

    In

    Class internal ID.

    StrObjName

    In
    (optional)

    Search string for names of objects in the class to be returned.

    WithLock

    In

    WithLock=true keeps the class table locked for WRITE. Use within an explicit transaction. Set WithLock to true when one of the class objects will subsequently be updated within the transaction. This prevents deadlocks caused by Teradata promotional locks.