You are on page 1of 530

Teradata Meta Data Services

Programmer Guide
Release 14.00
B035-3047-071A
November 2011

The product or products described in this book are licensed products of Teradata Corporation or its affiliates.
Teradata, Active Enterprise Intelligence, Applications Within, Aprimo, Aprimo Marketing Studio, Aster, BYNET, Claraview, DecisionCast,
Gridscale, Managing the Business of Marketing, MyCommerce, Raising Intelligence, Smarter. Faster. Wins., SQL-MapReduce, Teradata Decision
Experts, Teradata Labs Logo, Teradata Raising Intelligence Logo, Teradata Source Experts, WebAnalyst, and Xkoto are trademarks or registered
trademarks of Teradata Corporation or its affiliates in the United States and other countries.
Adaptec and SCSISelect are trademarks or registered trademarks of Adaptec, Inc.
AMD Opteron and Opteron are trademarks of Advanced Micro Devices, Inc.
EMC, PowerPath, SRDF, and Symmetrix are registered trademarks of EMC Corporation.
GoldenGate is a trademark of Oracle.
Hewlett-Packard and HP are registered trademarks of Hewlett-Packard Company.
Intel, Pentium, and XEON are registered trademarks of Intel Corporation.
IBM, CICS, RACF, Tivoli, and z/OS are registered trademarks of International Business Machines Corporation.
Linux is a registered trademark of Linus Torvalds.
LSI is a registered trademark of LSI Corporation.
Microsoft, Active Directory, Windows, Windows NT, and Windows Server are registered trademarks of Microsoft Corporation in the United
States and other countries.
NetVault is a trademark or registered trademark of Quest Software, Inc. in the United States and/or other countries.
Novell and SUSE are registered trademarks of Novell, Inc., in the United States and other countries.
Oracle, Java, and Solaris are registered trademarks of Oracle and/or its affiliates.
QLogic and SANbox are trademarks or registered trademarks of QLogic Corporation.
SAS and SAS/C are trademarks or registered trademarks of SAS Institute Inc.
SPARC is a registered trademark of SPARC International, Inc.
Symantec, NetBackup, and VERITAS are trademarks or registered trademarks of Symantec Corporation or its affiliates in the United States
and other countries.
Unicode is a registered trademark of Unicode, Inc. in the United States and other countries.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Other product and company names mentioned herein may be the trademarks of their respective owners.

THE INFORMATION CONTAINED IN THIS DOCUMENT IS PROVIDED ON AN AS-IS BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION
MAY NOT APPLY TO YOU. IN NO EVENT WILL TERADATA CORPORATION BE LIABLE FOR ANY INDIRECT, DIRECT, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS OR LOST SAVINGS, EVEN IF EXPRESSLY ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
The information contained in this document may contain references or cross-references to features, functions, products, or services that are
not announced or available in your country. Such references do not imply that Teradata Corporation intends to announce such features,
functions, products, or services in your country. Please consult your local Teradata Corporation representative for those features, functions,
products, or services available in your country.
Information contained in this document may contain technical inaccuracies or typographical errors. Information may be changed or updated
without notice. Teradata Corporation may also make improvements or changes in the products or services described in this information at any
time without notice.
To maintain the quality of our products and services, we would like your comments on the accuracy, clarity, organization, and value of this
document. Please email: teradata-books@lists.teradata.com.
Any comments or materials (collectively referred to as Feedback) sent to Teradata Corporation will be deemed non-confidential. Teradata
Corporation will have no obligation of any kind with respect to Feedback and will be free to use, reproduce, disclose, exhibit, display, transform,
create derivative works of, and distribute the Feedback and derivative works thereof without limitation on a royalty-free basis. Further, Teradata
Corporation will be free to use any ideas, concepts, know-how, or techniques contained in such Feedback for any purpose whatsoever, including
developing, manufacturing, or marketing products or services incorporating Feedback.
Copyright 1999-2011 by Teradata Corporation. All Rights Reserved.

Preface
Purpose
This book provides information about the Teradata Meta Data Services Meta Data
Development Kit, which is a Teradata Tools and Utilities product. Teradata Tools and Utilities
is a group of products designed to work with Teradata Database.
Programming information and descriptions of the Application Programming Interfaces
(APIs), Meta Data Services Dynamic Link Libraries (DLLs), and other files needed to interface
with the MDS Repository from customer applications are provided.
The subjects covered in this book include:

Overview of Interfaces to MDS

Application Information Models

General API Information

Data Types Used in APIs

C++ Class - CMetaRepository

C++ Class - CMetaPersist

C++ Class - CMetaObject

C++ Class - CMetaFilterInfo

C++ Class - CMetaObjectKey

C++ Class - CMetaObjectClassKey

C++ Class - AIM

C++ Class - Security

COM Interfaces

XML Scripting Interface

Error Messages

Steps for Using the MDS APIs and Example Code

Audience
This book is intended for use by Meta Data Services:

Developers

Programmers

Administrators

Teradata Meta Data Services Programmer Guide

Preface
Supported Releases

Supported Releases
This book supports the following releases:

Teradata Database 14.0, 13.10, 13.00, 12.00, V2R6.2

Teradata Tools and Utilities 14.00, 13.10

Teradata Meta Data Services Version 14.00, 13.10

To locate detailed supported-release information:


1

Go to http://www.info.teradata.com/.

Under Online Publications, click General Search.

Type 3119 in the Publication Product ID box.

Under Sort By, select Date.

Click Search.

Open the version of the Teradata Tools and Utilities ##.##.## Supported Platforms and
Product Versions spreadsheet associated with this release.

The spreadsheet includes supported Teradata Database versions, platforms, and product
release numbers.

Prerequisites
The following prerequisite knowledge is required for this product:

Teradata Database Systems

Teradata ODBC Driver

Microsoft Windows products

Linux

Changes to This Book


The following changes were made to this book in support of the current release. Changes are
marked with change bars. For a complete list of changes to the product, see the Release
Definition associated with this release.

Teradata Meta Data Services Programmer Guide

Preface
Additional Information

Update

Description

November 2011
Teradata Tools and
Utilities 14.00

Documented META_E_GWYSOCKET_SOCKET_NOT_READY Gateway


socket error code.
Documented support of user-defined types (UDTs) and user-defined
functions (UDFs) in the Database Information Model (DIM).
MDS support added for global temporary tables in the DIM.
Documented MDS support for the SQL Array data type available in
Teradata 14.0.
Removed section about the Password property of MetaUserInfo since this
property is now hidden.
Figure 15: CWM_Metamodel layout on page 77 updated.
Version numbers updated.
Numerous changes and corrections, indicated by change bars, made
throughout the document.

Additional Information
Additional information that supports this product and Teradata Tools and Utilities is available
at the web sites listed in the table that follows. In the table, mmyx represents the publication
date of a manual, where mm is the month, y is the last digit of the year, and x is an internal
publication code. Match the mmy of a related publication to the date on the cover of this book.
This ensures that the publication selected supports the same release.
Type of Information

Description

Access to Information

Release overview

Use the Release Definition for the following


information:

1 Go to http://www.info.teradata.com/.

Overview of all of the products in the


release
Information received too late to be
included in the manuals
Operating systems and Teradata
Database versions that are certified to
work with each product
Version numbers of each product and
the documentation for each product
Information about available training
and the support center

3 Type 2029 in the Publication Product ID box.

Late information

Teradata Meta Data Services Programmer Guide

2 Under Online Publications, click General Search.


4 Click Search.
5 Select the appropriate Release Definition from

the search results.

Preface
Additional Information

Type of Information

Description

Access to Information

Additional product
information

Use the Teradata Information Products web


site to view or download specific manuals
that supply related or additional
information to this manual.

1 Go to http://www.info.teradata.com/.
2 Under the Online Publications subcategory,

Browse by Category, click Data Warehousing.


3 Do one of the following:

For a list of Teradata Tools and Utilities


documents, click Teradata Tools and Utilities,
and then select an item under Releases or
Products.
Select a link to any of the data warehousing
publications categories listed.
Specific books related to Teradata Meta Data
Services are as follows:
Teradata Meta Data Services Administrator
Guide
B035-3118-mmyx
Teradata Tools and Utilities Installation Guide for
Microsoft Windows
B035-2407-mmyx
Teradata Tools and Utilities Installation Guide for
Red Hat Enterprise Linux
B035-3121-mmyx
Teradata Tools and Utilities Installation Guide for
SUSE Linux
B035-3122-mmyx
Teradata Tools and Utilities Installation Guide for
IBM s390x Linux
B035-3123-mmyx
Teradata Tools and Utilities Installation Guide for
HP-UX
B035-3124-mmyx
Teradata Tools and Utilities Installation Guide for
IBM AIX
B035-3125-mmyx
Teradata Tools and Utilities Installation Guide for
Oracle Solaris on AMD Opteron Systems
B035-3126-mmyx
Teradata Tools and Utilities Installation Guide for
Oracle Solaris on SPARC Systems
B035-3127-mmyx
Teradata Tools and Utilities Installation Guide for
IBM z/OS
B035-3128-mmyx
ODBC Driver for Teradata User Guide
B035-2509-mmyx

Teradata Meta Data Services Programmer Guide

Preface
Additional Information

Type of Information

Description

Access to Information

CD-ROM images

Access a link to a downloadable CD-ROM


image of all customer documentation for
this release. Customers are authorized to
create CD-ROMs for their use from this
image.

1 Go to http://www.info.teradata.com/.
2 Under the Online Publications subcategory,

Browse by Category, click Data Warehousing.


3 Click CD-ROM Images.
4 Follow the ordering instructions.

Ordering
information for
manuals

Use the Teradata Information Products web


site to order printed versions of manuals.

Go to http://www.info.teradata.com/.
Under Print & CD Publications, click How to
Order.
Follow the ordering instructions.

General information
about Teradata

The Teradata home page provides links to


numerous sources of information about
Teradata. Links include:

1 Go to teradata.com.
2 Select a link.

Executive reports, case studies of


customer experiences with Teradata,
and thought leadership
Technical information, solutions, and
expert advice
Press releases, mentions, and media
resources

Teradata Meta Data Services Programmer Guide

Preface
Additional Information

Teradata Meta Data Services Programmer Guide

Table of Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Supported Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Changes to This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Additional Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5

Chapter 1:
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Types of Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C++ API Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
COM Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Java Class Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
XML Utility. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

27
27
29
30
31

COM Interfaces Referenced by MetaSurf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Chapter 2:
Application Information Metamodels (AIMs) . . . . . . . . . . . . . . . . . . . 33
Overview of Application Information Metamodels (AIMs) . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
AIM Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Abstract Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Derived Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Creating a Derived Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Derived Classes and Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Derived Class Benefits/Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

37
37
38
38

Database Information Metamodel (DIM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39


DIM Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
DIM Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

Teradata Meta Data Services Programmer Guide

Table of Contents

DIM Relationship Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65


Extending the Database Information Metamodel (DIM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69
Client Load Metamodel (CLM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72
Client Load Metamodel Class Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .73
Client Load Metamodel Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
Client Load Metamodel Relationship Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76
Common Warehouse Metamodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76

Chapter 3:
General API Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79
Common Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79
Object Name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79
Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Object ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Object GUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Version Number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Owner ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80
Security Profile ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
CreateDate/Time, UpdateDate/Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
PublishState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
IsFrozen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
BaseVersionLoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
PredecessorVersionLoid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
Common Property Constants. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
Data Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82
Current and Non-current Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82
Creating a New Version. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
Reading Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
Deleting Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
Deleting Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84
Enabling and Disabling Data Versioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .84
Retain Associated Business Information and Dormant Objects. . . . . . . . . . . . . . . . . . . . . . . . .85
Enabling or Disabling Dormant Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
Generating Dormant Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85
Reactivating Dormant Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .86
Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .86
Implicit Transactions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87
Explicit Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87
Locking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .93

10

Teradata Meta Data Services Programmer Guide

Table of Contents

Delete Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Owner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Application Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Access Permissions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Super-User Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Security Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

96
96
96
97
99
99

Property Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102


Repository Root. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Multithreaded Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

Chapter 4:
C++ Project Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Include Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Code Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Suggested Project Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Win32 Release . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Win32 Debug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Win32 Release Unicode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Win32 Debug Unicode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

106
106
106
107
108

Linking an MDS Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


DEBUG Mode Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
UNICODE DEBUG Mode Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RELEASE Mode Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
UNICODE RELEASE Mode Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

108
108
109
109
109

Chapter 5:
CMetaRepository Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
CMetaRepository Class Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
BeginTransaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Commit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Rollback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RetryDDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetRepositoryRoot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Teradata Meta Data Services Programmer Guide

111
112
112
113
114
114
114

11

Table of Contents

GetObjectID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115
GetOdbcHenv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116
Deinitialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116
SignOn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .116
SignOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
IsVersioningEnabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .117
RetainBusinessObjectsSupported . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
SetRetainBusinessObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
GetSystemName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
SuperUserLogon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .119

Chapter 6:
CMetaPersist Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121
CMetaPersist Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .121
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122
GetObjectName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122
SetObjectName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .122
GetDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
SetDescription . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
GetObjectGUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
SetObjectGUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .123
GetObjectID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124
SetObjectID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124
GetClassGUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .124
SetClassGUID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
GetClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
SetClassID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
GetOwnerID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .125
SetOwnerID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126
GetCreateTimestamp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126
GetUpdateTimestamp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .126
GetCallerName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
SetCallerName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
GetSecurityProfileID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
SetSecurityProfileID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128
GetVersionNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128
GetPublishState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128
IsPublished . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128
IsFrozen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .128
IsDormant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .129

12

Teradata Meta Data Services Programmer Guide

Table of Contents

Chapter 7:
CMetaObject Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
CMetaObject Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dormant Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions with Additional Search Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaObject Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator = . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator == . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator < . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadObjectWithLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadVersionWithLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadDormantDIMObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadDormantDIMObjectWithLock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetVersions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetVersionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetClassObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetClassObjectVersions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetOrigCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDestCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDormantDIMClassObjects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDormantDIMClassObjectKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDormantDIMDestObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WriteObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WriteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DeleteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DeleteVersionRange. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReactivateDIMObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AddToOrigCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AddToDestCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AddManyToOrigCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AddManyToDestCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RemoveFromOrigCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RemoveFromDestCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RemoveManyFromOrigCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RemoveManyFromDestCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RemoveAllFromOrigCollection2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RemoveAllFromDestCollection2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Teradata Meta Data Services Programmer Guide

131
132
132
136
136
137
137
138
138
139
139
139
140
140
141
141
142
143
144
145
147
148
149
150
150
151
151
151
152
152
153
154
155
157
157
158
159
160
161

13

Table of Contents

ReplaceOrigCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162
ReplaceDestCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
FindLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165
FindAllLabels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166
FindAllOccurrences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .166
GetPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
GetClassObjectKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .168
GetClassObjectVersionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169
SetPropertyValue . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .170
GetClassObjectsByProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171
GetClassObjectVersionsByProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .172
GetClassObjectRange. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .174
GetClassObjectVersionsRange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177
GetOrigCollectionByProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .179
GetDestCollectionByProperty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
GetOrigCollection3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .183
GetDestCollection3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .186
GetOrigCollectionVersions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188
GetDestCollectionVersions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191
GetOrigCollectionVersionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .194
GetDestCollectionVersionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .197
GetOrigCollectionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .200
GetDestCollectionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .203
GetOrigCollectionKeys3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .205
GetDestCollectionKeys3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207
GetDormantDIMOrigCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .210
GetDormantDIMDestCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .212
GetDormantDIMOrigCollectionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .214
GetDormantDIMDestCollectionKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .216

Chapter 8:
CMetaFilterInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .219
Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .219
Substring Search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .219
NULL Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
Property Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
CMetaFilterInfo Class Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
Constructor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221
GetComparisonOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
SetComparisonOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .222
14

Teradata Meta Data Services Programmer Guide

Table of Contents

GetLogicalOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetLogicalOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetParenthesesCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetParenthesesCount . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example Code for CMetaFilterInfo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

223
223
223
223
225

Chapter 9:
CMetaProperty Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
CMetaProperty Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaProperty Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator = . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator == . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator < . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetPropertyID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetPropertyID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PrintProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PrintValue. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PrintValueType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions to Get the Property Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions to Set the Property Value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

227
227
228
228
228
229
229
229
229
230
230
230
231
231
231
233

Chapter 10:
ObjectKey Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
CMetaObjectKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator == . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Operator < . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetObjectName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetObjectName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetObjectID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetObjectID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

237
237
238
238
238
239
239
239

CMetaObjectClassKey Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239


Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
GetClassName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240

Teradata Meta Data Services Programmer Guide

15

Table of Contents

SetClassName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240
GetClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240
SetClassID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240
CMetaVersionedObjectKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
Operator == . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .241
Operator < . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
GetVersionNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
SetVersionNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
GetPublishState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .242
SetPublishState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243
IsPublished . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243
IsDormant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243
IsFrozen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243
CMetaVersionedObjectClassKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .243
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .244
GetClassName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .244
SetClassName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .244
GetClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .244
SetClassID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
GetVersionNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
SetVersionNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
GetPublishState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
SetPublishState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
IsPublished . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246
IsDormant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246
IsFrozen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246
CMetaRelationshipKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .246
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
Operator = . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
GetExplanation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
SetExplanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
CMetaLabeledObjectKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
GetObjectName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
GetObjectID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
GetVersionNumber . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
GetPublishState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249
IsPublished . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249
GetLabelName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249

16

Teradata Meta Data Services Programmer Guide

Table of Contents

Chapter 11:
CMetaLabel Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
CMetaLabel Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaLabel Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetAIMLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetClassLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetObjectsLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetAndMoveObjectsLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DeleteObjectsLabel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetObjectKeys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetCreatorName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetCreatorName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

251
251
252
252
252
253
253
254
254
255
255

Chapter 12:
AIM Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
CMetaAIM Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaAIM Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaAIM Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateMDSModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateMDSClassDesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateMDSClassDesc2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateMDSDerivedClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateMDSRelationshipDesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetClassDesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetClassDescCollection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetRelationshipDesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetRelationshipDescColl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetVersioningSupport. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetModelVersioningFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WriteObject/WriteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

258
258
259
259
259
260
261
262
263
264
265
265
266
266
267
268

CMetaClassDesc Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaClassDesc Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaClassDesc Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateMDSPropertyDesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateMDSDerivedProperty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetUniqueNamesFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

268
268
269
270
270
274
278

Teradata Meta Data Services Programmer Guide

17

Table of Contents

SetUniqueNamesFlag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .278
GetPropertyDesc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .278
GetPropertyDescColl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279
GetRelationshipDescColl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279
GetAbstractClassFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279
SetAbstractClassFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
GetDescriptionRequired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
SetDescriptionRequired . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .280
GetSuperClasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
SetSuperClasses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
GetSubClasses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
GetDerivedClassFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
SetDerivedClassFlag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
GetBaseClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
SetBaseClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
GetVersioningSupport. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .282
SetClassDescVersioningFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283
WriteObject/WriteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .284
CMetaPropertyDesc Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285
CMetaPropertyDesc Class Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285
CMetaPropertyDesc Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .285
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286
GetCharacterSetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286
SetCharacterSetName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286
GetPropertyLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286
SetPropertyLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287
GetPropType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287
SetPropType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287
GetRelPropID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287
SetRelPropID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288
GetTotalDigits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288
SetTotalDigits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288
GetVarType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289
SetVarType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289
GetDerivedPropertyFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289
SetDerivedPropertyFlag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .289
GetBasePropertyName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290
SetBasePropertyName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290
GetRelationshipsToProperty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290
SetRelationshipsToProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .290
GetIsRequired. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291
WriteObject/WriteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291
ReadObject/ReadVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291

18

Teradata Meta Data Services Programmer Guide

Table of Contents

CMetaRelationshipDesc Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaRelationshipDesc Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaRelationshipDesc Constructors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetPropagateDeleteFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetUniqueNamesFlag. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetDestClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetOrigClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetDestClassID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetOriginClassID. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetPropagateDeleteFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetUniqueNamesFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WriteObject/WriteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadObject/ReadVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

292
292
292
293
293
293
294
294
294
294
294
295
295
296

Chapter 13:
Security Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
CMetaApplicationGroup Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaApplicationGroup Class Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaApplicationGroup Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AddUserToApplicationGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateApplicationGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
GetUserCollection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RemoveUserFromApplicationGroup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadObject / ReadVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WriteObject / WriteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

297
297
298
298
298
299
299
299
299
300

CMetaUser Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaUser Class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CMetaUser Constructors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Initialize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateUser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CreateSuperuser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SetPassword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ChangePassword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
IsSuperUser. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
ReadObject / ReadVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
WriteObject / WriteVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

300
300
300
300
301
301
302
302
302
303
303

CMetaSecurityProfileEntry Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303


Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

Teradata Meta Data Services Programmer Guide

19

Table of Contents

Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .303
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304
CMetaSecurityProfile Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305
CMetaSecurityProfile Class Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305
GetObjectsUsingSecurityProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305
GetPermissionList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306
PrintCMetaSecurityProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306
RemoveManyPermissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306
RemovePermission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .306
ReplacePermissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307
SetAIMSecurityProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .307
SetClassSecurityProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308
SetObjectSecurityProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308
SetSecurityProfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309
UpdateManyPermissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310
UpdatePermission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .310
ReadObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .311
WriteObject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .311

Chapter 14:
MetaCOMExport Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
Library and Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
ColumnFilter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
Objects and Collections Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
MetaActive Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .314
Common Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .357
MetaInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .361
MetaInfoKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .364
MetaVersionedInfoKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .365
MetaPropertyItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .366
MetaDIMInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .369
MetaFilter Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .371
MetaHelper Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374
MetaBIZInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .374
MetaInfoClassKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .376
MetaVersionedInfoClassKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
MetaLabelInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .377
MetaLabelInfoKey Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .380
AIM Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381
MetaPropertyInfo Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .381

20

Teradata Meta Data Services Programmer Guide

Table of Contents

MetaClassInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388


MetaRelationshipInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
MetaModelInfo Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
User, Group, and Security Profile Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MetaUserInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MetaGroupInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MetaSecProfInfo Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MetaSecProfEntry Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

400
400
402
404
407

COM Collection Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409


Example Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Differences in Visual Basic and C++ Calling Conventions . . . . . . . . . . . . . . . . . . . . . . .
Example VB Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example C++ Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

412
412
412
420

Chapter 15:
MetaXML Scripting Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
XML Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scripting Interface Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Structure of XML Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
MDS DTD/Schema Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

427
429
430
431
456

XML Example Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457


XML Example File AutoWorldDesc.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
XML Sample File AutoWorldObjects.xml. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457

Chapter 16:
Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
MDS Error Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Transaction Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
Gateway Socket Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
XML Scripting Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Gateway Communications Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483

Teradata Meta Data Services Programmer Guide

21

Table of Contents

Chapter 17:
Steps for Using the MDS APIs and Example Code . . . . . . . . . . . . .485
C++ Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .485
Creating an Application to Load Your Meta Data Model . . . . . . . . . . . . . . . . . . . . . . . . .486
Creating, Reading and Modifying Objects and Collections . . . . . . . . . . . . . . . . . . . . . . . .487
Adding Objects to Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .489
Reading and Displaying Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .491
Getting Properties of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .492
Getting Collections of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .493
Getting Collections of Object Keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .496
Getting All Objects or Object Keys of a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .497
Updating Existing Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .499
Removing Objects from Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .500
Replacing Objects in Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .502
Deleting Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .504
Visual Basic Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .504
Initialization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .505
Creating an AIM. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .505
Writing MDS Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .506
Adding Many Objects to a Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .507
Getting Objects in a Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .507
Getting Objects of a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .509
Replacing/Removing Objects from a Collection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .511
Reading an Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .511

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .513

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .519

22

Teradata Meta Data Services Programmer Guide

List of Figures

Figure 1: AIM Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33


Figure 2: Relationship/Collection Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Figure 3: Class Inheritance of Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Figure 4: Class Inheritance of Relationships. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Figure 5: Abstract Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Figure 6: Derived Class Sample Metamodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Figure 7: Derived Related Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Figure 8: Hierarchical Path of Related Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Figure 9: Related Classes That Cannot Be Used in Same Derived Class . . . . . . . . . . . . . . . . . 39
Figure 10: Database Information Metamodel (DIM) (Sheet 1 of 2) . . . . . . . . . . . . . . . . . . . . 40
Figure 11: Database Information Metamodel (DIM) (Sheet 2 of 2) . . . . . . . . . . . . . . . . . . . . 41
Figure 12: User Extended DIM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Figure 13: New ColumnSource Objects and Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Figure 14: Client Load Metamodel (CLM). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Figure 15: CWM_Metamodel layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Figure 16: Delete Propagation Example 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Figure 17: Delete Propagation Example 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Figure 18: Delete Propagation Example 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Figure 19: Application Group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Figure 20: Security Profile Example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Figure 21: Security Profiles Example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Figure 22: Security Profile Defaults . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
Figure 23: Class Inheritance and Collections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Figure 24: ReplaceOrigCollection Function Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Figure 25: ReplaceDestCollection Function Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Figure 26: Propagate Permissions from Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Figure 27: Meta Data Model Used for Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485

Teradata Meta Data Services Programmer Guide

23

List of Figures

24

Teradata Meta Data Services Programmer Guide

List of Tables

Table 1: C++ API Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28


Table 2: COM Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 3: Classes and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Table 4: DIM Class Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Table 5: Database System Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Table 6: Database Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Table 7: Table Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Table 8: Column Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Table 9: View Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Table 10: View Column Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Table 11: Index Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Table 12: IndexColumn Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Table 13: Check Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Table 14: Reference Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Table 15: ReferenceColumn Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Table 16: Node Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Table 17: StoredProcedure Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Table 18: SPParameter Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Table 19: Trigger Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Table 20: Macros Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Table 21: MacroParameter Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Table 22: JoinIndex Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Table 23: HashIndex Properties. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Table 24: SubjectArea Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Table 25: BusinessEntity Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Table 26: BusinessAttribute Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Table 27: BusinessRule Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Table 28: ValidValues Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Table 29: MetaLoadTypeClass Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Table 30: Function Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Table 31: Constant Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Table 32: UDT Class Property Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

Teradata Meta Data Services Programmer Guide

25

List of Tables

Table 33: UDTAttribute Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64


Table 34: FunctionParameter Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . .64
Table 35: DIM Relationship Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
Table 36: Script Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
Table 37: Source Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
Table 38: SourceField Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
Table 39: Target Class Property Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .75
Table 40: CLM Relationship Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76
Table 41: Common Property Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
Table 42: Access Type Descriptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
Table 43: Special Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98
Table 44: Supported Teradata Functions to Set the Value of a Property. . . . . . . . . . . . . . . . .103
Table 45: CMetaObject class functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .131
Table 46: GetClassObjectRange Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .176
Table 47: GetClassObjectVersionsRange Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .178
Table 48: metaxml Export Input Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .429
Table 49: MDS Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .459
Table 50: Transaction-Specific Errors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .480
Table 51: Gateway Socket Error Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .481
Table 52: XML Scripting Error Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .483
Table 53: Gateway Communications Error Codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .483

26

Teradata Meta Data Services Programmer Guide

CHAPTER 1

Overview

This chapter gives an overview of the interfaces to Meta Data Services. Included is the
following information:

Types of Interfaces

C++ API Classes

COM Libraries

Java Class Library

XML Utility

COM Interfaces Referenced by MetaSurf

Types of Interfaces
MDS provides a set of object-oriented Application Programming Interfaces (APIs) that can be
used to:

Create application information metamodels (AIMs).


AIMs define how meta data is stored in the MDS repository and are described in detail in
Chapter 2: Application Information Metamodels (AIMs).

Add, update and delete meta data objects and collections in the MDS repository.

The interfaces provided are:

C++ API Classes


The set of C++ API classes that can be used in Microsoft Visual C++ 6.0 and with the
Linux C++ compiler.

COM Libraries
The COM Libraries that can be used in Microsoft Visual Basic 6.0, VBScript, Visual C++
6.0.

Java Class Library

XML Utility

C++ API Classes


MDS provides a C++ class library to access the MDS repository. The MDS repository is a set
of tables within a Teradata Database specifically designed to manage meta data, and is created
for you when you run the "Create MDS Repository" function after installing the MDS
software. The C++ class library allows users to programmatically create application
Teradata Meta Data Services Programmer Guide

27

Chapter 1: Overview
Types of Interfaces

information metamodels (AIMs) to update and delete meta data objects, and to access
collections of objects in the repository.
The following is a summary of the C++ classes available in the library. These APIs are
described in detail in this document.
Table 1: C++ API Classes

Type

Class Name

Functions

Create and Maintain Objects and


Collections

CMetaRepository Class

Connect to MDS
Manage transactions
Get object identifiers

CMetaObject Class

Create
Read
Maintain
user-defined objects and collections

CMetaProperty Class

get and set attributes of objects

CMetaFilterInfo Class

sets the search attributes of the filter for use in


these functions:

Create and Maintain AIMs

Create and Maintain Users,


Application Groups and
SecurityProfiles

28

GetClassObjectsByProperty
GetClassObjectRange
GetDestCollectionByProperty
GetOrigCollectionByProperty

ObjectKey Classes

Get and set object keys

CMetaAIM Class

Create and manage AIMs


Create Class Description, Derived Class and
Relationship Description objects

CMetaClassDesc Class

Manage class descriptions


Create Property Description and Derived
Property objects

CMetaPropertyDesc Class

Manage class property descriptions

CMetaRelationshipDesc Class

Manage relationship descriptions

CMetaApplicationGroup Class

Define groups of users who have access to objects


in the MDS repository

CMetaUser Class

Create users
Change passwords

CMetaSecurityProfile Class

Manage security profiles

CMetaSecurityProfileEntry
Class

Get and set permissions in security profiles

CMetaLabel Class

Define labels and apply to objects in the


repository.

Teradata Meta Data Services Programmer Guide

Chapter 1: Overview
Types of Interfaces

COM Libraries
The C++ class library provides access to the repository only for C++ programs. The COM
libraries supplement the C++ classes by providing access to the repository using Visual Basic,
J++, and scripting languages such as VBScript and JScript.
The following is a summary of the COM classes available in the MetaCOM library. These
interfaces are described in detail in Chapter 14: MetaCOMExport Library.
Table 2: COM Classes

Type

Class Name

Functions

Create and Maintain Objects and


Collections

MetaActive Class

MetaInfo Class

Get and set the properties of objects

MetaPropertyItem Class

Get and set the value of a property

MetaFilter Class

Set the search attributes of the filter for use in


these functions:

Connect to MDS
Manage transactions
Get object identifiers
Create, read and maintain user-defined
objects and collections

GetClassObjectsByProperty
GetClassObjectsByRange
GetCollectionsByProperty

Managing Collection Lists

MetaInfoKey Class

Get and set object keys

MetaDIMInfo Class

Get the values of the DIM common properties


when reading DIM objects

MetaHelper Class

API assist functions

MetaInfoList

Manage a list of IMetaInfo objects

MetaInfoKeyList

Manage a list of IMetaInfoKey objects

MetaPropertyItemList

Manage a list of IMetaPropertyItem objects

MetaFilterList

Manage a list of IMetaFilter objects

MetaPropertyInfoList

Manage a list of IMetaPropertyInfo objects

MetaRelationshipInfoList

Manage a list of IMetaRelationshipInfo objects

MetaClassInfoList

Manage a list of IMetaClassInfo objects

MetaModelInfoList

Manage a list of IMetaModelInfo objects

MetaUserInfoList

Manage a list of IMetaUserInfo objects

MetaGroupInfoList

Manage a list of IMetaGroupInfo objects

MetaSecProfInfoList

Manage a list of IMetaSecProInfo objects

Teradata Meta Data Services Programmer Guide

29

Chapter 1: Overview
Types of Interfaces
Table 2: COM Classes (continued)

Type

Class Name

Functions

Create and Maintain AIMs

MetaModelInfo Class

Create and manage AIMs


Create IMetaUserInfo and
IMetaRelationshipInfo objects

MetaClassInfo Class

Manage used descriptions


Create IMetaPropertyInfo objects associated
with the class

MetaPropertyInfo Class

Manage property descriptions

MetaRelationshipInfo Class

Manage relationship descriptions

MetaGroupInfo Class

Define groups of users who have access to objects


in the MDS repository.

MetaUserInfo Class

Create users
Change passwords

MetaSecProfInfo Class

Manage security profiles

Create and Maintain Users, Application


Groups, and Security Profiles

Java Class Library


The Java class library is contained in three separate packages, housed in the MetaJava.jar file,
in the %METAHOME%\jdk directory. These packages are:

com.teradata.mds

com.teradata.mds.metamodel

com.teradata.mds.security

A summary of the packages and their classes is shown in Table 3. Full documentation can be
found in the %METAHOME%\jdk\docs directory.
Table 3: Classes and Functions

30

Package

Class Name

Function

com.teradata.mds

MetaRepository

Initialize/deinitialize, logon/logoff

MetaDataObject

Create/read/write/delete meta data


objects

MetaVersionedObject

Read/write/delete of specific object


versions

MetaClassInfo

Search classes for meta data

MetaObjectCollections

Search/manage collections of meta data

Teradata Meta Data Services Programmer Guide

Chapter 1: Overview
COM Interfaces Referenced by MetaSurf
Table 3: Classes and Functions (continued)

Package

Class Name

Function

com.teradata.mds.metamodel

MetaModelAIM

Manage meta model AIM objects

MetaModelClass

Manage meta model Class objects

MetaModelProperty

Manage meta model Class-Property


objects

MetaModelRelationship

Manage meta model Relationship


objects

MetaLabel

Manage meta model Label objects

MetaGroup

Manage MDS Group objects

MetaUser

Manage MDS User objects

MetaSecurityProfile

Manage MDS Security Profile object

com.teradata.mds.security

XML Utility
The MDS Extensible Markup Language (XML) interface provides a simple and powerful
syntax for defining, describing and exchanging complex structured data. The XML design
used by MDS is meant to be simple and easy to use.
See Chapter 15: MetaXML Scripting Interface, for detailed information and examples for
using the XML scripting interface.

COM Interfaces Referenced by MetaSurf


MetaSurf is the Teradata MDS web application that provides access to the MDS repository
from a standard web browser. It allows searching and drill-down in the repository.
MetaSurf is based on Microsofts Active Server Pages (ASP). ASP is a framework for
dynamically creating web pages using a combination of server-side scripts and/or COM
components along with HTML.
Metacomexport21.dll is the library that provides the Teradata MDS COM interface support,
and it runs as an in-process component in IIS. The Teradata MDS COM interface supports the
Visual Basic scripting interfaces. The type library definition describing the objects and types
supported is built-in to the library itself.
MetaSurf uses the Teradata MDS COM interface to access the MDS repository.
Therefore, Microsofts Internet Information Services 5.0 or greater or other Web server that
supports ASP and custom COM components is required in order to run MetaSurf.
MetaSurf references the following Teradata MDS COM classes.

MetaActive

MetaBIZInfo

Teradata Meta Data Services Programmer Guide

31

Chapter 1: Overview
COM Interfaces Referenced by MetaSurf

MetaBIZInfoList

MetaClassInfo

MetaDIMInfo

MetaFilter

MetaFilterList

MetaHelper

MetaInfo

MetaInfoList

MetaInfoKey

MetaInfoKeyList

MetaLabelInfo

MetaPropertyItem

MetaPropertyItemList

For additional information on the COM interfaces and associated functions, refer to the
appropriate chapters.
For information about installing MetaSurf, refer to Teradata Tools and Utilities Installation
Guide for Microsoft Windows

32

Teradata Meta Data Services Programmer Guide

CHAPTER 2

Application Information Metamodels


(AIMs)

This chapter discusses application information metamodels (AIMs). Included is the following
information:

Overview of Application Information Metamodels (AIMs)

Derived Classes

Database Information Metamodel (DIM)

Extending the Database Information Metamodel (DIM)

Client Load Metamodel (CLM)

Overview of Application Information


Metamodels (AIMs)
An application information metamodel defines how a set of meta data is stored in the MDS
repository.
An application can create its own metamodel or build upon a metamodel provided with Meta
Data Services. A sample metamodel is represented in Figure 1.
Figure 1: AIM Example

AutoCorporation
Has
AutoDivision

ClassDescription
RelationshipDescription
ClassDescription
3047B050

AIM Components
An AIM consists of the following components:

Class descriptions define a type of meta data in the repository.


A class description is similar to a class in the C++ programming language.
In the sample metamodel shown in Figure 1, AutoCorporation and AutoDivision are
examples of class descriptions.

Teradata Meta Data Services Programmer Guide

33

Chapter 2: Application Information Metamodels (AIMs)


Overview of Application Information Metamodels (AIMs)

An instance of a class description in the repository is called a class object or object. Big Guy
Motors is an AutoCorporation object and American Autos is an AutoDivision object.

Property descriptions are the data fields associated with class descriptions.
The Auto class description might contain properties such as weight, base price, fuel tank,
and other options.

Relationship descriptions create an association between two class descriptions.


In Figure 2, relationship descriptions are defined as DivisionMakesAutos and
DivisionMakesSUVs. These relationship descriptions enable linking AutoDivision
objects with specific Auto and SUV objects.
In Figure 2, these relationship descriptions are used to associate the AutoDivision object
American Autos with the Auto objects Tortoise and Yearling and to the SUV objects Hawk
and Vulture.
Relationship descriptions have the following characteristics:

Each relationship description relates two class descriptions.

An instance of a relationship description in the MDS repository creates a persistent


association between two objects and is called a relationship.

A collection is a set of objects that have relationships to the same object (called the
source object).

In a relationship description, one class description is defined as the origin and the
other the destination.

Figure 2 shows examples of relationships and collections.


Figure 2: Relationship/Collection Example
AutoDivision

ClassDescription
RelationshipDescription:
DivisionMakesSUVs

RelationshipDescription:
DivisionMakesAutos

Auto

SUVs

ClassDescriptions

American Autos

Collection of
autos
manufactured
by
American Autos

Relationship
between American
Autos and Yearling

Tortoise

Yearling

3047B019

American Autos

Relationship
between American Autos
and Hawk

Vulture

Hawk

Collection of
SUVs
manufactured
by
American Autos
3047B051

AIMs are extensible. Class descriptions and relationship descriptions can be added or deleted
from existing AIMs and property descriptions can be added or deleted from existing class
descriptions.

34

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Inheritance

Inheritance
Inheritance is a feature that allows creation of a class that inherits the properties and
relationships from a previously defined class. A class that inherits from another class is called a
subclass. The class that the subclass inherits from is called the superclass.
A subclass will contain all the properties of the class(es) it inherits from. In Figure 3:

Class A has properties A and B.

Class G inherits from Class A.

Class G also has the properties A and B and any properties specifically created for Class G,
for example, properties C and D.

Class M is created from Class G and inherits all the properties of Class G, and also includes
the properties of Class A.

A class can only inherit directly from one class, but the class it inherits from can have up to
four superclasses. So a class can have up to five superclasses: the class it directly inherits and
the superclasses of that class.
Figure 3: Class Inheritance of Properties
ClassA Properties
ClassA

G Inherits
From A

ClassG Properties
ClassG

M Inherits
From G

ClassM Properties
ClassM

F
3047B001

A class also inherits all the relationships of its superclasses.

Teradata Meta Data Services Programmer Guide

35

Chapter 2: Application Information Metamodels (AIMs)


Abstract Class

Figure 4 shows a relationship called RelAM that has the origin class of ClassA and the
destination class of ClassM. All classes that inherit from ClassA and ClassM also inherit this
relationship. This means that ClassB and ClassC objects can be origin objects in this
relationship and ClassN and ClassO objects can be destination objects. As shown in Figure 4,
you can add a ClassM, ClassN or ClassO object to the destination collection of a ClassA,
ClassB or ClassC object.
Figure 4: Class Inheritance of Relationships
Relationship: RelAM
Origin Class: ClassA
DestClass: ClassM

ClassA

B Inherits
From A

ClassM

N Inherits
From M
ClassB

ClassN

C Inherits
From B

O Inherits
From N
ClassC

ClassO
3047B002

Abstract Class
An abstract class is a class that can not have object instances. An abstract class can have
properties and can be the source or destination class in relationships. An abstract class is
created to enable subclasses of the class to inherit the properties and relationships of the
abstract class. Figure 5 shows an example.
Figure 5: Abstract Class
'DWDEDVH

UHODWLRQVKLS

'DWDEDVH+DV7902EMHFWV

VXSHUFODVV

7902EMHFW DEVWUDFW

7DEOH

9LHZ

7ULJJHU

0DFUR

VXEFODVVHV
&

If a class is defined as an abstract class, the MDS engine will not allow creating objects of that
class type.

36

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Derived Classes

Derived Classes
A derived class is similar to a view in a Teradata Database. It allows you to create a logical class
using properties that exist in already defined classes.
To understand the value provided by a derived class, look at the metamodel defined in
Figure 6.
Figure 6: Derived Class Sample Metamodel
class : subjectarea

subjectarea name

class : view

class : view column


view column name

view name

DBID

DB name
view description
view requesttext

view ID
data text
character set

Relation :subjectareahasview
column description
Relation :viewhasview column
3047A006

Using the metamodel in Figure 6, you can get a collection of ViewColumn objects with a name
beginning with customer using one API call.
What if you also want your search for ViewColumn with a name beginning with customer
to get the names of the subjectarea and view associated with each ViewColumn object? How
can you perform this task with a single API call?
The solution is to create a derived class. A derived class creates a pseudo class that contains the
properties of a base class plus properties of related classes. A read of a derived class object will
return all properties (base and derived) and searches can be performed on all of the properties
of the derived class.

Creating a Derived Class


To create the derived class that will allow you to return the subjectarea and view associated
with each ViewColumn object:
1

Create a derived class with the base class of ViewColumn.

Create a derived property called ViewName (which is the name property of the view class)
and add it to the newly created derived class.

Create a derived property called SubjectAreaName (which is the name property of the
subjectarea class) and add it to the newly created derived class.

Teradata Meta Data Services Programmer Guide

37

Chapter 2: Application Information Metamodels (AIMs)


Derived Classes

To the APIs, the derived class will look like a class containing all the properties of the
ViewColumn class plus the SubjectAreaName and ViewName properties. A search can be
performed on one or more of these properties. The SubjectAreaName and ViewName are
returned in the property list in each of the objects in the return list.
There are no physical objects in a derived class. Derived class objects are created by joining
properties in a base class with properties in related classes. Therefore derived class objects are
read only. You cannot write or delete a derived class object.

Derived Classes and Properties


A derived class is defined as a base class and a set of derived properties. Derived properties are
properties in classes that have relationships to the base class. The derived class contains all the
properties of the base class.
The derived property must be able to be retrieved by following a relationship or set of
relationships from the base class.
Figure 7: Derived Related Classes
Database
DatabaseHasTables
Table
TableHasColumns
Column

3047A018

In the above metamodel from a Column object, the name of the related table can be found by
getting the origin object using the TableHasColumns relationship.
The name of the related database can be found by getting the origin object of the table using
the DatabaseHasTables object. Since these properties can be retrieved through relationships to
the Column class, they can be defined as derived properties of a derived class with the base
class of the Column class.

Derived Class Benefits/Limitations


Derived classes have the following benefits:

38

Derived classes can be used in the following CMetaObject functions: ReadObject,


GetClassObjects, and GetClassObjectsByProperty.

The objects returned will contain all the properties of the base class plus the derived
properties.

Searches and sorts can be specified on the derived properties and the base properties of the
derived class.

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)

Derived classes have the following limitations:

A derived property can be a maximum of six relationships from the base class.

A derived class is read only.

Derived classes are not supported using the GetCollection functions.

If multiple derived properties are defined for a derived class, their relationships must all be on
the same hierarchical path. For example, as shown in Figure 8, a derived class with a base class
of Column could contain derived properties from the DBSystem, Database, and Table classes.
Figure 8: Hierarchical Path of Related Classes
DBSystem
SystemHasDatabases
Database
DatabaseHasTables
Table
TableHasColumns
Column

3047A017

An example of what is not permitted is shown in Figure 9.


Figure 9: Related Classes That Cannot Be Used in Same Derived Class
View

Table

ViewHasTableColumns

TableHasColumns
Column
3047A016

A derived class with a base class of Column cannot contain derived properties from both the
View and Table classes.

Database Information Metamodel (DIM)


The Database Information Metamodel (DIM) provides the base model in which to store
Teradata Database Systems meta data in the MDS repository.
When other applications in Teradata reference the meta data in the DIM instead of
maintaining identical meta data, it reduces meta data redundancy and the number of places
that a change must be made.

Teradata Meta Data Services Programmer Guide

39

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)

Extending the DIM with relationships to the database meta data allows MDS to maintain the
integrity of Teradatas meta data.
The DIM is represented in Figure 10 and Figure 11. Table 4 on page 41 and Table 35 on
page 65 contain descriptions of the DIM classes and relationships respectively.
Figure 10: Database Information Metamodel (DIM) (Sheet 1 of 2)


'DWDEDVH6\VWHP

6 X E MH F W$

UH D

1RGH



0 H WD



'DWDEDVH



/RDG7
\SH

( Q WL
% X VL Q H VV

% X VL Q H VV



W\



5 X OH



7U LJ J
H






H
9D OL G 9D OX



0DFU

R 3D U D

P H WH



U








% X V LQ H V

V $ WW UL EX

0DFU

WH















9 LH Z & R OX






6 3 3D UD P



7D E OH





PQ













& R OX P



9 LH Z





5 H IH U

HQFH



H WH U

&KHF









5 H IH U

HQFH&

R OX P Q



UR F H G
6 WR UH G 3

X UH

- R LQ ,Q G H



,Q G H[











& R Q V WD Q

H[
+ D V K ,Q G




,Q G H[



& R OX P



W
(

40

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Figure 11: Database Information Metamodel (DIM) (Sheet 2 of 2)
Database
StoredProcedure
68

Macro
76

JoinIndex

75
74

View
84

Function
80
69

78

82

FunctionParameter

65

83
81

67

70

Column

UDT
66

MacroParameter

72

79

UDTAttribute
SPParameter

73

Trigger

77

ViewColumn

71
3047A060

DIM Classes
The Global Unique Identifiers for the DIM Class Descriptions and Relationship Descriptions
are defined in the header file dbaim.h. This file also contains the constants for the DIM
Property Names and Relative Property IDs.
A Teradata Database system is initially loaded into the MDS repository using the metaload
program. Meta data objects loaded into the DIM are referred to as DIM objects and are
readable by any MDS User with the appropriate read permission.
The information needed to read the values of the properties of objects in the DIM classes is
contained in the following tables.
Table 4: DIM Class Descriptions

Class Name

Description

BusinessAttribute

A Business Attribute is a characteristic of a Business Entity. This


commonly represents a logical column.

BusinessEntity

A Business Entity represents a set of objects that have common


characteristics. This commonly represents a logical table.

Teradata Meta Data Services Programmer Guide

41

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 4: DIM Class Descriptions (continued)

42

Class Name

Description

BusinessRule

A Business Rule defines any restrictions on what values can be


stored in a column.

Check

A check constraint on a Teradata table

Class Function

A Teradata built-in function or a User Defined Function

Column

A column of a Teradata table

Constant

A constant value

Database

Teradata Database

DatabaseSystem

Identifies a Teradata Database System.

FKReference

A derived class to track foreign key reference information

Function

A Teradata built-in function or a User-Defined Function

FunctionParameter

A parameter of a UDF

HashIndex

A Teradata hash index

Index

An index of a Teradata table

IndexColumn

A column of an index

JoinIndex

A Teradata join index

Macro

A Teradata macro

MacroParameter

A parameter of a Teradata macro

MetaLoadType

Defines the types of data (tables, views, etc.) to be loaded and


tracked in the repository

Node

A node of a Teradata system.

Reference

A reference constraint on a Teradata table

ReferenceColumn

A column of a reference constraint

SPParameter

The parameter of a Teradata stored procedure

StoredProcedure

A Teradata stored procedure

SubjectArea

A subject area is a set of data organized to reflect a specific area


of business.

Table

Teradata table

Trigger

A Teradata trigger

UDT

A user-defined type

UDTAttribute

An attribute of a UDT

ValidValue

The Valid Value defines the possible values associated with a


Business Rule.

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 4: DIM Class Descriptions (continued)

Class Name

Description

View

A Teradata view

ViewColumn

A column of a Teradata view

DIM Property Descriptions


Property Names and Relative Property IDs are defined in dbaim.h.
Table 5: Database System Class Property Descriptions

Property Name

Description

Property ID

Type

Size

MetaloadDate

Date the last time metaload was run. This


field is set by the metaload utility
(command line or as called by the
MetaManager) each time the utility is
run.

PID_SYSTEM_
METALOADDATE

String

20

LoadFlag

Flag indicating type of metaload

PID_SYSTEM_ LOADFLAG

Short

PID_SYSTEM_
MLUSERLOGIN

String

0 = not loaded
1 = all databases loaded
2 = specific databases loaded
3 = specific databases excluded
Set by the metaload utility (command
line or as called by the MetaManager). If
no databases are specified on the initial
load or during a resync, the flag is set to 1
(All). This indicates that the Automatic
DIM Update Gateway is to maintain
updates on all databases in the system.
If databases are specified on the initial
system load, the flag is set to 2 (specific
databases).
If databases are excluded on a system
load, the flag is set to 3 (excluded
databases). This indicates that the
Automatic DIM Update Gateway is to
maintain updates on only the databases
that have been loaded into the MDS
repository.
If the flag is set to 1 (All) and metaload is
run to resync a specific database or
databases, the flag is not changed.
MetaloadUserLogin

Teradata user name for the metaload


utility and the MDS DDL Gateway to use
to logon to this Teradata Database
Systems.

Teradata Meta Data Services Programmer Guide

128

43

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 5: Database System Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

MetaloadUserPwd

Password for the MLUserName

PID_SYSTEM_
MLUSERPWD

Binary

64

MetaloadSystemDSN

ODBC DSN that connects to this system

PID_SYSYSTEM_
MLSYSDSN

String

30

RecoveryDatabase

Name of the database containing the


MDS Recovery Table

PID_SYSTEM_
RECOVERYDB

String

128

RecoveryTableName

Name of the MDS Recovery Table. If the PID_SYSTEM_


RECOVERYTABLE
MDS DDL Gateway is down, Teradata
will write the names of databases in which
DDL occurs to this table. When the MDS
DDL Gateway restarts, if the
RecoverOnStartup option has been set,
the MDS DDL Gateway will
resynchronize all of the databases whose
names are stored in this table. Then the
names will be deleted from this table.

String

128

DIMUpdatesEnabled

Indicates if the MDS DDL Gateway is to


track changes made to this Teradata
system. This is done to keep the MDS
repository in sync with the Teradata meta
data.

PID_SYSTEM_
DIMUPDENABLED

String

Y = yes N = no
RecoveryDays

Indicates which days of the week for the


MDS DDL Gateway to perform recovery

PID_SYSTEM_
RECOVERYDAYS

Integer

RecoveryTime

Indicates the time for the MDS DDL


Gateway to perform recovery

PID_SYSTEM_
RECOVERYTIME

Double

RecoverOnStartup

Indicates to the MDS DDL Gateway to


perform recovery when the Gateway is
started.

PID_SYSTEM_ RECOVER
ONSTARTUP

Short

RDBMSType

Text containing the RDBMS type such as


"Teradata"

PID_SYSTEM_RDBMSTYPE

String

SecurityPropagation
Type

Indicates the default Security Profile to


assign to new objects that are loaded. If
set to 0, the security profile assigned to
the database object will be used. If set to
1, the security profile assigned to the class
will be used.

PID_SYSTEM_SECURITYPR Short
OPTYPE

44

30

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)

Table 6: Database Class Property Descriptions

Property Name

Description

Property ID

Type

Size

CommentString

The comment stored in Teradata for this


database

PID_DATABASE_
COMMENT

String

255

CreatorName

The Teradata user that issued the CREATE


DATABASE/USER

PID_DATABASE_CREATOR
NAME

String

128

DatabaseId

Teradata assigned identifier for this


database

PID_DATABASE_
DATABASEID

Binary

DatabaseType

Teradata Database types:

PID_DATABASE_TYPE

String

PID_DATABASE_
SYNCLEVEL

Short

U = the object is a Teradata User


D = the object is a Teradata Database
When data is loaded using the Meta
Integration Model Bridges (MIMB), you
may see the following values:
A = the object is an MS Access database
B = the object is a DB2 database
I = the object is an Informix database
M = the object is an SQLServer database
O = the object is an Oracle database
R = the object is a Redbrick database
S = the object is a Sybase database
T = the object is a Teradata Database
SynchronizationLevel

Internal flag indicating the completeness


of loading objects in the database. the
possible values are:
-1 = some objects in the database do
not have their relationships to other
objects fully defined
0 = all objects in the database are
successfully defined but the owning
database is not known
1 = all objects in the database are
successfully defined and the owning
database is known

Table 7: Table Class Property Descriptions

Property Name

Description

Property ID

Type

Size

CommentString

The comment stored in Teradata for


this table

PID_TABLE_ COMMENT

String

255

CreatorName

The Teradata user that issued the


CREATE TABLE

PID_TABLE_CREATORNAME

String

128

DatabaseId

Teradata assigned identifier for the


database where this table resides

PID_TABLE_ DATABASEID

Binary

Teradata Meta Data Services Programmer Guide

45

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 7: Table Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

IsErrorTable

Indicates if the table is an error table


for another table.

PID_TABLE_ISERRORTABLE

String

PID_TABLE_ISGLOBALTEMP
ORARY

String

Possible values are Y=Yes, N=No.


IsGlobalTemporary

Indicates if the table is a global


temporary table rather than a
permanent table.
Possible values are Y=Yes, N=No.

LastAlterTimeStamp

Time that Teradata last updated the


object

PID_TABLE_LASTALTERTIME TimeStamp
STAMP

PrimaryIndexDefined

Indicates if a table has a primary index.


Possible values are Y=Yes, N=No.

PID_TABLE_PRIMARYINDEX
DEFINED

String

Metaload and DIM Update set this


value for each table they process.
SynchronizationLevel

Internal Flag

PID_TABLE_ SYNCLEVEL

Short

TableId

Teradata assigned identifier for this


table

PID_TABLE_ TABLEID

Binary

Version

Version of this table in Teradata. Each


time table is altered, Teradata
increments the version.

PID_TABLE_ VERSION

Short

Table 8: Column Class Property Descriptions

Property Name

Description

Property ID

Type

CharType

Specifies the character set type of


character fields.
Values can be:

PID_COLUMN_ CHARTYPE

Short

1 Latin
2 Unicode
3 KanjiSJIS
4 Graphic
5 Kanji1

ColumnFormat

Display format for the column

PID_COLUMN_
COLUMNFORMAT

String

ColumnId

Teradata assigned identifier for this


column

PID_COLUMN_ COLUMNID

Short

ColumnLength

Maximum size of the column

PID_COLUMN_
COLUMNLENGTH

Integer

46

Size

128

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 8: Column Class Property Descriptions (continued)

Property Name

Description

ColumnTitle

PID_COLUMN_
Heading for displayed or printed
COLUMNTITLE
results that is different from the
column name, which is used by default.

Teradata Meta Data Services Programmer Guide

Property ID

Type

Size

String

256

47

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 8: Column Class Property Descriptions (continued)

Property Name

Description

Property ID

ColumnType

Data type of this column. Values can


be:

PID_COLUMN_ COLUMNTYPE String

48

Type

Size
2

A1 1-dimensional Array
AN n-dimensional Array
AT Time
BF Byte
BO BLOB
BV VarByte
CF Character
CO CLOB
CV VarCharacter
D Decimal
DA Date
DH Day To Hour
DM Day To Minute
DS Day To Second
DY Day
F Float
HM Hour To Minute
HR Hour
HS Hour To Second
I Integer
I1 ByteInt
I2 SmallInt
I8 BigInt
MI Minute
MO Month
MS Minute To Second
N Number
PD Period Date
PM Period Timestamp with Time
Zone
PS Period Timestamp
PT Period Time
PZ Period Time with Time Zone
SC Second
SZ Timestamp with Time Zone
TS Timestamp
TZ ANSI Time with Time Zone
UT User-defined Type
M Year To Month
YR Year

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 8: Column Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

CommentString

Comment stored in Teradata for this


column

PID_COLUMN_ COMMENT

String

255

Compressible

Indicates if the column is to be


compressed. If yes, the column will be
compressed to zero space if the data
value of the column is equal to the
CompressValue

PID_COLUMN_
COMPRESSIBLE

String

C = compress
N = do not compress
CompressValue

If NULL is specified, NULLs are


compressed. If constant specified,
NULLS and the value are compressed

PID_COLUMN_
COMPRESSVALUE

String

8192

DatabaseID

Teradata assigned identifier for the


database where this column resides

PID_COLUMN_ DATABASEID

Binary

DecimalFractDigits

Number of digits in the decimal


portion of DECIMAL and NUMERIC
columns.

PID_COLUMN_ DECIMAL
FRACTDIGITS

Short

DecimalTotalDigits

Total number of digits for data types of


DECIMAL and NUMERIC.

PID_COLUMN_ DECIMAL
TOTALDIGITS

Short

DefaultValue

Default value specified for this column

PID_COLUMN_
DEFAULTVALUE

String

1024

IDColType

If this is an identity column, this field


contains the parameters defined for the
identity column.

PID_COLUMN_IDCOLTYPE

String

164

Nullable

Indicates if NULL is an accepted value


for this column.

PID_COLUMN_NULLABLE

String

Y = acceptable value
N = not acceptable value
TableId

Teradata assigned identifier for the


table where this column resides

PID_COLUMN_ TABLEID

Binary

UppercaseFlag

In columns declared as UPPERCASE,


small-case letters are converted and
stored in their capital-case equivalents

PID_COLUMN_
UPPERCASEFLAG

String

Y = small-case converted
N = small-case not converted

Teradata Meta Data Services Programmer Guide

49

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)

Table 9: View Class Property Descriptions

Property Name

Description

Property ID

Type

Size

CommentString

Comment stored in Teradata


for this view

PID_VIEW_ COMMENT

String

255

CreatorName

The Teradata user that issued


the CREATE/REPLACE VIEW

PID_VIEW_CREATORNAME

String

128

DatabaseID

Teradata assigned identifier for


the database where this view
resides

PID_VIEW_ DATABASEID

Binary

IsRecursive

Indicates if a view is recursive;


that is, it selects from itself.
Values are Y=Yes, N=No.

PID_VIEW_ISRECURSIVE

String

This property is set by metaload


and DIM Update when they
process a view. When an existing
database in the DIM is processed
by metaload, it automatically
reevaluates any view that has a
NULL value for the property

LastAlterTimeStamp

Time that Teradata last updated PID_VIEW_LASTALTER_TIM


the object
ESTAMP

TimeStamp

ReqText

The SQL string used to create


the view

PID_VIEW_ REQTEXT

String

SynchronizationLevel

Internal Flag

PID_VIEW_ SYNCLEVEL

Short

ViewId

Teradata assigned identifier for


this view

PID_VIEW_VIEWID

Binary

12500

Table 10: View Column Class Property Descriptions

Property Name

Description

Property ID

Type

ColumnID

Teradata assigned identifier for this view


column

PID_VIEWCOL_
COLUMNID

Short

ColumnLength

Length of the view column

PID_VIEWCOL_
COLUMNLENGTH

Integer

ColumnType

Data type of this view column

PID_VIEWCOL_
COLUMNTYPE

String

CommentString

Comment stored in Teradata for this view PID_VIEWCOL_


COMMENT

String

255

DatabaseID

Teradata assigned identifier for the


database where this view column resides

Binary

50

PID_VIEWCOL_
DATABASEID

Size

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 10: View Column Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

DecimalFractDigits

For data types of DECIMAL and


NUMERIC this is the number of digits in
the decimal portion of the number

PID_VIEWCOL_
DECIMALFRACTDIGITS

Short

DecimalTotalDigits

For data types of DECIMAL and


NUMERIC this is the total digits in the
view column

PID_VIEWCOL_
DECIMALTOTALDIGITS

Short

Nullable

Identifies whether the view column is


nullable

PID_VIEWCOL_ NULLABLE String

ViewID

Teradata assigned identifier for the view


where this view column resides

PID_VIEWCOL_ VIEWID

Binary

Table 11: Index Class Property Descriptions

Property Name

Description

Property ID

Type

Size

DatabaseID

Teradata assigned identifier for the


database where this index resides

PID_INDEX_ DATABASEID

Binary

IndexNumber

Teradata assigned identifier for this index

PID_INDEX_ NUMBER

Short

IndexType

IndexType field identifies the index type


as:

PID_INDEX_TYPE

String

PID_INDEX_TABLEID

Binary

TableID

P (Primary)
Q (Partitioned Primary Index)
S (Secondary)
J (join index)
M (Multi-Column Statistics)
D (Derived column partition statistics)
N (hash index)
K (primary key)
U (unique constraint)
V (value ordered secondary)
H (hash ordered ALL covering
secondary)
O (valued ordered ALL covering
secondary)
I (ordering column of a composite
secondary index)
1 (field1 column of a join or hash
index)
2 (field2 column of a join or hash
index)

Teradata assigned identifier for the table


where this index is built

Teradata Meta Data Services Programmer Guide

51

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 11: Index Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

UniqueFlag

UniqueFlag field indicates if the index is


unique as Y (unique) or N (non-unique)

PID_INDEX_ UNIQUEFLAG String

Size

Table 12: IndexColumn Class Property Descriptions

Property Name

Description

Property ID

Type

ColumnPosition

Identifies the column position within the


index

PID_INDEXCOL_
COLUMNPOSITION

Short

DatabaseID

Teradata assigned identifier for the


database where this index resides

PID_INDEXCOL_DATABASE Binary
ID

IndexNumber

Teradata assigned identifier for the index

PID_INDEXCOL_INDEXNU
MBER

Short

TableID

Teradata assigned identifier for the table


where this index is built

PID_INDEXCOL_TABLEID

Binary

Table 13: Check Class Property Descriptions

Property Name

Description

Property ID

Type

Size

CheckBool

The check <boolean> string for


this check constraint.

PID_ CHECKCONSTRAINT_
CHECKBOOL

String

8192

ConstraintType

C = Table level check constraint

PID_CHECKCONSTRAINT_TYPE

String

Q = Partitioned primary index


constraint
DatabaseID

Teradata assigned identifier for the PID_ CHECKCONSTRAINT_


database where this check constraint DATABASEID
resides.

Binary

TableID

Teradata assigned identifier for table PID_ CHECKCONSTRAINT_ TABLEID


where this check constraint resides.

Binary

Table 14: Reference Class Property Descriptions

Property Name

Description

Property ID

Type

Size

DatabaseID

Teradata assigned identifier for the


database where this constraint resides

PID_ REFCONSTRAINT_
DATABASEID

Binary

RefDatabase

Database of the reference table

PID_ REFCONSTRAINT_
REFDATABASE

String

128

ReferenceID

Teradata assigned identifier for this


Reference constraint

PID_ REFCONSTRAINT_
REFERENCEID

Short

52

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 14: Reference Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

RefTable

Table the constraint refers to

PID_ REFCONSTRAINT_
REFTABLE

String

128

TableID

Teradata assigned identifier for the table


the constraint is built on.

PID_ REFCONSTRAINT_
TABLEID

Binary

Table 15: ReferenceColumn Class Property Descriptions

Property Name

Description

Property ID

Type

Size

DatabaseID

Teradata assigned identifier for the


database where this constraint resides

PID_REFCOL_DATABASEID

Binary

ForeignKeyColName

Name of the foreign key column

PID_REFCOL_
FOREIGNKEYCOL

String

128

ReferenceColName

Name of the reference column

PID_REFCOL_
REFERENCECOL

String

128

ReferenceID

Teradata assigned identifier for this


Reference constraint

PID_REFCOL_REFERENCEID

Short

TableID

Teradata assigned identifier for the table PID_REFCOL_TABLEID


the constraint is built on.

Binary

Table 16: Node Class Property Descriptions

Property Name

Description

Property ID

Type

Size

NodeStatus

U = node is up.
D = node is unavailable

PID_NODE_NODESTATUS

String

Table 17: StoredProcedure Class Property Descriptions

Property Name

Description

Property ID

Type

Size

CommentString

The comment stored in Teradata


for this Stored Procedure.

PID_SP_COMMENT

String

255

CreatorName

The Teradata user that issued the


CREATE/REPLACE
PROCEDURE

PID_SP_CREATORNAME

String

128

DatabaseID

Teradata assigned identifier for the


database where this Stored
Procedure resides

PID_SP_DATABASEID

Binary

LastAlterTimeStamp

Time that Teradata last updated


the object

PID_SP_LASTALTERTIMESTAMP

TimeStamp

Teradata Meta Data Services Programmer Guide

53

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 17: StoredProcedure Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

ProcedureID

Teradata assigned identifier for


this Stored Procedure

PID_SP_PROCEDUREID

Binary

SPText

Contains Stored Procedure text.

PID_SP_TEXT

String

12500

SynchronizationLevel

Internal Flag

PID_SP_SYNCLEVEL

Short

54

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)

Table 18: SPParameter Class Property Descriptions

Property Name

Description

Property ID

Type

Size

CommentString

The comment stored in Teradata for


this parameter

PID_SPPARAMETER_COMMEN
T

String

255

CreatorName

The Teradata user that issued the


CREATE/REPLACE PROCEDURE

PID_SPPARAMETER_CREATOR
NAME

String

128

DatabaseId

Teradata assigned identifier for the


PID_SPPARAMETER_DATABASEI Binary
database where this Stored Procedure D
resides

ParameterId

Teradata assigned identifier for this


Stored Procedure parameter

PID_SPPARAMETER_PARAMETE Short
RID

ParamLength

Contains the maximum length in


bytes for the value of this parameter

PID_SPPARAMETER_PARAMLE
NGTH

ParamType

Contains the data type of this


parameter

PID_SPPARAMETER_PARAMTYP String
E

ProcedureId

Teradata assigned identifier for this


Stored Procedure

PID_SPPARAMETER_PROCEDU
REID

Binary

RowTypeDatabaseName The name of the database containing


the table referenced by a
%ROWTYPE attribute

PID_SPPARAMETER_ROWTYPE
DBNAME

String

128

RowTypeTableName

The name of the table referenced by a


%ROWTYPE attribute

PID_SPPARAMETER_ROWTYPE
TBLNAME

String

128

SPParamType

Contains information on this


parameters type.

PID_SPPARAMETER_SPPARAMT String
YPE

Integer

"I" = IN
"O" = OUT
"B" = INOUT

Table 19: Trigger Class Property Descriptions

Property Name

Description

Property ID

Type

Size

ActionTime

Action time for the trigger:

PID_TRIGGER_ACTIONTIME

String

A = After the trigger event


B = Before the trigger event
I = Instead of the trigger event
CommentString

The comment stored in Teradata for


the trigger.

PID_TRIGGER_COMMENT

String

255

CreatorName

The Teradata User who issued the


CREATE/REPLACE TRIGGER
statement

PID_TRIGGER_CREATORNAME

String

128

Teradata Meta Data Services Programmer Guide

55

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 19: Trigger Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

DatabaseId

Teradata assigned identifier for the


database where this trigger resides

PID_TRIGGER_DATABASEID

Binary

Event

Type of SQL DML statement that


causes trigger to fire.

PID_TRIGGER_EVENT

String

PID_TRIGGER_ENABLED

String

PID_TRIGGER_KIND

String

D = Delete
I = Insert
U = Update
IsEnabled

Whether the trigger is activated or


not
Y = Enabled
N= Disabled

Kind

Trigger kind as defined by the FOR


EACH clause
R = Row
S = Statement

LastAlterTimeStamp

Time that Teradata last updated the


object

PID_TRIGGER_LASTALTERTIME TimeStamp
STAMP

Ordering Position

When one or more triggers are


defined on the same table, ORDER
allows you to determine the
sequence for firing each trigger.

PID_TRIGGER_ORDER

Short

RequestText

Contains the text that created the


trigger.

PID_TRIGGER_REQUESTTEXT

String

SynchronizationLevel

Internal Flag

PID_TRIGGER_ SYNCLEVEL

Short

TriggerCreateTimeStamp Time that Teradata created the


trigger or the creation timestamp
from the ALTER TRIGGER <name>
TIMESTAMP DDL

PID_TRIGGER_CREATETIMEST
AMP

TimeStamp

TriggerEnableDisable
TimeStamp

Time that the Teradata trigger was


last enabled or disabled

PID_TRIGGER_ENABLEDISABL
ETS

Timestamp

TriggerId

Teradata assigned identifier for this


trigger

PID_TRIGGER_TRIGGERID

Binary

12500

Table 20: Macros Class Property Descriptions

Property Name

Description

Property ID

Type

Size

CommentString

The comment stored in Teradata for


this macro

PID_MACRO_COMMENT

String

255

CreatorName

The Teradata user that issued the


CREATE/REPLACE MACRO

PID_MACRO_CREATORNAME String

128

56

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 20: Macros Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

DatabaseID

Teradata assigned identifier for the


database containing this macro

PID_MACRO_DATABASEID

Binary

LastAlterTimeStamp

Time that Teradata last updated the


macro

PID_MACRO_LASTALTERTIM
ESTAMP

Timestamp

MacroID

Teradata assigned identifier for this


Macro

PID_MACRO_MACROID

Binary

MacroText

Contains the text that created the


macro.

PID_MACRO_TEXT

String

12500

SynchronizationLevel

Internal flag property

PID_MACRO_SYNCLEVEL

Short

Table 21: MacroParameter Class Property Descriptions

Property Name

Description

Property ID

Type

CharType

Specifies the character set type of


character fields.
Values can be:

PID_MACROPARAM_CHARTYPE

Short

CommentString

The comment stored in Teradata for PID_MACROPARAM_COMMENT


this parameter

String

255

DatabaseID

Teradata assigned identifier for the


database containing this macro
property

PID_MACROPARAM_DATABASEID

Binary

DataType

Contains the data type for this


parameter

PID_MACROPARAM_DATATYPE

String

DefaultValue

The value assigned to the parameter


when no value is given in the EXEC
statement

PID_MACROPARAM_DEFAULTVALUE

Character

1024

MacroID

Teradata assigned identifier for this


macro parameter

PID_MACROPARAM_PROCEDUREID

Binary

ParameterID

Teradata assigned identifier for this


macro

PID_MACROPARAM_PARAMETERID

Short

ParamFormat

Display format for the parameter

PID_MACROPARAM_PARAMFORMAT String

ParamLength

Display length for the parameter

PID_MACROPARAM_PARAMLENGTH Integer

Size

1 Latin
2 Unicode
3 KanjiSJIS
4 Graphic
5 Kanji1

Teradata Meta Data Services Programmer Guide

128

57

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 21: MacroParameter Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

ParamTitle

Heading for the displayed or


printed results. Different from the
parameter name which is the
default heading.

PID_MACROPARAM_TITLE

String

256

Table 22: JoinIndex Properties

Property Name

Description

Property ID

Type

Size

CommentString

The comment stored in Teradata for


the join index

PID_JOININDEX_COMMENT

String

255

CreatorName

Name of the Teradata user that


created the join index

PID_JOININDEX_CREATORNAME

String

128

DatabaseID

Teradata assigned identifier for the


PID_JOININDEX_DATABASEID
database where the join index resides

Binary

JoinIndexID

Teradata assigned identifier for the


join index

PID_JOININDEX_JOININDEXID

Binary

LastAlterTime
Stamp

Time that Teradata last updated the


object

PID_JOININDEX_LASTALTERTIMEST
AMP

Timestamp

RequestText

The CREATE JOIN INDEX


PID_JOININDEX_REQUESTTEXT
statement that created the join index

Synchronization Internal Flag


Level

String

PID_JOININDEX_SYNCLEVEL

short

12500

Table 23: HashIndex Properties

Property Name

Description

Property ID

Type

Size

CommentString

The comment stored in Teradata for


the hash index

PID_HASHINDEX_COMMENT

String

255

CreatorName

Name of the Teradata user that


created the hash index

PID_HASHINDEX_CREATORNAME

String

128

DatabaseId

Teradata assigned identifier for the


database where the hash index
resides

PID_HASHINDEX_DATABASEID

Binary

HashIndexId

Teradata assigned identifier for the


hash index

PID_HASHINDEX_HASHINDEXID

Binary

LastAlterTime
Stamp

Time that Teradata last updated the


object

PID_HASHINDEX_LASTALTERTIMES
TAMP

Timestamp

58

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 23: HashIndex Properties (continued)

Property Name

Description

Property ID

Type

Size

RequestText

The CREATE HASH INDEX


statement that created the hash
index

PID_HASHINDEX_REQUESTTEXT

String

12500

PID_HASHINDEX_SYNCLEVEL

short

Synchronization Internal Flag


Level

Table 24: SubjectArea Class Property Descriptions

Property Name

Description

Property ID

Type

Size

Author

Name of the creator of the Subject Area

PID_SUBAREA_AUTHOR

String

255

BusinessDefinition

Business definition of the Subject Area

PID_SUBAREA_BUSDEFID

String

2048

SubjectAreaId

ID Number of the Subject Area

PID_SUBAREA_SUBAREAID Integer

Table 25: BusinessEntity Class Property Descriptions

Property Name

Description

Property ID

Type

Size

BusinessDefinition Business description of Entity

PID_BUSENTITY_BUSDEFID

String

12500

BusinessNotes

Comment text

PID_BUSENTITY_BUSNOTES

String

12500

EntityId

ID Number of the Entity

PID_BUSENTITY_ENTITYID

Integer

EntityType

Value indicating the type of the Entity.


Valid values = ET_DE (dependent),
ET_DR (derived), ET_IE (independent)

PID_BUSENTITY_ENTITYTYPE

String

SourceFile

Name of the file that the entity was loaded


from (such as the name of the ERwin file).

PID_BUSENTITY_SOURCEFILE

String

255

Size

Table 26: BusinessAttribute Class Property Descriptions

Property Name

Description

Property ID

Type

AttributeId

ID Number of the Attribute

PID_BUSATTR_ATTRID

Integer

AttributeType

Valid values = AT_DR (derived column),


AT_NK (nonkey), AT_PK (key)

PID_BUSATTR_ATTRTYPE

String

BusinessDefinition

Business description of Attribute

PID_BUSATTR_BUSDEFID

String

12500

BusinessNotes

Comment text

PID_BUSATTR_BUSNOTES

String

12500

ColumnPosition

The ordered position of the Attribute at


the logical level

PID_BUSATTR_COLUMNPOS

Integer

Teradata Meta Data Services Programmer Guide

59

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 26: BusinessAttribute Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

Rolename

Describes the Attributes role as a foreign


key

PID_BUSATTR_ROLENAME

String

255

Table 27: BusinessRule Class Property Descriptions

Property Name

Description

Property ID

Type

Size

MaximumValue

String that specifies the maximum value

PID_BUSRULE_MAXVALUE

String

255

MinimumValue

String that specifies the minimum value

PID_BUSRULE_MINVALUE

String

255

RuleDefinition

Definition of the rule

PID_BUSRULE_RULEDEF

String

12500

RuleId

ID Number of the rule

PID_BUSRULE_RULEID

Integer

Table 28: ValidValues Class Property Descriptions

Property Name

Description

Property ID

Type

Size

DisplayValue

The screen display form of the value

PID_VALIDVALUE_DISPLAYVALUE String

SequenceNumber

Sequence number of the value in the


list

PID_VALIDVALUE_SEQNUM

Integer

ValueDefinition

Definition of the value

PID_VALIDVALUE_VALUEDEF

String

12500

255

Table 29: MetaLoadTypeClass Property Descriptions

Property Name

Description

Property ID

Type

Size

LoadFlags

Binary array with flags indicating the


data types that can be loaded

PID_LOADTYPES_LOADFLAGS

Binary

32

Table 30: Function Class Property Descriptions

Property Name

Description

Property ID

Type

Size

FunctionId

Teradata assigned identifier


for a non-built in function

PID_FUNCTION_FUNCTIONID

Binary

DatabaseId

Teradata assigned identifier


for the database

PID_FUNCTION_DATABASEID

Binary

RequestText

The create text for a userdefined function

PID_FUNCTION_REQUESTTEXT

String

12500

LastAlterTimestamp

Time that Teradata last


updated the object

PID_FUNCTION_LASTALTERTIMESTAMP Timestamp

60

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 30: Function Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

Size

CreatorName

Name of the Teradata user


that created the function

PID_FUNCTION_CREATORNAME

String

128

CommentString

Comment stored in
Teradata for the function

PID_FUNCTION_COMMENTSTRING

String

255

FunctionClass

Class for the Teradata


function or the user defined
function
Valid values are:

PID_FUNCTION_CLASS

String

30

PID_FUNCTION_ALIAS

String

128
270

UDF = general user


defined function
UDF: Method = user
defined function that is
defined within a User
Defined Type (UDT)
UDF: Aggregate = user
defined aggregate
function
UDF: Ordered analytical
= user defined ordered
analytic window
aggregate function
UDF: Table UDF = user
defined table function
UDF: Teradata Internal =
a UDF used internally by
the Teradata Database
UDT: Constructor = a
user defined function
that is the constructor
for a UDT
FunctionAlias

Alias used for the function


in an SQL statement

FunctionReturnType

Return type for the function PID_FUNCTION_RETURN_TYPE

String

SynchronizationLevel

Internal flag

PID_FUNCTION_SYNCLEVEL

Short

FunctionSpecificName

The specific name for the


user defined function

PID_FUNCTION_SPECIFICNAME

String

128

FunctionCallParameters

The actual parameters


passed to the function

PID_FUNCTION_CALLPARAMETERS

String

1024

Teradata Meta Data Services Programmer Guide

61

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)

Table 31: Constant Class Property Descriptions

Property Name

Description

Property ID

Type

Size

ConstantType

The type of the constant


Valid values are:

PID_CONSTANT_TYPE

String

128

PID_CONSTANT_VALUE

String

1024

ACCOUNT *
ACTIVITY_COUNT
ALL
ANSIDATE
ASCII
AUTOTEMP
BIGINT
BINARY
CHARSET_COLL
CHAR_SET_GRAPHIC

CURRDATE *
CURRENT_ROLE
CURRENT_USER
CURRTIME *

PROFILE *

CURRTIMESTAMP *
DATABASE *

ConstantValue

DATE *
DECIMAL
DEFAULT
DQUOTESTR
EBCDIC
FLOAT
HEXSTR
HIGH
HOST
INTEGER
INTEGERDATE
JIS_COLL
KANJI
KANJISJIS
LATIN1
LOCAL

The value of the constant

LOW
MANUAL
MULTINATIONAL
MEDIUM
NAME
NEVER
NULL
OFF
PARMNAME
PREPARE_COUNT

ROLE *

SESSION *
SOURCE_TIME_ZONE
SQLCODE
SQLSTATE
SQUOTESTR
STAR
TEMPORAL_DATE
TEMPORAL_TIMESTA
MP
TIME *
UNICODE
UNKNOWN
USER *

Values marked with * in the table are converted from constants to functions before being
stored in the MDS repository. They have function class "BI" (built-in). Date, Time,

62

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)

Timestamp and Interval literals are stored with a constant type of SQUOTESTR (single
quoted string).
The following notes apply to constants referenced by a view column and functions referenced
by view columns, stored procedures, macros, and so on:

If a constant is used in an expression with a table column or function, the constant and
expression are not stored in the repository. Only the column or function are stored and
associated with the view column.
For example, when a view column references expressions (c1 + 10) and [sum(c1) + 10],
where c1 is a table column, 10 is a constant, and sum(c1) is a function, only table column
c1 and function sum(c1) are stored in the repository and associated with the view column.
The constant 10 and expressions (c1 + 10) and [sum(c1) + 10] are not.

If a function is used in combination with other functions, each individual function is


stored in the repository and associated with the view column, whereas the combination of
functions is not.
For example, when a view column references the expression [sum(c1) + avg (c1)], only the
functions sum(c1) and avg (c1) are stored in the repository and associated with the view
column.

Operators that are used to combine functions are not stored in the repository.

Table 32: UDT Class Property Descriptions

Property
ID

Type

Size

The comment stored in Teradata


for the UDT

VARCHAR

255

CreatorName

Name of user that issued CREATE


TYPE

CHAR

128

DatabaseID

Teradata assigned identifier for


the database

BYTE

DistinctPredefinedType

The data type on which a distinct


UDT is based

CHAR

IsStructured

N=distinct UDT, Y=structured


UDT

CHAR

LastAlterTimestamp

Time that Teradata last updated


the object

TIMESTAMP

NumberOfArrayDimensi
ons

The number of array dimensions


for a UDT defining an ARRAY
type

10

SMALLINT

RequestText

CREATE TYPE statement for the


type

VARCHAR

SynchronizationLevel

0=not synchronized,
1=synchronized

SMALLINT

Property Name

Description

CommentString

Teradata Meta Data Services Programmer Guide

12500

63

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 32: UDT Class Property Descriptions (continued)

Property Name

Description

TypeID

Teradata assigned identifier for


the type

Property
ID

Type

Size

BYTE

Table 33: UDTAttribute Class Property Descriptions

Property Name

Description

Property
ID
Type

Size

AttributeFormat

Attributes format, such as 9(5)

VARCHAR

128

AttributeID

Ordering of the attribute within the


structured UDT

SMALLINT

AttributeLength

Length of the attribute

INT

CharacterSet

Character set for CHAR data types

SHORT

1 Latin
2 Unicode
3 KanjiSJIS
4 Graphic
5 Kanji1

CommentString

The comment stored in Teradata for the


attribute

VARCHAR

255

DataType

The data type encoding for the attribute

CHAR

DecimalFractDigits

n in DECIMAL(M,N)

SMALLINT

DecimalTotalDigits

m in DECIMAL(m,n)

SMALLINT

TypeID

The Teradata assigned identifier of the


9
UDT comprising this attribute's data type

BYTE

Table 34: FunctionParameter Class Property Descriptions

Property Name

Description

Property
ID
Type

CharacterSet

Character set for CHAR data types

64

Size

SHORT

1 Latin
2 Unicode
3 KanjiSJIS
4 Graphic
5 Kanji1

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 34: FunctionParameter Class Property Descriptions (continued)

Property
ID
Type

Size

Comment stored in Teradata for the


parameter

VARCHAR

255

DataType

Data type encoding for the parameter

CHAR

ParameterID

Ordering of the parameter in the function


definition

SHORT

ParameterLength

Length of the parameter

INT

RowTypeDatabaseNa
me

The name of the database containing the


table referenced by a %ROWTYPE
attribute

String

128

RowTypeTableName

The name of the table referenced by a


%ROWTYPE attribute

String

128

Property Name

Description

CommentString

DIM Relationship Descriptions


The following table defines the DIM Relationship Descriptions. The diagram numbers refer to
Figure 10: Database Information Metamodel (DIM) (Sheet 1 of 2) on page 40 and Figure
11: Database Information Metamodel (DIM) (Sheet 2 of 2) on page 41.
Table 35: DIM Relationship Descriptions

Relationship Name

Number in
Diagram

Description

SystemHasDatabases

Associates databases with Teradata Database systems

SystemHasNodes

Associates nodes with Teradata Database systems

DatabaseHasTables

Associates tables with databases where they reside

DatabaseHasViews

Associates views with databases

DatabaseHasMacros

Associates macros with databases

DatabaseHasStoredProcedures

Associates stored procedures with databases

DatabaseHasTriggers

Associates triggers with databases

DatabaseHasSubjectAreas

Associates subject areas with databases

DatabaseHasEntities

Associates business entities with databases

DatabaseHasRules

10

Associates business rules with databases

DatabaseOwnsDatabases

11

Associates databases with owner databases

BusEntityHasAttributes

12

Associates attributes with business entities

BusEntityTable

13

Associates tables with business entities

Teradata Meta Data Services Programmer Guide

65

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 35: DIM Relationship Descriptions (continued)

Relationship Name

Number in
Diagram

Description

BusEntityView

14

Associates views with business entities

BusAttrViewColumn

15

Associates view columns with business attributes

BusAttrColumn

16

Associates columns with business attributes

BusAttrRules

17

Associates rules with business attributes

BusRuleValues

18

Associates valid values with business rules

SubjectAreaEntities

19

Associates business entities with subject areas

TableHasColumns

20

Associates columns with tables

TableHasIndices

21

Associates indexes with tables

IndexContainsColumns

22

Associates columns with indexes

TableHasCheckConstraints

23

Associates check constraints with tables

TableHasRefConstraints

24

Associates reference constraints with tables

ConstraintReferencesColumns

25

Associates referenced columns with constraints

TableHasTriggers

26

Associates triggers with tables

ColumnHasTriggers

27

Associates triggers with columns

ViewHasColumns

28

Associates columns with views

ViewHasTableColumns

29

Associates table columns with views

ViewReferencesViews

30

Associates referenced views with other views

ViewColReferencesTableCols

31

Associates referenced table columns with view columns

SPHasParameters

32

Associates parameters with stored procedures

SPReferencesTables

33

Associates referenced tables with stored procedures

SPReferencesViews

34

Associates referenced views with stored procedures

SPReferencesStoredProcedures

35

Associates referenced stored procedures with other stored


procedures

SPReferencesMacros

36

Associates referenced macros with stored procedures

SPReferencesTableColumns

37

Associates referenced table columns with stored procedures

SPReferencesViewColumns

38

Associates referenced view columns with stored procedures

TriggerReferencesMacros

39

Associates referenced macros with triggers

MacroHasParameters

40

Associates parameters with macros

MacroReferencesTables

41

Associates referenced tables with macros

MacroReferencesViews

42

Associates referenced views with macros

66

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 35: DIM Relationship Descriptions (continued)

Relationship Name

Number in
Diagram

Description

MacroReferencesSPs

43

Associates referenced stored procedures with macros

MacroReferencesMacros

44

Associates referenced macros with other macros

MacroReferencesTriggers

45

Associates referenced triggers with macros

MacroReferencesTableColumns

46

Associates referenced table columns with macros

MacroReferencesViewColumn

47

Associates referenced view columns with macros

DatabaseHasHashIndexes

48

Associates hash indexes with databases

DatabaseHasJoinIndexes

49

Associates join indexes with databases

JoinIndexHasIndices

50

Associates indexes with join indexes

HashIndexHasIndices

51

Associates indexes with hash indexes

JoinIndexReferencesTables

52

Associates referenced tables with join indexes

JoinIndexReferencesTableColumns

53

Associates referenced table columns with join indexes

HashIndexReferencesTables

54

Associates referenced tables with hash indexes

SPReferencesJoinIndexes

55

Associates referenced join indexes with stored procedures

MacroReferencesJoinIndexes

56

Associates referenced join indexes with macros

SystemHasMetaLoadTypes

57

Associates Metaload types with database systems

ViewReferencesTables

58

Associates referenced tables with views

TableHasErrorTable

59

Associates error tables with tables

ViewColumnReferencesConstants

60

Associates referenced constants with view columns

TriggerReferencesTables

61

Associates referenced tables with triggers

HashIndexReferencesTableColumns

62

Associates referenced table columns with hash indexes

MacroReferencesHashIndexes

63

Associates referenced hash indexes with macros

SPReferencesHashIndexes

64

Associates referenced hash indexes with stored procedures

DatabaseHasUDTs

65

Associates UDTs with databases

UDTHasAttributes

66

Associates UDT attributes with UDTs

UDTHasFunctions

67

Associates functions with UDTs

DatabaseHasFunctions

68

Associates functions with databases

FunctionHasParameters

69

Associates function parameters with functions

ColumnHasUDT

70

Associates UDTs with table columns

ViewColumnHasUDT

71

Associates UDTs with view columns

Teradata Meta Data Services Programmer Guide

67

Chapter 2: Application Information Metamodels (AIMs)


Database Information Metamodel (DIM)
Table 35: DIM Relationship Descriptions (continued)

Relationship Name

Number in
Diagram

Description

MacroParameterHasUDT

72

Associates UDTs with macro parameters

SPParameterHasUDT

73

Associates UDTs with SP parameters

JoinIndexReferencesFunctions

74

Associates referenced functions with join indexes

MacroReferencesFunctions

75

Associates referenced functions with macros

SPReferencesFunctions

76

Associates referenced functions with stored procedures

TriggerReferencesUDTs

77

Associates referenced UDTs with triggers

TriggerReferencesFunctions

78

Associates referenced functions with triggers

UDTAttributeHasUDT

79

Associates UDTs with UDT attributes

ViewColumnReferencesFunctions

80

Associates referenced functions with view columns

FunctionParameterHasUDT

81

Associates UDTs with function parameters

FunctionCallUsesUDF

82

Associates a function object that defines a call to a function with a


referenced function

FunctionReferencesFunctions

83

Associates a function with another function

ViewReferencesFunctions

84

Associates a view with functions

68

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Extending the Database Information Metamodel (DIM)

Extending the Database Information


Metamodel (DIM)
The DIM is the metamodel that is used to store Teradata physical model meta data in the MDS
repository.
MDS provides a utility to read and extract Teradata information and loads the meta data into
the DIM. Teradata applications should reference the Teradata meta data in MDS instead of
maintaining their own identical meta data. This will reduce meta data redundancy and the
number of places that a change must be made. Extending the DIM with relationships to the
Teradata meta data provides warehouse users with more information relating to their Teradata
active data warehouse.
To extend the DIM is to add new meta data Classes, Properties or Relationships to the DIM.
These classes, properties and relationships model additional data to be maintained about the
Teradata physical model.
For example, you may want to add a class that stores the source data for each column in the
Teradata active data warehouse. A relationship is also needed to join the source information to
the column.
For our example, we will create a SourceColumn class and a SourceOfColumn relationship
that will relate a SourceColumn to the associated Column.

The API to create the class is: CMetaAIM::CreateClassDesc.

The API to create the properties of the class are: CMetaClassDesc::CreatePropertyDesc.

The API to create the relationship is: CMetaAIM::CreateRelationshipDesc.

After these APIs are run, the DIM now looks like Figure 12:

Teradata Meta Data Services Programmer Guide

69

Chapter 2: Application Information Metamodels (AIMs)


Extending the Database Information Metamodel (DIM)
Figure 12: User Extended DIM
DatabaseSystem

Database

Name: char
SystemHasDatabases
Description: varchar
MetaloadDate: varchar

Column

Name: char
DatabaseId: BYTE(4)
Description: varchar

DatabaseHasTables
Table
Name: char
DatabaseId: BYTE(4)
TableId: BYTE(6)
Description: Varchar

TableHasColumns

Name: char
Description: varchar
ColumnId: smallint
TableId: BYTE(6)
DatabaseId: BYTE(4)
ColumnFormat: char
ColumnTitle: varchar
ColumnLength: smallint
DefaultValue: varchar
Nullable: char
DecimalTotalDigits: smallint
DecimalFractionDigits: smallint
UppercaseFlag: char
Compressible: char
CompressValue: varchar

SourceOfColumn
ColumnSource
Name: char(30)
Description: varchar(1024)
ServerName: char(10)
DatabaseName: varchar(30)
Ownername: char(10)
TableName: varchar(30)
ElementName: varchar(30)
ElementDataType: char
ElementKeyPosition: shortint
ElementNulls: char
ElementPosition: integer

3047A054

The Teradata physical databases, tables and columns are loaded into MDS with the metaload
utility. To add the ColumnSource data, an application would need to be written to perform
the following steps:
For our example, we assume there is a Teradata Column called T_DEPT,
Teradata Column
DatabaseName: Employee
TableName: TGT_EMP
ColumnName: T_DEPT

70

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Extending the Database Information Metamodel (DIM)

that has the following source information:


Source Column
DatabaseName: ora.emp
TableName: SRC_EMP
ElementName: DEPT
ElementDataType: String

Using the CMetaObject APIs, an application would be written to:


1

Set the fields for a new ColumnSource object (name=DEPT)

Write the new ColumnSource object to the MDS database (See sample code for examples
of writing an object)

Get the MDSID for the T_DEPT Column in MDS

Add the new ColumnSource object (DEPT) to the SourceOfColumn collection for the
Column (T_DEPT) object

After the ColumnSource objects and collections are created, the MDS repository will contain
the information about Columns objects and their source data as in Figure 13:
Figure 13: New ColumnSource Objects and Collections
ColumnSource Objects

Column Objects

Name: DEPT
ServerName: paris
Name: ora.emp
TableName: SRC_EMP

Name: T_DEPT
ColumnId: 1935
TableId: 000012340000
DatabaseId: 00003984

Name: MGR
ServerName: paris
Name: ora.emp
TableName: SRC_DEPT

Name: T_ST
ColumnId: 1820
TableId: 0000124900000
DatabaseId: 00003984

Name: FNAME
ServerName: paris
Name: ora.emp
TableName: SRC_EMPLOYEE

Name: T_FNAME
ColumnId:1899
TableId: 0000124900000
DatabaseId: 00003984
3047A055

By creating additional classes and relationships in the DIM and creating applications to
maintain information the new data, you will be able to build a store of information in MDS.
This information provides answers to questions about the warehouse such as where the
information came from, when was it last updated, what is the meaning of the data, etc.

Teradata Meta Data Services Programmer Guide

71

Chapter 2: Application Information Metamodels (AIMs)


Client Load Metamodel (CLM)

Client Load Metamodel (CLM)


The Client Load Metamodel (CLM) is an MDS-defined metamodel for the Teradata client
load utilities. The metacreate and metamigrate utilities automatically create the CLM in the MDS
repository.

The CLM stores meta data information about loading data into the Teradata system through
the use of the Teradata client load utilities.
This meta data information includes:

Information about a load script and its execution status

Information about the data source(s) that are used by the load script

Information about the target(s) that are loaded by the load script

The CLM is linked to the Database Information Metamodel (DIM) at:

The Table level (Script and Source objects to the DIM Table class objects)

The View level (Script and Source objects to the DIM View class objects)

The Column level (SourceField objects to the DIM Column class objects and the DIM
ViewColumn class objects)

These linkages will allow users to traverse through both models regardless of the model they
started from. The metaclient program is used to load the Client Load meta data information
into the CLM.

72

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Client Load Metamodel (CLM)

The CLM is represented in Figure 14.


Figure 14: Client Load Metamodel (CLM)

Client Load Metamodel


Script
VersionID
ScriptQualifier
OutputFileName
LoadUtility
SessCharSet
ScriptLevelDDLUsed
ProcessorTime
HighestReturnCode
CompletionStatus
StartTime
StartDate
EndTime
EndDate

ScriptHasSources

Source
SourceType
INMODRoutine
StartRecordRange
EndRecordRange
RecordFormat
IndicatorBits

ScriptHasTargets

Target

ScriptLoadsDIMViews
ScriptLoadsDIMTables

TargetType
TargetSystemName
TargetDatabaseName
TargetLevelDDLUsed
TargetLevelDMLUsed
NbrRecsSentToTD
NbrRecordsRead
NbrRecordsDeleted
NbrRecordsInserted
NbrRecordsSkipped
NbrRecordsUpdated
NbrErrorsTbl1
NbrErrorsTbl2

SourceLoadsDIMTables

Table
SourceUpdatesDIMViews

View

Database
Information
Model

SourceHasSourceFields

ScriptField
DataType
DataLenght
RecLayoutName

Column

SourceFieldUpdatesDIMColumns
SourceFieldUpdatesDIMViewColumns

ViewColumn

3047A013

Client Load Metamodel Class Descriptions


The following table defines the CLM class descriptions.
Class Name

Description

Script

A Client Load script

Source

A data source used in the Client Load script

SourceField

A data field defined in the Source input record

Target

A target where the Source data is loaded into

The names of all objects in the CLM classes are limited to 255 characters.

Teradata Meta Data Services Programmer Guide

73

Chapter 2: Application Information Metamodels (AIMs)


Client Load Metamodel (CLM)

Client Load Metamodel Class Property Descriptions


Property Names and Relative Property IDs are defined in CLcreateaim.h.
Table 36: Script Class Property Descriptions

Property Name

Description

Property ID

Type

VersionId

ID identifying a particular instance of the execution of


this Client Load script

Short

ScriptQualifier

Identification information for this script on the origin


system

String

255

OutputFileName

Name of this scripts output file

String

255

LoadUtility

Client Load Utility that this script is for

String

30

SessCharSet

The character set used by this script session

String

30

ScriptLevelDDLUsed

String list of non-Target related DDL statements


executed in the script

String

255

ProcessorTime

Amount of processor time used during the execution of


this script

String

25

HighestReturnCode

The highest return code produced during the execution


of this script

Short

CompletionStatus

Status of the scripts execution

String

10

StartTime

Time when the execution of the script started


(HH:MM:SS)

10

String

StartDate

Date when the execution of the script started (YYYYMM-DD)

11

Date

EndTime

Time when the execution of the script ended


(HH:MM:SS)

12

String

EndDate

Date when the execution of the script ended (YYYYMM-DD)

13

Date

74

Size

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Client Load Metamodel (CLM)

Table 37: Source Class Property Descriptions

Property Name

Description

Property ID

Type

Size

SourceType

Type of the input data source

String

30

INMODRoutine

Name of the INMOD routine that is preprocessing the


input data from this source

String

255

StartRecordRange

Record number of the first input record to be processed 3

Integer

EndRecordRange

Record number of the last input record to be processed

Integer

RecordFormat

Format of the input records

String

11

IndicatorBits

Indicates whether Indicator Bits are present in the input 6


records

String

Table 38: SourceField Class Property Descriptions

Property Name

Description

Property ID

Type

Size

DataType

Data type of the source field

String

15

DataLength

Data length of the source field

Short

RecLayoutName

Name of the record layout definition where this source


field is defined

String

30

Table 39: Target Class Property Descriptions

Property Name

Description

Property ID

Type

Size

TargetType

Type of the target

String

30

TargetSystemName

Name of the target system

String

256

TargetDatabaseName

Name of the target database

String

128

TargetLevelDDLUsed

String list of DDL statements executed against the


target

String

255

TargetLevelDMLUsed

String list of DML statements executed against the


target

String

255

NbrRecordsRead

Number of input records read

Integer

NbrRecsSentToTD

Number of input records sent to the Teradata Database 7

Integer

NbrRecordsDeleted

Number of records deleted from the target

Integer

NbrRecordsInserted

Number of records inserted into the target

Integer

NbrRecordsSkipped

Number of input records skipped

10

Integer

NbrRecordsUpdated

Number of records updated in the target

11

Integer

Teradata Meta Data Services Programmer Guide

75

Chapter 2: Application Information Metamodels (AIMs)


Common Warehouse Metamodel
Table 39: Target Class Property Descriptions (continued)

Property Name

Description

Property ID

Type

NbrErrorsTbl1

Number of error records in error table #1

12

Integer

NbrErrorsTbl2

Number of error records in error table #2

13

Integer

Size

Client Load Metamodel Relationship Descriptions


Table 40 defines the CLM Relationship Descriptions.
Table 40: CLM Relationship Descriptions

Relationship Name

Description

ScriptHasSources

Associates Client Load scripts with their input data


sources.

ScriptLoadsDIMTables

Associates Client Load scripts with the DIM tables


that they load.

ScriptLoadsDIMViews

Associates Client Load scripts with the DIM views


that they load.

ScriptHasTargets

Associates Client Load scripts with the targets that


they load.

SourceHasSourceFields

Associates data sources with the data fields defined in


their input records.

SourceUpdatesDIMTables

Associates data sources with the DIM tables that they


load.

SourceUpdatesDIMViews

Associates data sources with the DIM views that they


load.

SourceFieldUpdatesDIMColumns

Associates data fields with the DIM Table Columns


that they load.

SourceFieldUpdatesDIMViewColumns Associates data fields with the DIM View Columns


that they load.

Common Warehouse Metamodel


The Object Management Group (OMG) defined and maintains a specification that describes
meta data interchange called the Common Warehouse Metamodel (CWM). The purpose of
the CWM metamodel is to enable the interchange of warehouse and business intelligence (BI)
meta data.
The MDS CWM holds meta data imported by XML Bridge, a Teradata tool that supports the
exchange of information between MDS repository and select BI analytic modeling tools. The
The CWM metamodel is provided by MDS and created manually by the user. See the

76

Teradata Meta Data Services Programmer Guide

Chapter 2: Application Information Metamodels (AIMs)


Common Warehouse Metamodel

instructions for using XML Bridge in Appendix D of the Teradata Meta Data Services
Administrator Guide.
The layout of the MDS CWM metamodel is shown in Figure 15. The metamodel supports
OMG CWM Core, Relational, Keys & Indexes, OLAP, and Transformation packages.
Figure 15: CWM_Metamodel layout
CWMRDB_SQLSimpleType

CWMRDB_Catalog

CWMTFM_TransformationTask

CWM_Model

CWMRDB_SQLDistinctType
CWMRDB_Schema

CWMRDB_View
CWMRDB_Table
CWM_Description
CWMRDB_Column
CWMRDB_UniqueConstraint
CWMRDB_PrimaryKey

CWMOLAP_Schema

CWMOLAP_Cube

CWMOLAP_Measure

CWMOLAP_CubeRegion

CWMOLAP_CubeDimensionAssociation

CWM_DataType

CWM_Package

CWMTFM_Transformation

CWMTFM_DataObjectSet

CWM_Association

CWM_AssociationEnd

CWM_Multiplicity

CWMOLAP_Dimension
CWM_Class
CWMOLAP_Level
CWM_Attribute

CWM_StructuralFeature
CWMOLAP_Hierarchy

CWM_TaggedValue

CWM_KeyRelationship
CWMOLAP_HierarchyLevelAssociation
CWMRDB_ForeignKey
CWMTFM_TransformationMap
CWMRDB_SQLIndex
CWMTFM_ClassifierMap
CWMRDB_SQLIndexColumn
CWMTFM_FeatureMap
CWMRDB_Trigger
CWMTFM_ClassifierMapSource
CWMRDB_Procedure
CWMTFM_ClassifierMapTarget
CWMRDB_SQLParameter

3118A002

For more information about CWM_Metamodel classes, see the Teradata Meta Data Services
Administrator Guide.
For a complete list of all CWM_Metamodel classes and their properties, see the metamodel as
defined in the XML file, or as viewed in MetaBrowse.

Teradata Meta Data Services Programmer Guide

77

Chapter 2: Application Information Metamodels (AIMs)


Common Warehouse Metamodel

78

Teradata Meta Data Services Programmer Guide

CHAPTER 3

General API Information

This chapter gives information about how the MDS APIs work:

Common Properties

Data Versioning

Transactions

Locking

Delete Propagation

Security

Property Data Types

Repository Root

Labels

Multithreaded Applications

Common Properties
Metadata in the MDS repository is represented as objects. Every object stored in the MDS
repository has a set of common properties. These properties are described in the following
subsection.
Note: Object API calls return all common properties for an object as described in the
following subsections. ObjectKey API calls, however, return a small subset of those properties,
such as object name and ID. When fewer details are required, ObjectKey calls are more
efficient, resulting in better performance. See Chapter 10 ObjectKey Classes on page 237.
User-defined property filters allow for greater flexibility when standard Object API calls
return too much information and the ObjectKey calls return too little. See Chapter
8 CMetaFilterInfo Class on page 219.

Object Name
Objects can be given names, but a name is not required. Names are limited to 255 characters.
If the unique option on the class description is specified, unique names will be maintained
within a class.
If the unique option on the relationship description is specified, MDS will maintain unique
names in the relationship collections.
Objects can be retrieved by specifying the class identifier and name of the object.

Teradata Meta Data Services Programmer Guide

79

Chapter 3: General API Information


Common Properties

Description
Each object has a description property. Descriptions are limited to 1024 characters.
The description provides information about the meta data and how it is used. It is
recommended that the description property be set when creating an object. The designer of a
class can define it as requiring a description for all objects in the class.

Object ID
Each object (instance of a class) is given a unique internal identifier by MDS. When data
versioning is enabled for a class, each version of an object in the class will have a separate,
unique internal identifier. This ID is a long integer and is often abbreviated as a LOID. An
object or a specific version of an object can be retrieved by specifying the LOID associated
with the object or version.
Object IDs are 32-bit 2's-complement signed integers in Teradata, which means their range is
-(2^31) ... (2^31 - 1). The order in which object IDs are used is:
1, 2, 3, ... 2,147,483,647, -2,147,483,648, ..., -3, -2, -1
When you get to -1, you run out of object IDs and MDS returns the
META_E_NO_UNUSED_LOIDS (0x80007018) error code if someone attempts to write a
new object. There are 4,294,967,295 (4.3 billion) legal object IDs and 0, the null object ID.
To update an existing object, the Object ID of a version of the object must be specified.

Object GUID
Each object (instance of a class) is also given a globally unique identifier (GUID). Unlike the
Object ID, the GUID can be specified for an object when first created. If an object is not
assigned a globally unique identifier at creation time, MDS will generate one for the
object.When data versioning is enabled for a class, each version of an object in the class will
have the same GUID.
A GUID is a Microsoft globally unique identifier and is a Microsoft implementation of the
DCE UUID. All GUID values should be computer-generated to guarantee uniqueness.
Microsoft provides function calls to create a GUID. (Executing the utility Guidgen.exe on
Windows is one means to create GUIDs.)
An object can be retrieved by specifying the GUID of the object.

Version Number
Each object can have one or more versions, with the version numbers starting at 1. Version
numbers are assigned by MDS. The version number is a read-only property that cannot be set
by an application. In a non-versioned repository, the version number is always set to 1.

Owner ID
The MDS user who creates an object is by default the owner of an object, although the creator
can specify another user as owner. An object can only have one owner.

80

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Common Properties

The Owner ID is used to specify the owner of a new object or to search or sort by owner. For
more information on users, see Security.

Security Profile ID
MDS maintains the ID of the security profile assigned to the object. For more information on
security profiles, see Security.

CreateDate/Time, UpdateDate/Time
For each object, MDS maintains the date and time the object was created and last updated.
These are read only properties and cannot be set by an application.

PublishState
For each version of an object, MDS maintains a state indicating the version's visibility. The
highest numbered version of an object will have a publish state of current; all other versions
are considered non-current or inactive. This is a read-only property that cannot be set by an
application.

IsFrozen
For each version of an object, MDS maintains a flag indicating the version's changeability.
Frozen versions may not be modified; unfrozen versions may be modified. Currently, only the
highest numbered version of an object is unfrozen and modifiable. This is a read-only
property and cannot be set by an application.

BaseVersionLoid
BaseVersionLoid is an internal property visible only to MDS. An application cannot read or
set the values.

PredecessorVersionLoid
PredecessorVersionLoid is an internal property visible only to MDS. An application cannot
read or set the values.

Common Property Constants


The following table provides the IDs and functions to use to sort a return list or filter a search
based on the common properties.
Table 41: Common Property Constants

Property Name

Relative Property ID

CMetaProperty function

PROPNAME_NAME

PID_CMN_NAME

SetString()

PROPNAME_DESCRIPTION

PID_CMN_DESCRIPTION

SetString()

PROPNAME_LOID

PID_CMN_LOID

SetLong()

Teradata Meta Data Services Programmer Guide

81

Chapter 3: General API Information


Data Versioning
Table 41: Common Property Constants (continued)

Property Name

Relative Property ID

CMetaProperty function

PROPNAME_GOID

PID_CMN_GOID

SetBinary()

PROPNAME_OWNERID

PID_CMN_OWNERID

SetLong()

PROPNAME_CREATEDATE

PID_CMN_CREATEDATE

GetString() Date is specified in a string


in the format YYYY-MM-DD

PROPNAME_CREATETIME

PID_CMN_CREATETIME

GetString() Time is specified in a string


in the format HH:MM:SS.SS

PROPNAME_UPDATEDATE

PID_CMN_UPDATEDATE

GetString() Date is specified in a string


in the format YYYY-MM-DD

PROPNAME_UPDATETIME

PID_CMN_UPDATETIME

GetString() Time is specified in a string


in the format HH:MM:SS.SS

PROPNAME_SECPROFID

PID_CMN_SECPROFID

SetLong()

PROPNAME_PUBLISHSTATE

PID_CMN_PUBLISHSTATE

GetShort()

PROPNAME_VERSIONNUMBER

PID_CMN_VERSIONNUMBER

GetLong()

PROPNAME_ISFROZEN

PID_CMN_ISFROZEN

GetShort()

Data Versioning
MDS supports the ability to retain historical copies of data objects within classes. The
historical copies provide the ability to see the progression of changes made to an object after
its initial creation. An application will only be allowed to modify the latest version of an
object, but the earlier versions will be viewable, within the restrictions of the applicable
security profile.
Versioning only applies to data objects within classes. Versioning cannot be used with the
definitions of metamodels, classes, relationships, properties, users, security profiles, and
application groups. Classes with LOIDs below 1000 do not support data versioning.

Current and Non-current Versions


By default, an application will only see the latest or highest-numbered version of an object.
That version is termed the 'current' version. All other versions of the object will be considered
non-current and will require special APIs to be viewed.
As an example of why it is necessary for the existing APIs to always use only the current
version of objects, suppose you are executing two copies of the same program which
continually reads and updates the property values for an object. In a non-versioned
repository, it is sufficient to identify an object by its internal or global object ID, neither of
which changes throughout the life of the object. The application knows that it can always read
the current values for an object using the same object ID value regardless of how many times
the object has been updated via WriteObject. Thus, for the two copies of the application, each
82

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Data Versioning

copy knows that it is always seeing the latest values for an object's properties if it only knows
the object ID returned by the first ReadObject for the object.
No changes to the application should be necessary for it to function correctly in a data
versioning environment; consequently, the application should always be assured of working
with the latest, current property values of an object without needing to know the object ID of
the object's latest version. The object ID created when the object was created should be
sufficient throughout the life of the application to get the latest property values via
ReadObject and to update the latest property values via WriteObject. When data versioning is
active, there is no guarantee that the object ID returned by ReadObject is still the object ID of
the latest version. In between calling ReadObject and WriteObject, another application could
have changed the object's values and created a new version. Consequently, to stipulate that an
application always know the identity of the latest version of an object is unrealistic and
unenforceable, thus all APIs that work with the current property values must always disregard
the version represented by the object's internal object ID and instead determine the correct
object ID.

Creating a New Version


Each version of an object shows the values of the object's common and unique properties at a
point in time. When an object is initially created, the object will be assigned version one. If a
class supports data versioning, then when an application calls WriteObject() for an object in
the class, MDS will create a new version of the object and assign it a version number that is
one greater than the current version. If a class does not support data versioning, WriteObject
will use the previous functionality and overwrite the current object.
The new version of an object will retain the previous version's unique property values, except
for those that are specifically set in the CMetaObject object. This is the equivalent
functionality of no data versioning and is what existing applications would expect.

Reading Versions
ReadObject() will always return the property values for the current version of an object. If an
application needs to see a previous version of an object, it should call GetVersionKeys to get
the object IDs for the object's versions, and then call ReadVersion() for the specific version.

Deleting Objects
Deleting an object via Delete() will delete all versions of an object. This will enable an
application to immediately create a new object with the same name, which matches the
functionality for a class that does not support data versioning.

Deleting Versions
Specific versions of an object may be deleted by calling DeleteVersion() or
DeleteVersionRange(). Any version of an object can be deleted via those two interfaces. If the
current version of an object is deleted, the previous version becomes the current version. If an
object has only one version, deleting that version is the same as deleting the object, i.e. the
object no longer exists.

Teradata Meta Data Services Programmer Guide

83

Chapter 3: General API Information


Data Versioning

Collections
When a new version of an object is created, MDS automatically gives the new version the same
collection states as the previous version. This is consistent with previous functionality, in that
changing the property values via WriteObject() did not affect the object's inclusion in
collections. Because the new version is now the current version of the object, changes to the
collections of the object will only be reflected in the new version. The previous versions'
collections will be frozen to retain their correct historical information.
With source collections, the source objects will have their appropriate collections modified so
that the current version of the source object will point to the new version of the current object.
For instance, if an application modifies an object in the DIM Table class, the DIM Database
object which includes the table object in its DatabaseHasTables collection will now have the
new version of the Table object as a destination object. When the application requests the
destination objects satisfying the database's DatabaseHasTables relationships, it will be
returned the new version of the Table object.
With destination collections, the new object version will have the same destination objects as
the previous version. Thus, after the new version is created, a GetDestCollection will return
the same values as before the version was created. Changing the Description property of a
DIM Table object will create a new version of the object, but it will not change what columns,
indices, etc. the table references, which is the expected functionality.

Enabling and Disabling Data Versioning


Data versioning for the repository is enabled or disabled by metacreate and metamigrate, and
is reflected by a flag setting in the metaroot table. When data versioning is disabled for the
repository, no metamodels or classes can ever support data versioning.
When data versioning is enabled for the repository, versioning can be enabled or disabled for
any model or class in the repository.
Data versioning can be:

Enabled for all metamodels and classes in the repository

Restricted to specific metamodels in the repository, or

Restricted to specific classes in the repository.

Data versioning for a new model is determined by the state of versioning set in metaroot. Data
versioning for a new class is determined from the state of versioning for the model that created
the class.
An application can modify the data versioning state for a model by calling
CMetaAIM::SetModelVersioningFlag. The application can only enable versioning for a model
if data versioning is enabled at the repository level.
An application can modify the data versioning state for a class by calling
CMetaClassDesc::SetClassDescVersioningFlag. The application can only enable versioning for
a class if data versioning is enabled at the repository level.

84

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Retain Associated Business Information and Dormant Objects

Retain Associated Business Information and


Dormant Objects
When business descriptions are loaded, and then database tables are dropped and recreated to
load data, the business descriptions can be retained through the use of dormant objects.
Without them, business descriptions associated with tables or views would be lost when those
items are dropped and recreated. By using dormant objects, when tables or views are
recreated, the business descriptions can be reassociated with them.
This is accomplished by using the MDS Retain Associated Business Information feature. This
feature places certain DIM objects in a dormant state after they have been deleted. When such
objects are deleted, they are not removed from the repository. Instead their publish states are
set to dormant.
A dormant object does not actually exist and is not returned by ReadObject() or any
GetCollection interface. It can later be reactivated and will then become visible. When an
object is reactivated, all its relationships are also reactivated, so any business definitions set up
before deleting the object are not lost.
The only DIM objects that may be made dormant are tables and views and their constituent
objects. These are the object types that the Business classes (SubjectArea, BusinessAttribute,
ad others) will currently reference. All other object types, either in the DIM or in other AIMs,
can never be in a dormant state.
Dormant objects are supported by metaload and the DIM update processes. They will check
for the existence of a dormant version of a table or view prior to adding a new table or view to
the DIM.

Enabling or Disabling Dormant Objects


The ability to retain business objects in a dormant state is determined by a flag in the Root
class (metaroot table). This flag is off by default. Metacreate and metamigrate provide options
for enabling or disabling dormant objects.
The retain business objects flag can be modified programmatically with the
CMetaRepository::SetRetainBusinessObjects API
Enabling dormant objects only requires setting the flag in the metaroot table.
If dormant objects are currently supported, in order to disable dormant objects, all dormant
objects in the DIM must be found and removed from the repository. This is the equivalent of a
CMetaObject::ForceDelete for each such object.

Generating Dormant Objects


A DIM object will be placed in the dormant state when:

CMetaObject::Delete is called

The Root class' UseDormantObjects property is set to true

The object is in a class that supports dormant objects

Teradata Meta Data Services Programmer Guide

85

Chapter 3: General API Information


Transactions

The object has defined business definitions when one or more of the following is true:

A table, view, column, or viewcolumn contains a value in the Description property

A table or view has an associated BusinessEntity

A column or viewcolumn has an associated BusinessAttribute

Rather than deleting the object from the repository, the object will remain in the repository,
but the PublishState will be changed to signify a dormant object. At that point, the object will
only be visible to selected APIs called by MDS Administrator users; normal non-privileged
users will never see the dormant objects.

Reactivating Dormant Objects


A dormant object is made active transparently when the following calls are invoked:

CMetaObject::WriteObject and CMetaObject::WriteVersion. These calls automatically


reactivate a dormant object if the called object has a nonzero object ID (loid) that matches
a currently dormant object.

CMetaObject::ReactivateDIMObject. This call reactivates a currently dormant object and


can be invoked by an administrator to restore a dormant object if MDS is unable to do so
because the name of the object being created does not match that of a dormant object.

Unlike WriteObject and WriteVersion, ReactivateDIMObject does not modify the object in
the repository with the calling object's properties; it only changes the PublishState of the
object.

Transactions
MDS supports two types of one-phase commit transactions: implicit and explicit.

Implicit transactions are automatically provided at the MDS API level without any special
action by the user. These ensure that the data in the MDS repository remains consistent at
an MDS object and relationship level. They are required because many MDS APIs must
perform multiple SQL commands, all of which must succeed or fail together to maintain
repository consistency.

Explicit transactions are under the express control of the user application and can be used
to group multiple MDS API calls into a single all-or-nothing transaction.

Both types of transactions will be implemented using the ANSI Teradata ODBC session mode
and ODBCs manual commit transaction interface. Using the ANSI session mode instead of
Teradatas native mode will allow MDSs transaction to be more easily ported to other ANSIand ODBC-compliant platforms. To facilitate this, MDS will avoid sending Teradata-specific
transaction management SQL commands directly to Teradata, and will instead use the ODBC
transaction APIs to manage transactions.

86

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Transactions

Implicit Transactions
Implicit transactions are MDS API-level transactions which automatically occur without any
special action from the user. If the user has not initiated an explicit MDS transaction, then
each MDS API call is automatically performed as a separate implicit transaction. The implicit
transaction brackets all database activity occurring within the MDS API call, guaranteeing the
ACID properties.
These transactions ensure that the MDS repository data remains consistent at the MDS object
level, i.e., that the structure of all MDS repository objects and the relationships between them
remain intact. Implicit transactions are needed because in the database, MDS objects are
decomposed into relational table entries, and the data comprising a single object will in
general be stored in multiple rows distributed among multiple tables. Without implicit
transactions, it would be possible for several MDS users to read and write parts of a single
MDS object in an interleaved fashion, resulting in inconsistent data returned and/or persisted
in the repository, or for a crash during an MDS APIs execution to leave the repository in an
inconsistent state.
Because the structural preservation of MDS repository objects fundamentally depends on the
existence of implicit MDS API-level transactions, there is no way for the user to disable them.
Database changes made during an MDS API call will only be committed if the entire API
completes execution without errors. Otherwise the changes will be rolled back to the state
prior to the API call.

Explicit Transactions
Explicit transactions are user-controlled MDS transactions that can be used to bracket
changes requiring multiple MDS API calls. An MDS user application starts an explicit
transaction by calling the CMetaRepository::BeginTransaction API and ends it by explicitly
calling either the CMetaRepository::Commit or the CMetaRepository::Rollback API. Until the
user expressly closes an explicit MDS transaction, the transaction remains open. Only one
explicit transaction can be active at a time.
Explicit transactions may be pseudo nested by calling CMetaRepository::BeginTransaction
multiple times before calling CMetaRepository::Commit or CMetaRepository::Rollback.
If this is done, each instance of CMetaRepository::BeginTransaction must be paired with a
matching subsequent call to CMetaRepository::Commit in order to finally close the
transaction and commit the changes.
Following is an example of an explicit MDS transaction management syntax. It shows a legal
call sequence for an MDS explicit transaction.
CMetaRepository::BeginTransaction
CMetaRepository::BeginTransaction
CMetaObject::ReadObject
CMetaObject::ReadObject
CMetaObject::WriteObject
CMetaRepository::Commit
CMetaRepository::BeginTransaction

Teradata Meta Data Services Programmer Guide

87

Chapter 3: General API Information


Transactions
CMetaObject::WriteObject
CMetaObject::ReadObject
CMetaRepository::Commit
CMetaRepository::Commit

This enables greater flexibility for the application that is using MDS transactions, but it does
not provide true nested transactions. The term pseudo nesting will be used throughout this
document to refer to this kind of nesting.
The entire transaction from the first CMetaRepository::BeginTransaction to the final
CMetaRepository::Commit is in reality a single flat transaction. This is because MDS uses
standard ANSI transaction management, which does not include nested transactions.
Therefore, the syntactically nested subtransactions are not independent transactions of their
own, and their calls to CMetaRepository::Commit do not actually commit work to the
database but instead merely close the current pseudo nesting level.
The reason pseudo nesting is allowed is that the added flexibility it provides can simplify the
coding of applications that use MDS explicit transactions. For instance, suppose an
application has two methods, A() and B(), that use MDS explicit transactions. An example is
shown below of how pseudo nesting can simplify MDS explicit transaction coding.
A()
{
CMetaRepository::BeginTransaction

Call MDS APIs;


CMetaRepository::Commit
}
B()
{
CMetaRepository::BeginTransaction

Call MDS APIs;


if (condition) call A();
CMetaRepository::Commit
}

Because MDS allows pseudo nested transactions, this works correctly. If MDS did not allow
this, however, the above example code would break when B() called A(), because A() attempts
to open a transaction after B() has already opened one. Without the ability to pseudo nest
transactions, in such a situation the application programmer would need to add data
members and conditional code to keep track of whether or not A() should attempt to open a
transaction depending on whether or not one of its ancestors had already done so.
Closing Explicit Transactions
The user must always specifically close an explicit MDS transaction. After an explicit
transaction is closed, either all of the work it performed will have been successfully committed
to the database, or none of it will have. (See Behavior of Transactions Containing DDL
Statements for the only exception transactions containing multiple DDL statements.)
While ANSIs definition of commit allows individual SQL statements that succeeded to
commit while other SQL statements that failed to roll back, MDS must disallow this

88

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Transactions

statement-level commit behavior to ensure object-level consistency, as a single MDS object


may require more than one SQL statement to update it correctly. If MDS allowed statementlevel commits, part of an MDS object might be updated while other parts were not, leaving the
repository data in an inconsistent state.
There are always two ways the user application can close an explicit transaction: by calling
CMetaRepository::Rollback once or by calling CMetaRepository::Commit the appropriate
number of times for the current pseudo nesting level (i.e., once for each
CMetaRepository::BeginTransaction call that has not yet been paired with a
CMetaRepository::Commit call). The following subsections describe the different scenarios
under which transactions will be committed or rolled back.
Committing a Successful Transaction

An explicit transaction can only be committed if no errors occurred anywhere within the
entire transaction and the user never called CMetaRepository::Rollback within the
transaction. To commit the transaction, the user application must call
CMetaRepository::Commit enough times to close all open pseudo nesting levels. At the time
the final CMetaRepository::Commit is issued, the transaction will be committed to the
repository if and only if there have been no errors, and MDS will return the success code
S_OK. If any errors were detected, the entire explicit transaction will be rolled back, and MDS
will return the error code META_E_TX_ROLLED_BACK.
User-Initiated Transaction Rollback

The user application may force the termination and rollback of an open explicit transaction at
any time by calling the MDS CMetaRepository::Rollback API once. When this API is called,
MDS will abort and roll back the entire explicit transaction, regardless of the current nesting
level. The user application must be aware that calling CMetaRepository::Rollback terminates
all open nesting levels of the explicit transaction, ending the transaction entirely. This is
different from CMetaRepository::Commit, which only closes a single nesting level. MDS
therefore treats further MDS API calls as either new implicit transactions if
CMetaRepository::BeginTransaction is not called again, or as part of a new explicit
transaction if it is.
Transaction Rollbacks Due to Errors

If an error occurs anywhere within an explicit MDS transaction, the entire transaction will be
aborted and rolled back, and MDS will return error codes from the current and all subsequent
MDS API calls within that transaction.
However, because the user by definition always has control over explicit transactions, the user
must explicitly close the transaction before MDS will consider the transaction closed. In this
way, both the user and MDS are in agreement as to the boundaries of the explicit transaction.
As an optimization, MDS will not actually perform any additional work in an explicit
transaction once it has detected an error, because the entire transaction must be aborted and
rolled back. However, until the user application closes the transaction, MDS will continue to
treat MDS API calls as part of the currently open (failed) explicit transaction.

Teradata Meta Data Services Programmer Guide

89

Chapter 3: General API Information


Transactions

If the user application checks the MDS return code and sees that MDS has returned an error
code, it can call CMetaRepository::Rollback to close the entire explicit transaction
immediately, regardless of the current pseudo nesting level.
However, if the user application does not check the error code returned by MDS, it will not
realize the transaction must ultimately be rolled back and could continue issuing MDS API
calls that are all part of the original explicit transaction, including pseudo nested
CMetaRepository::BeginTransaction and CMetaRepository::Commit calls.
In this case, MDS will simply return error codes for all MDS APIs the user calls, rather than
actually performing the work, until the user closes the explicit transaction, at which point
MDS will return the META_E_TX_ROLLED_BACK error code. The following shows an
example of a rollback of an explicit transaction due to an error.
CMetaRepository::BeginTransaction
CMetaRepository::BeginTransaction

MDS API call 1


MDS API call 2
CMetaRepository::Commit
CMetaRepository::BeginTransaction

MDS API call 3 generates an error


MDS API call 4
CMetaRepository::Commit

MDS API call 5


CMetaRepository::Commit

Assume that MDS API call 3 generates an error. At this point, MDS aborts the entire explicit
transaction, rolls back the work performed thus far (MDS API calls 1-2 and potentially parts
of call 3 if they have been executed), and returns an error code for MDS API call 3.
Remember, because ANSI transactions do not provide true transaction nesting, the call to
CMetaRepository::Commit after MDS API call 2 does not actually commit the work of MDS
API calls 1-2 to the database.
The next API call MDS receives is MDS API call 4, indicating that the user application is
continuing work within the currently open (ultimately doomed) explicit transaction. Because
the fate of this entire explicit transaction is to be rolled back, MDS will not attempt to perform
any more work as part of this transaction. Instead, it will immediately return an error code
from MDS API call 4. The user application continues processing, calling
CMetaRepository::Commit, MDS API call 5, and CMetaRepository::Commit again.
In response to each of these calls, MDS will return an error code instead of performing the
work. The final call to CMetaRepository::Commit closes the transaction, and MDS will return
the error code META_E_TX_ROLLED_BACK. The end result is that the entire transaction
failed, and no part of the work it performed was committed to the database. Subsequent MDS
API calls will initiate implicit transactions on an API level if the user application does not
begin another explicit transaction, or will begin a new explicit transaction if the user calls
CMetaRepository::BeginTransaction again.

90

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Transactions

The reason MDS requires the user application to expressly close all explicit transactions, even
those in which an error occurs, is to preserve the guarantee that everything between the users
initial call to CMetaRepository::BeginTransaction and the final closing of the transaction via
either CMetaRepository::Rollback or CMetaRepository::Commit must succeed or fail as a unit
regardless of the behavior of the user application. The user will thus be able to view MDSs
internal transaction management as a black box and not be required to exhibit any special
behavior to make it work. Specifically, the user application should not be required to check
error codes returned by MDS APIs in the middle of an explicit transaction and detect that
MDS wants to end the transaction early because an error occurred. Therefore, MDS will not
close the transaction when it detects an error, but will wait for the user application to close the
transaction explicitly.
To understand what would happen if MDS implicitly aborted the transaction when an error
occurred without the user application explicitly closing it, look at the previous example of a
rollback of an explicit transaction due to an error.
In that case, when MDS API call 3 generated an error, MDS would terminate the transaction,
roll back the work of MDS API calls 1-3, and assume the user application realized the
transaction had been aborted.
However, in fact the user application may not have checked the return code and so might not
realize this. Believing the original explicit transaction was still open, the user application
would proceed with MDS API call 4, which would in fact commit that APIs changes to the
database via an implicit MDS transaction. The user application would follow this with
CMetaRepository::Commit, generating another MDS error (because there is no open explicit
transaction as far as MDS is concerned); MDS API call 5, which would again commit work to
the database as an implicit MDS transaction; and a final CMetaRepository::Commit,
generating another MDS error.
At this point, work from MDS API calls 1-3 has been rolled back, but work from MDS API
calls 4-5 has been committed to the database, violating the guarantee that work bracketed
within an explicit transaction is either all committed or all rolled back. This is why MDS only
closes an explicit transaction if instructed to do so by the user application.
Rollbacks on Application Termination, Server Crashes, Network Outages

If the user application terminates while an explicit transaction it has initiated is still open, the
transaction will be rolled back. An open explicit transaction will also be rolled back if the
Teradata Database Systems crashes or is reset, if the ODBC connection between the
MetaManager and Teradata is lost, or if the MDS Manager crashes.
Behavior of Transactions Containing DDL Statements
The Teradata Database Systems places a restriction on data definition language (DDL) calls
within transactions (e.g., the SQL commands CREATE, REPLACE, DROP, and ALTER). At
most one DDL statement may occur in a transaction, and it must be the last statement in that
transaction. Several MDS APIs may execute DDL statements:

CMetaAIM::CreateMDSClassDesc

CMetaClassDesc::CreateMDSPropertyDesc

Teradata Meta Data Services Programmer Guide

91

Chapter 3: General API Information


Transactions

CMetaObject::WriteObject if writing a new class or property description object (an


object whose class is CLSLOID_ClassDescClass or CLSLOID_PropertyDescClass or the
corresponding GUIDs)

CMetaObject::Delete if called with a class or property description object or if deletion


propagates to such an object

CMetaObject::RemoveFromDestCollection, CMetaObject::RemoveFromOrigCollection
if the relationship instance removed is of the ClassHasProperties type
(RELLOID_ClassHasProperties or RELGUID_ClassHasProperties)

In the case of CMetaObject::Delete, the API may need to execute multiple DDL statements,
e.g., to remove columns or tables when deletion propagates to multiple class or property
description objects.
In order to accommodate Teradatas restriction on DDL in transactions, both implicit and
explicit MDS transactions will postpone executing their DDL statements until the end of the
transaction. The CMetaStorage class will log specifications of postponed DDL statements
associated with a transaction as rows in a table named metaddl.
When a transaction is ready to commit (either because the user issues the final
CMetaRepository::Commit of an explicit transaction, or the end of an implicit transaction is
reached), CMetaStorage will check the metaddl table for any DDL statements associated with
the transaction which must be executed. If there are any, it will execute the first DDL as the last
statement of the transaction and then attempt the commit.
If the transaction could not be committed (e.g., an error occurred during it), it will be rolled
back, and any other DDLs that were associated with that transaction will not be attempted. All
DDL specification rows in metaddl that were associated with that transaction will be removed
as a side effect of the rollback, because they were inserted into that table in the same
transaction. At this point, the repository is in a consistent state, as no part of the original
transaction, including any of its DDLs, was persisted in the database. MDS will return the
error code META_E_TX_ROLLED_BACK.
If the transaction committed successfully and additional DDLs are associated with it,
CMetaStorage will attempt all of these DDLs, even if some of them produce errors. If they all
succeed, MDS will return the success code S_OK. In this case, the repository is consistent, as
both the transaction and all of its associated DDLs were persisted. If any of the additional
DDLs fail, MDS will return the META_E_TX_COMMITTED_WITH_INCOMPLETE_DDL
error code specifying that the original transaction committed but some of its associated DDLs
failed. This is the only case where the repository will be left in an inconsistent state. The user
can call the CMetaRepository::RetryDDL API to clean up by retrying the failed DDLs.
The reason MDS will attempt all the associated DDLs for a committed transaction even after
some of them produce errors is to complete as many of the DDLs associated with the
transaction as possible because that transaction did commit. Because Teradata allows only one
DDL in a transaction, it is impossible to guarantee all-or-nothing behavior of the original
transaction plus all of its DDLs if there are multiple DDLs.
Because MDS postpones DDL execution to the end of each transaction, it is possible for the
user to create an entire AIM within an explicit transaction and be guaranteed that everything
either succeeds or fails as a unit except the DDL statements. In the case of AIM creation, the
92

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Locking

DDL statements creates tables and columns for the unique properties of classes, so if
processing fails during the DDLs, the only cleanup necessary is to create the missing tables and
columns. Note that the user must close such a transaction before attempting to add data to
any new classes created or any classes to which they have added new properties, as the tables
and columns designated to contain that data will not exist until the DDL that creates them is
executed.

Locking
A locking protocol is necessary to guarantee the standard ACID properties of transactions
(atomicity, consistency, isolation, and durability) when multiple concurrent transactions are
being processed against the MDS repository (e.g., when there are multiple active MDS
application processes). The Teradata Database System automatically handles all issues related
to locking for transaction management, including read locking, write locking, prioritizing,
and queuing lock requests, upgrading locks, and releasing locks.
Teradata also automatically detects and resolves deadlocks at the database level. Each MDS
application processes only one transaction at a time, so there is no possibility of a local
deadlock inside an MDS process.
MDS does not allow users to read repository information that is write locked by another
transaction as doing so could return inconsistent data.

Delete Propagation
Delete propagation means recursively deleting any child (destination) object that was
contained by a parent (origin) object that itself is being deleted if no other object contains
the child. This functionality is useful in containment situations where deletion of a parent
object implies that certain of its contained child objects no longer exist.
For example, if the MDS repository holds an object t representing a database table, an object r
representing one of its rows, and a contains relationship relating these as table t contains row
r, if t is deleted, r should also be deleted automatically through delete propagation if t was the
only object that contained r.
Delete propagation is turned on and off at the relationship description level. Each relationship
description object has a PropagateDeleteFlag which, if set on, will cause deletions involving
that relationship to be propagated.
The delete propagation MDS provides implements a semantics of containment. Enabling
delete propagation for a given relationship is equivalent to marking it as a containment
relationship. Doing this reduces the status of the destination objects of this relationship type:
it indicates that they are subordinate objects that depend for their existence on being
contained by at least one superordinate object via a relationship that has delete propagation
enabled.

Teradata Meta Data Services Programmer Guide

93

Chapter 3: General API Information


Delete Propagation

A containment relationship means a relationship type that has its delete propagation flag
turned on, and if object A is said to contain object B, it means that A is the origin object and B
is the destination object of a containment relationship that links them as shown in Figure 16.
In the following example, Object A is said to contain Object B, because A points to B with a
relationship whose PropagateDeleteFlag is set.
Figure 16: Delete Propagation Example 1

object A

containment_relationship

object B

(PropagateDeleteFlag is set)
3047A029

An object will be deleted via delete propagation if it was previously contained and the last
object that contained it gets deleted. That is, if an origin object of a given destination object is
deleted and it points to the destination object with one or more relationship types for which
delete propagation is enabled, the destination object will also be deleted if there are no other
origin objects pointing to it with any relationship types for which delete propagation is
enabled.
Deleting an object is affected by delete propagation as follows: when an object in the MDS
repository is deleted, all relationship instances of which it is the origin or destination will also
be deleted (regardless of whether their delete propagation flags are set). For each such
relationship in which the deleted object was the origin of a containment relationship, MDS
will check the destination object. If the destination object is not contained by any other object
(i.e., the destination object is not pointed to by any other relationships that had delete
propagation enabled), MDS will recursively delete that destination object.
Because delete propagation is a recursive process, deletions may propagate through many
layers of relationships and objects when the user deletes a single object. This has two
important implications:
1

Delete propagation can be dangerous. Large portions of the network of objects in the
repository can potentially be deleted when the user explicitly deletes a single object.

Delete propagation can be expensive. Many layers of recursion involving numerous


database lookups may be required to completely propagate a delete.

For these reasons, and especially the first one, delete propagation should only be turned on for
a containment relationship type for which the user is absolutely certain that deleting an origin
object always means its contained objects should be deleted if they are not contained by any
other origin objects. The fact that a contained object participates in other non-containment
relationships will not prevent it from being deleted by delete propagation if its last containing
parent is deleted.
Delete propagation functionality is provided expressly for containment situations where
deletion of a parent may imply deletion of a child. This is why it will delete an object even if
the object is involved in other non-containment relationships.
For example, if tables contain rows and a table is deleted, a contained row should also be
deleted even if it has another relationship such as row r was_inserted_on date d, where r is

94

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Delete Propagation

the row object and d is an object specifying the rows insertion date. In the example below, the
left side is before deleting table t, and the right is after deleting table t. Because
table_contains_row has its PropagateDeleteFlag on, it is a containment relationship, so delete
propagation also deletes row r. Because was_inserted_on has its PropagateDeleteFlag off, it is
not a containment relationship, so deletion will not propagate to the date d object.
Figure 17: Delete Propagation Example 2
table t

table_contains_row (PropagateDeleteFlag is on)

row r

was_inserted_on (PropagateDeleteFlag is off)

date d

date d
3047A030

A single destination object can be contained by multiple origin objects. The destination object
will only be deleted by delete propagation when its last containing parent is deleted.
For example, assume the repository held a database table object t, a spreadsheet object s, a row
object r, and two containment relationships (relationships with delete propagation enabled):
table_contains_row and spreadsheet_has_row.
If these objects are related by t table_contains_row r and s spreadsheet_contains_row r, the
same row r is contained by both the table and the spreadsheet.
Both table t and spreadsheet s contain row r, so delete propagation will not delete r unless both
s and t are deleted.
As long as either the table or the spreadsheet still exists, the row can continue to exist. If the
user deletes the table, the row will not get deleted via delete propagation because it is still the
destination of another containment relationship, namely s spreadsheet_contains_row r.

Teradata Meta Data Services Programmer Guide

95

Chapter 3: General API Information


Security
Figure 18: Delete Propagation Example 3

table t

table_contains_row

s'sheet s

spreadsheet_contains_row
row r
3047A031

Security
Object-level security has to do with who can access an object and what they can do with the
object once they have accessed it.
For example, you might want objects containing sensitive information to be unreadable by
other applications and for objects with less sensitive information to be readable by everyone.
Object-level security allows you to set an objects access permissions by determining:

who can read it

who can write to it

who can add or remove objects from its collection

Authentication is the system identifying a user based on user id and password. MDS will
authenticate users when they attempt to connect to the repository. Only valid users will be
allowed access to the repository.

Owner
The creator of an object is by default the owner of an object, unless he or she specifies the
owner to be another user. An object has one owner.
Only the owner can change the owner of an object. Once ownership has been changed, it can
only be changed back by the new owner.
A user cannot be deleted from MDS if he is an owner of any objects in the repository.

Application Group
The application group is a group of users. Permissions assigned to an application group are
granted to all users in the group. An application group has zero to many users.

96

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Security
Figure 19: Application Group

Application
Group

is a grouping of

Users

3047A032

Access Permissions
An objects access permissions tell us who can do what with it.
The permissions that can be applied to an object are:

Read - the right to read an object.

Collection - the right to add or remove an object from a collection. The user must have
collection access on the source object, destination object, and the relationship description
object.

Write the right to update an object

Delete the right to delete an object

Create the right to create objects of the class (only meaningful when applied to a Class
Description Object)

The permissions will be grouped into types to assign to the users and application groups. This
is because some of the permissions are dependent on the user having other permissions.
For example, to update an object, the user requires read access to the object. To delete an
object, the user requires collection privileges to remove the object from existing collections.
The types of access that can be assigned to a user or application group in a security profile are:

Read (Grants Read access rights)

Collection (Grants Read and Collection access rights)

Update (Grants Read, Collection, Write and Delete access rights)

Full (Grants Read, Collection, Create, Write and Delete access rights)

The following table describes the MDS Access Types:


Table 42: Access Type Descriptions

Access Type

Description

Read

Grants read access to an object through MetaSurf, MetaBrowse or other applications


using the MDS APIs.
Read access is the only access type needed for users that only read objects in the MDS
repository. The remaining access types are used for customizing the type of update
privileges that can be applied to objects.

Teradata Meta Data Services Programmer Guide

97

Chapter 3: General API Information


Security
Table 42: Access Type Descriptions (continued)

Access Type

Description

Collection

Grants read access to an object and the ability to add or remove the object from a
collection.
Collection permission is needed on an object if it is to be added to a collection.
You would grant collection permission (without update permission) to an object if you
want to make it available to other users to add to existing or new relationships. For
example, collection permission is needed on most objects in the DIM. Metaclient links the
source in the load script to the destination table or view object in the DIM. It also links the
source fields in the load script to the column and view column objects in the DIM. For
metaclient to set up these relationships, the user running metaclient must have collection
permission to all DIM objects that will be linked to the client load objects.
To add or remove an object from a collection, the user must have Collection permissions to
the source, destination and relationship description objects.
To add Column: SSN to the SourceFieldUpdatesDIMColumns
collection of SourceField:ORA_SSN, a user must have collection
privileges on the SSN and ORA_SSN objects and the
SourceFieldUpdatesDIMColumns relationship.

Source Field: ORA_SSN

Column: SSN

SourceFieldUpdatesDIMColumns
3047A033

Update

Grants read, update and delete permission to the object and the ability to add or remove
the object from a collection.

Full

Grants read, update and delete permission to the object and the ability to add or remove
the object from a collection. Also when applied to a class description, grants permission to
create objects of the class.

Special Permissions
Table 43: Special Permissions

Access Type

Description

Object Owner

Is granted Full permission to the object

AIM objects

Model Objects only the owner can delete


ClassDescription objects only the owner can delete the class description or add or remove
Property Description objects.
RelationshipDescription objects - only the owner can delete

metasu or superuser

98

Has full permission on all objects

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Security

Super-User Access
The user metasu is the administrative id created by MDS. The user metasu has full access to all
objects in the MDS repository. The password for metasu should be a well kept secret, for use
only by system administrators.
Any user in the repository can be granted superuser status if it is created by calling
CMetaUser::CreateSuperuser. Granting superuser status to a user gives the user full access to
all objects in the MDS repository. For that reason, system administrators should careful about
which users have superuser status, and the passwords for those users should be protected.

Security Profiles
A security profile is a named object containing the permissions for a set of groups and users.
One and only one Security Profile is assigned to each object in the repository. Access to the
object is based on the access type permissions defined in the assigned Security Profile. The ID
of the Security Profile will be stored in a common property of every object.
One Security Profile can be assigned to many objects.
Figure 20 is an example of a Security Profile.
Figure 20: Security Profile Example 1

Security Profile

User: Mary Rights: Read


User: Fred Rights: Read
Group: Acct Rights: Read
Group: Payroll Rights: Full

3047B034

Access to objects in MetaSurf, MetaBrowse or other MDS applications is based on the access
type in the Security Profile associated with the object. If an object is not given public read
access, a user will not be able to see the object unless specifically granted access as a user or as
a member of an application group in the Security Profile for that object.
In the example in Figure 21, Mary, Fred and all users in the Acct and Payroll Application
Groups have read permission to databases A and B. Fred and all the users in the Payroll
Application Group can update objects corresponding to databases A and B.
Lucy and all users in the Application Group Acct have read and write access to databases C and
D. No other users can view these databases.

Teradata Meta Data Services Programmer Guide

99

Chapter 3: General API Information


Security
Figure 21: Security Profiles Example 2

Database
A

Security
Profile

User: Mary Rights: Read

Payroll

Group: Acct Rights: Read

User: Fred Rights: Full

Group: Payroll Rights: Full


B

Payroll

Acct
User: Lucy Rights: Full

Acct

Group: Acct Rights: Full


3047B035

It is possible for a user can have multiple access rights defined in the profile. In the above
example, user Mary has been granted explicit Read rights. If Mary is also a member of the
Payroll group, she will also have Full rights. The user will be granted the highest level of rights
(in this case, Full rights).
There will be one special term that can be used to define rights in a Security Profile. The term
is Everyone. Everyone specifies permissions for anyone connecting to the MDS repository.
Security on Security Profiles
Access to security profiles will be as follows:

Any MDS user can create a security profile

The creator of a security profile can set the owner of the profile

Users that are granted read access in the security profile are given read permission to the
security profile.

Default Profiles
The MDS system will have a configurable default security profile. Initially the profile will be:
User

Access Type

Everyone

Read

The Default Security Profile can be changed in the MetaManager GUI.


If a Security Profile is not specified for an object when created in the MDS repository, it will be
given a default profile. The default profile will depend on the type of object being created.
Figure 22 illustrates the defaults:

100

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Security
Figure 22: Security Profile Defaults
MDSDefaultsecurityProfile

Default for new AIM


components

Security Profile assigned to


the ClassDescription

Default for new objects


created in the class
3047A037

Preconfigured Profiles
MDSDefaultSecurityProfile

The MDSDefaultSecurityProfile defines the permissions to all objects which are not assigned a
specific security profile. The initial setting will be (Everyone, Read). Only metasu or another
superuser can change the permissions. The profile cannot be deleted.
MDSMetaModelSecurityProfile

The MDSMetaModelSecurityProfile is assigned to the MDSMetaModel AIM components.


The MDSMetaModel security profile determines who can create metamodels, classes and
relationships The initial setting will be (Everyone, FULL). Permissions on MDSMetaModel
components are:

Updates and deletes to MDSMetaModel objects are not permitted by any user (including
metasu or other superuser).

The MDSMetaModel security profile determines who can create metamodels, classes and
relationships. A user must have FULL permission in the MDSMetaModelSecurityProfile to
create a model, class, relationship or property.

To view the MDSMetaModel components, a user must have READ permission in the
MDSMetaModelSecurityProfile.

Only metasu or another superuser can change the permissions. The profile cannot be
deleted.

DIMSecurityProfile

The DIMSecurityProfile is assigned to the DIM AIM components. The initial setting will be
(Everyone, Collection). Permissions on DIM components are:

To add a class or relationship to the DIM, a user must have FULL permission in the
MDSMetaModelSecurityProfile and COLLECTION permission in the
DIMSecurityProfile.

To view the DIM AIM components, a user must have READ permission in the
DIMSecurityProfile.

Only metasu or another superuser can change the DIM permissions. The profile cannot be
deleted.

This is not the security profile which will be assigned to DIM class objects. This profile is
only for the DIM AIM objects.

Teradata Meta Data Services Programmer Guide

101

Chapter 3: General API Information


Property Data Types

Special Permissions on AIM Components

Metasu, or any superuser, through the MetaManager, will be able to change the Security
Profile on AIM components. Otherwise updates to AIM objects are not permitted.

The Security Profile assigned to a Class Description determines what users can create
objects of that class type. The user must have FULL permission in the profile.

The Security Profile assigned to each AIM component determines who can read the object.
The user must have READ permission in the profile.

Only the owner of the AIM component can delete it.

To create a class in a model which is owned by another user, a user must have FULL
permission in the MDSMetaModel security profile and COLLECTION permission in the
models security profile.

To create a relationship in a model which is owned by another user, a user must have FULL
permission in the MDSMetaModel security profile, COLLECTION permission in the
models security profile and COLLECTION permission to the classes which are defined in
the relationship.

To create a property in a class which is owned by another user, a user must have FULL
permission in the MDSMetaModel security profile and COLLECTION permission in the
class security profile.

Only the owner of a class can remove property descriptions in the class.

Creating Objects in a Class


To create an object in a class, the user must be the owner of the class description object or have
FULL permissions in the security profile which is assigned to the class description object.
Authentication
Authentication is the system identifying a user based on user id and password. MDS will
authenticate users when they attempt to connect to the repository. Only valid users will be
allowed access to the repository.
When a user initializes access to the MDS repository, the user must provide his/her user id and
password. MDS will encrypt the password provided by the user and compare it to his
encrypted password stored in the repository. If the passwords match, the user will be allowed
access to the repository.

Property Data Types


The data types MDS supports for the properties of a class are the Teradata SQL data types:

102

INTEGER

SMALLINT

DECIMAL(n)

FLOAT(n)

CHAR(n)

Teradata Meta Data Services Programmer Guide

Chapter 3: General API Information


Repository Root

VARCHAR(n)

BYTE(n)

VARBYTE(n)

DATE

NUMERIC(n)

REAL

DOUBLE PRECISION

BYTEINT TIME(n)

TIMESTAMP(n)

Teradata built in functions can be used to set the value of a property. The supported functions
are shown in Table 44.
Table 44: Supported Teradata Functions to Set the Value of a Property

Teradata Function

To set a property with the data type

CURRENT_DATE

DATE

DATE
CURRENT_TIME

TIME

CURRENT_TIMESTAMP

TIMESTAMP

Repository Root
The engine maintains one object that is the root level object of the repository. The root object
contains the system-wide parameters.

Labels
A label is a name that can be applied to one or more objects in the repository. Using a label, an
application can determine the versions of objects in the repository that existed when the label
was defined.
A label is an object defined by the CMetaLabel class. Using functions in the CMetaLabel class,
a label can be defined to reference one or more objects in the repository. The label can only be
applied to the current version of an object. After a label has been applied to a version of an
object that same label cannot be applied to other versions of the object. After a label has been
applied to objects, new functions in the CMetaObject class can be used to read the object
versions with a specific label. These functions allow an application to specify the name of a
label that is used to filter out object versions not containing the label.

Teradata Meta Data Services Programmer Guide

103

Chapter 3: General API Information


Multithreaded Applications

Multithreaded Applications
On Windows, you can create an application with multiple threads accessing the MDS APIs.
The MDS objects are thread-safe at the class level but not at the object level. This means that
you can have two separate threads manipulating two different CMetaObject objects, but not
two threads manipulating the same CMetaObject object. If you have multiple threads
manipulating the same object, you must protect the access with Win32 synchronization
mechanisms.
Each thread must call the Initialize or SignOn function. Only the users who have Initialized or
Signed On in the thread will have permission to objects in the thread.
Each thread will have a separate ODBC connection to the Teradata Database Systems. Along
with this, MDS transactions are maintained per thread. Therefore, if your application is using
MDS transactions, you must maintain thread affinity. You cannot issue a BeginTransaction
and WriteObject on one thread and another WriteObject and Commit on another.

104

Teradata Meta Data Services Programmer Guide

CHAPTER 4

C++ Project Settings

This chapter describes the settings and information you need when working with the C++
APIs.

Include Files

Localization

Code Generation

Suggested Project Settings

Linking an MDS Application

Include Files
You must add an include statement to your program to bring in all the necessary include files
for writing an MDS application.
Add the statement to your program to bring in the MDS include files.
#include <metaincludes.h>

All MDS include files are installed in the <MDS Installation directory>/include.
You must have installed the MDS SDK to get all the include files required.

Localization
When an application needs the internationalized functions working under _MBCS or
_UNICODE settings, the application developer must set the locale in the application.
You can set the locale dynamically in your application based on the Windows locale setting as
follows:
//*** Get User Locale Info.
lcid = GetUserDefaultLCID(); // get locale ID here
GetLocaleInfo( lcid, LOCALE_SABBREVLANGNAME, m_lpszLangU, 4);
GetLocaleInfo( lcid, LOCALE_SENGLANGUAGE, m_lpszLangEng, 20);
//setlocale(LC_ALL, "target_language");
setlocale(LC_ALL, m_lpszLangEng);

Teradata Meta Data Services Programmer Guide

105

Chapter 4: C++ Project Settings


Code Generation

Code Generation
Windows C++ applications (console applications or DLLs) using the MDS APIs must set the
C/C++ Code Generation Category to Use run-time library: Multithreaded DLL. If an
executable is built using the Single-threaded or Multithreaded libraries instead of the
Multithreaded DLL library, an access violation will occur during program termination.

Suggested Project Settings


In the project settings, METAHOME is the installation directory for Meta Data Services

Win32 Release
C/C++ tab
Category: General
Warning level: Level 3
Debug info: none
Optimizations: Maximize Speed
Preprocessor Definitions:
WIN32,NDEBUG,_WINDOWS,_MBCS
Category: C++ Language
Representation method: Best-Case Always *
Enable exception handling: checked
Category: Code Generation
Processor: Blend *
Use run-time library: Multithreaded DLL
Calling convention: __cdecl * (If building a
DLL to be called by a Microsoft Excel macro,
the calling convention must be __stdcall)
Struct member alignment: 8 Bytes *
Category: Customize
Suppress startup banner and information
messages: checked
Category: Optimizations
Optimizations: Maximize Speed
Inline function expansion: Only __inline
Category: Precompiled Headers
Not using precompiled headers: checked
Category: Preprocessor
Preprocessor Definitions:
WIN32,NDEBUG,_WINDOWS,_MBCS
Additional include directories: METAHOME\include
Link tab
Category: Input
Object/library modules: add metadk.lib metaosc.lib
Additional library path: METAHOME\lib

Win32 Debug
C/C++ tab
Category: General
Warning level: Level 3

106

Teradata Meta Data Services Programmer Guide

Chapter 4: C++ Project Settings


Suggested Project Settings
Debug info: Program Database
Optimizations: Disable (Debug)
Preprocessor Definitions:
WIN32,_DEBUG,_WINDOWS,_MBCS
Category: C++ Language
Representation method: Best-Case Always *
Enable exception handling: checked
Category: Code Generation
Processor: Blend *
Use run-time library: Debug Multithreaded DLL
Calling convention: __cdecl ** (If building a DLL
to be called by a Microsoft Excel macro, the calling convention
must be __stdcall)
Struct member alignment: 8 Bytes *
Category: Customize
Eliminate duplicate strings: checked
Enable minimal rebuild: checked
Suppress startup banner and information messages:
checked
Category: Optimizations
Optimizations: Disable (Debug)
Inline function expansion: Disable *
Category: Precompiled Headers
Not using precompiled headers: checked
Category: Preprocessor
Preprocessor Definitions:
WIN32,_DEBUG,_WINDOWS,_MBCS
Additional include directories: METAHOME\include
Link tab
Category: Input
Object/library modules: add metadkd.lib metaoscd.lib
Additional library path: METAHOME\lib

Win32 Release Unicode


C/C++ tab
Category: General
Warning level: Level 3
Debug info: none
Optimizations: Maximize Speed
Preprocessor Definitions:
WIN32,NDEBUG,_WINDOWS,_UNICODE
Category: C++ Language
Representation method: Best-Case Always *
Enable exception handling: checked
Category: Code Generation
Processor: Blend *
Use run-time library: Multithreaded DLL
Calling convention: __cdecl *
Struct member alignment: 8 Bytes *
Category: Customize
Suppress startup banner and information messages: checked
Category: Optimizations
Optimizations: Maximize Speed
Inline function expansion: Only __inline
Category: Precompiled Headers
Not using precompiled headers: checked
Category: Preprocessor

Teradata Meta Data Services Programmer Guide

107

Chapter 4: C++ Project Settings


Linking an MDS Application
Preprocessor Definitions:
WIN32,NDEBUG,_WINDOWS,_UNICODE
Additional include directories: METAHOME\include
Link tab
Category: Input
Object/library modules: add metadku.lib metaoscu.lib
Additional library path: METAHOME\lib

Win32 Debug Unicode


C/C++ tab
Category: General
Warning level: Level 3
Debug info: Program Database
Optimizations: Disable (Debug)
Preprocessor Definitions:
WIN32,_DEBUG,_WINDOWS,_UNICODE
Category: C++ Language
Representation method: Best-Case Always *
Enable exception handling: checked
Category: Code Generation
Processor: Blend *
Use run-time library: Debug Multithreaded DLL
Calling convention: __cdecl *
Struct member alignment: 8 Bytes *
Category: Customize
Eliminate duplicate strings: checked
Enable minimal rebuild: checked
Suppress startup banner and information messages: checked
Category: Optimizations
Optimizations: Disable (Debug)
Inline function expansion: Disable *
Category: Precompiled Headers
Not using precompiled headers: checked
Category: Preprocessor
Preprocessor Definitions:
WIN32,_DEBUG,_WINDOWS,_UNICODE
Additional include directories: METAHOME\include
Link tab
Category: Input
Object/library modules: add metadkud.lib metaoscud.lib
Additional library path: METAHOME\lib

Linking an MDS Application


The following libraries need to be added to link an MDS application:

DEBUG Mode Libraries


The following is a list of the Debug mode libraries you need to link to your application.

108

metadkd.lib

metaoscd.lib

Teradata Meta Data Services Programmer Guide

Chapter 4: C++ Project Settings


Linking an MDS Application

UNICODE DEBUG Mode Libraries


The following is a list of the UNICODE Debug mode libraries you need to link to your
application.

metadkud.lib

metaoscud.lib

RELEASE Mode Libraries


The following is a list of the Release mode libraries you need to link to your application.

metadk.lib

metaosc.lib

UNICODE RELEASE Mode Libraries


The following is a list of the UNICODE Release mode libraries you need to link to your
application.

metadku.lib

metaoscu.lib

All MDS library files are installed in <MDS Installation directory>/lib. You must have installed
the MDS SDK to get these libraries.

Teradata Meta Data Services Programmer Guide

109

Chapter 4: C++ Project Settings


Linking an MDS Application

110

Teradata Meta Data Services Programmer Guide

CHAPTER 5

CMetaRepository Class

This chapter describes the C++ Class CMetaRepository functions used to connect to MDS,
manage transactions, and get object identifiers.

CMetaRepository Class Functions


The CMetaRepository class functions are:

Initialize

BeginTransaction

Commit

Rollback

RetryDDL

GetRepositoryRoot

GetObjectID

GetOdbcHenv

Deinitialize

SignOn

SignOff

IsVersioningEnabled

RetainBusinessObjectsSupported

SetRetainBusinessObjects

GetSystemName

SuperUserLogon

These functions are discussed more fully in the following paragraphs.

Teradata Meta Data Services Programmer Guide

111

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

Initialize
Purpose
The CMetaRepository class Initialize function creates a connection to the MDS repository
database.
Description
The connection remains until the Deinitialize function is called or the process or thread is
terminated. Applications should always call the Deinitialize function before terminating to
ensure that the database connection is terminated properly.
Note: For multi-threaded application, each thread must call Initialize (or SignOn) and each
thread will have a separate connection to the MDS repository database.
Requirements
Initialize must be called before any other MDS APIs.
Syntax
HRESULT Initialize (LPCTSTR User,
LPCTSTR Password,
HENV henv = SQL_NULL_HENV);

Argument

In/Out

Description

User

In

User name. The user name determines access to objects in the


repository. Users are created in the MetaManager utility.
Lookup of the user name is not case sensitive.

Password

In

Password for user.


Lookup of the password is case sensitive.

henv

In
(optional)

ODBC HENV pointer. ODBC only permits one HENV pointer


per process. If a client application is using ODBC separately from
MDS, it should create the HENV pointer and pass it to MDS.
If henv is SQL_NULL_HENV on Initialize, MDS will create a
HENV pointer. The CMetaRepository.GetOdbcHenv() function
can be used to get the HENV pointer created by MDS.

BeginTransaction
Purpose
The CMetaRepository class BeginTransaction function starts a new explicit transaction and
sets the transaction nesting level counter to one or increments the nesting level counter.
Description
If an explicit transaction is not currently open, the CMetaRepository class BeginTransaction
function starts a new one and sets the transaction nesting level counter to one.

112

Teradata Meta Data Services Programmer Guide

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

If an explicit transaction is already open, the BeginTransaction function increments the


nesting level counter.
Note: The nested transactions within an explicit transaction are not separate transactions, but
are part of a single flat transaction, so the BeginTransaction function only opens a new
transaction if there is not one already open.
Syntax
HRESULT

BeginTransaction();

Commit
Purpose
Depending upon the status of transactions, the CMetaRepository class Commit function
decrements the transaction nesting level counter, closes an explicit transaction, commits the
transaction to the database or rolls the transaction back and.
Description
If an explicit transaction is currently open, the CMetaRepository class Commit function
decrements the transaction nesting level counter. If the new counter value is zero, the function
closes the explicit transaction.
If there were no errors anywhere in the transaction, the function commits the transaction to
the database and returns a success code. Otherwise, the function rolls the entire explicit
transaction back and returns an error code.
If the user calls the Commit function when there is no explicit transaction open, Commit
returns an error code.
Note: The nested transactions within an explicit transaction are not separate transactions, but
are part of a single flat transaction, so the Commit function does not actually commit any
work to the database until the nesting counter reaches zero, indicating that the entire outer flat
transaction is closed
Syntax
HRESULT

Commit(SERIAL_t *txSerial=NULL);

Argument

In/Out

Description

txSerial

Out
(Optional)

Returned transaction number.


The transaction number is returned only in transactions which
contain multiple DLL statements where the Commit of the
transaction with the first DDL statement succeeded but a
subsequent DDL statement failed.
The transaction number is used to retry the DDL, once the
database problem is fixed.
See Behavior of Transactions Containing DDL Statements
for more information.

Teradata Meta Data Services Programmer Guide

113

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

Rollback
Purpose
The CMetaRepository class Rollback function resets the transaction nesting level counter to
zero and closes an open explicit transaction.
Description
If an explicit transaction is currently open, the CMetaRepository class Rollback function resets
the transaction nesting level counter to zero and closes the transaction. The entire explicit
transaction is rolled back.
Nested transactions within an explicit transaction are not separate transactions, but are part
of a single flat transaction, so the Rollback function rolls all such nested transactions back.
If the user calls the Rollback function when there is no explicit transaction open, the Rollback
function returns an error code.
Note: The Rollback function closes all nesting levels of the currently open transaction and
terminates the entire transaction, whereas the Commit function closes only the current
nesting level.
Syntax
HRESULT

Rollback();

RetryDDL
Purpose
The CMetaRepository class RetryDDL function retries applying the DDL changes for the
specified transaction number.
Syntax
HRESULT RetryDDL(SERIAL_t txSerial=NULL);

Argument

In/Out

Description

txSerial

In
(Optional)

Transaction number. Specify the transaction number returned


from the Commit statement that partially succeeded.
If txSerial is NULL, the DDLs for all existing entries in the DDL
table will be retried.
See Behavior of Transactions Containing DDL Statements for
more information.

GetRepositoryRoot
Purpose
The CMetaRepository class GetRepositoryRoot function returns the root repository object.

114

Teradata Meta Data Services Programmer Guide

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

Description
The root repository object allows navigation to the collection of AIM metamodels or to the
top level class in an AIM.
The root repository object contains system-wide parameters.
Syntax
HRESULT

GetRepositoryRoot (CMetaObject* &MetaRoot);

Argument

In/Out

Description

MetaRoot

Out

Returned root repository object.

GetObjectID
Purpose
The CMetaRepository class GetObjectID function returns the internal object ID of the object
specified by global object identifier or class ID and name.
Syntax
HRESULT GetObjectID (const GUID &guid,
LPOBJECTID objid);
HRESULT GetObjectID(const GUID &gClassID,
const LPCTSTR strObjName,
LPOBJECTID objid);
HRESULT GetObjectID(const OBJECTID_t lClassID,
const LPCTSTR strObjName,
LPOBJECTID objid);
HRESULT GetObjectID (const GUID &guid,
LPOBJECTID objid)
const bool ErrIfNotFound);
HRESULT GetObjectID(const GUID &gClassID,
const LPCTSTR strObjName,
LPOBJECTID objid)
const bool ErrIfNotFound);
HRESULT GetObjectID(const OBJECTID_t lClassID,
const LPCTSTR strObjName,
LPOBJECTID objid)
const bool ErrIfNotFound);

Argument

In/Out

Description

guid

In

Global identifier of object.

gClassID

In

Global identifier of the class.

lClassID

In

Internal identifier of the class.

strObjName

In

Name of the object.

objid

Out

ObjectID of specified object.

Teradata Meta Data Services Programmer Guide

115

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

Argument

In/Out

Description

ErrIfNotFound

In

Boolean to indicate if the function should return an error if the


specified object ID is not found. True equals return an error. False
equals if the objectID is not found, objid will be set to 0 and
HRESULT=S_OK. If the function returns an error, the current
transaction will be aborted.

GetOdbcHenv
Purpose
The CMetaRepository class GetOdbcHenv function returns the ODBC HENV pointer created
by Meta Data Services.
Description
ODBC only permits one HENV pointer per process. If a client application is using ODBC
separately from MDS, it can create the HENV pointer and pass it to MDS in the Initialize
function.
If henv is SQL_NULL_HENV on Initialize, MDS will create a HENV pointer. The
CMetaRepository.GetOdbcHenv function can be used to get the HENV pointer created by
MDS.
Syntax
HENV GetOdbcHenv();

Deinitialize
Purpose
The CMetaRepository class Deinitialize function removes the connection to the MDS
Repository database in the process or thread.
Description
Applications should always call the Deinitialize function before terminating to ensure that the
database connection is terminated properly.
Syntax
HRESULT Deinitialize ();

SignOn
Purpose
The CMetaRepository class SignOn function allows multiple users to sign on to MDS. An
MDS username and password are required.

116

Teradata Meta Data Services Programmer Guide

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

Description
SignOn can be called in replace of Initialize. If not previously initialized, SignOn will set up
the connection to the MDS repository database. The connection remains until DeInitialize is
called or the thread or process terminates. Applications should always call the Deinitialize
function before terminating to ensure that the database connection is terminated properly.
For a multi-threaded application, each thread must call Initialize or SignOn and each thread
will have a separate connection to the MDS Repository database.
If SignOn is issued for multiple users, you must set the CallerName in the object before using
a CMetaObject function to indicate which users permission to apply for the function call.
Syntax
HRESULT SignOn(LPCTSTR strUser, LPCTSTR strPassword);

SignOff
Purpose
The CMetaRepository class SignOff function is used to sign off the specified MDS user.
Description
The SignOff of the last user does not remove the connection to the MDS Repository database.
Be sure to call the Deinitialize function before terminating your application to ensure that the
database connection is terminated properly.
Syntax
HRESULT SignOff(LPCTSTR strUser);

IsVersioningEnabled
Purpose
IsVersioningEnabled returns an indication of the current state of data versioning at the
repository level.
Description
If the return value is true, data versioning is allowed in the repository. If the return value is
false, data versioning may not be used in the repository
Syntax
HRESULT IsVersioningEnabled(bool& fVersioning);

Argument

In/Out

Description

fVersioning

Out

Returns state of data versioning in the repository.

Teradata Meta Data Services Programmer Guide

117

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

RetainBusinessObjectsSupported
Purpose
RetainBusinessObjectsSupported returns an indication of the current repository setting for
the support of retaining business objects in a dormant state.
Description
If the return value is true, deleted business objects are retained in a dormant state in the
repository. If the return value is false, dormant objects are not allowed in the repository.
Syntax
HRESULT RetainBusinessObjectsSupported (bool& bDormantObjects);

Argument

In/Out

Description

bDormantObjects

Out

Indicates if dormant objects are supported in the repository

SetRetainBusinessObjects
Purpose
SetRetainBusinessObjects modifies the state of retaining business objects in a dormant state.
Description
If the input value is true, dormant DIM objects will be allowed. If the input value is false,
support of dormant DIM objects will be disabled and any existing dormant objects in the
repository will be removed from the repository.
Syntax
HRESULT SetRetainBusinessObjects(const bool bRetainObjects);

Argument

In/Out

Description

RetainObjects

In

True = enable dormant objects


False = disable dormant object

GetSystemName
Purpose
GetSystemName returns the name of the system containing the MDS repository.
Syntax
LPCTSTR GetSystemName();

118

Teradata Meta Data Services Programmer Guide

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

SuperUserLogon
Purpose
SuperUserLogon returns an indication if the user given by strUser is currently logged onto
MDS as a superuser.
Description
If strUser is NULL, the return value indicates if the first user to logon to MDS is a superuser.
If strUser is not NULL then

if the name is found in the list of currently logged on users, that user's superuser status is
returned.

If the name is not found in the list of currently logged on users, a value of false is returned.

Syntax
bool SuperUserlogon(LPCTSTR strUser);

Argument

In/Out

Description

strUser

In

Name of user to query; if NULL, uses name of first user logon

Teradata Meta Data Services Programmer Guide

119

Chapter 5: CMetaRepository Class


CMetaRepository Class Functions

120

Teradata Meta Data Services Programmer Guide

CHAPTER 6

CMetaPersist Class

This chapter describes the C++ Class CMetaPersist functions that provide the get and set
functions for the common attributes of all objects that are stored in the repository.
CMetaPersist is the abstract base class from which the CMetaObject MDS API class inherits.
The following classes inherit from CMetaObject, therefore, they also support CMetaPersist
functions:

CMetaAIM

CMetaClassDesc

CMetaPropertyDesc

CMetaRelationshipDesc

CMetaUser

CMetaApplicationGroup

CMetaSecurityProfile

Because the CMetaPersist class is an abstract base class, you cannot create CMetaPersist
objects.

CMetaPersist Class Functions


The Get and Set functions in the CMetaPersist class get and set data in the instantiated object
in program memory.
To get an object from the MDS repository, the program must issue the ReadObject function.
To write an object to the MDS repository, the program must issue the WriteObject function.
(ReadObject and WriteObject are functions of the CMetaObject and CMetaCOM classes.)
The CMetaPersist class functions are:

Initialize

GetObjectName

SetObjectName

GetDescription

SetDescription

GetObjectGUID

SetObjectGUID

GetObjectID

Teradata Meta Data Services Programmer Guide

121

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

SetObjectID

GetClassGUID

SetClassGUID

GetClassID

SetClassID

GetOwnerID

SetOwnerID

GetCreateTimestamp

GetUpdateTimestamp

GetCallerName

SetCallerName

GetSecurityProfileID

SetSecurityProfileID

GetVersionNumber

GetPublishState

IsPublished

IsFrozen

IsDormant

These functions are described more fully in the following paragraphs.

Initialize
Purpose
The CMetaPersist class Initialize function resets the CMetaPersist attributes to the default
values.
Syntax
void Initialize(void);

GetObjectName
Purpose
The CMetaPersist class GetObjectName retrieves the object name.
Syntax
LPCTSTR GetObjectName(void);

SetObjectName
Purpose
The CMetaPersist class SetObjectName function sets the object name.

122

Teradata Meta Data Services Programmer Guide

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

Syntax
void SetObjectName(LPCTSTR strObjName);

Argument

In/Out

Description

strObjName

In

Object name. Object names are limited to 255 characters.

GetDescription
Purpose
The CMetaPersist class GetDescription function gets the object's description.
Syntax
LPCTSTR GetDescription(void);

SetDescription
Purpose
The CMetaPersist classSetDescription function sets the objects description.
Syntax
void SetDescription(LPCTSTR strDescription);

Argument

In/Out

Description

strDescription

In

Description of the object. Descriptions are limited to 1024


characters.

GetObjectGUID
Purpose
The CMetaPersist class GetObjectGUID function gets the globally unique ID of the object.
Syntax
const GUID GetObjectGUID(void);

SetObjectGUID
Purpose
The CMetaPersist class SetObjectGUID function sets the globally unique ID of the object.
Description
The ID should be created by a program such as guidgen.exe on WindowsTM. If the object
GUID is not set (equal to NULLGUID) on the WriteObject of a new object to the MDS
repository, MDS generates a GUID for the object.

Teradata Meta Data Services Programmer Guide

123

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

Syntax
void SetObjectGUID(const GUID gOID);

Argument

In/Out

Description

gOID

In

The object ID of the object.

GetObjectID
Purpose
The CMetaPersist class GetObjectID function gets the internal object ID of the object.
Syntax
const OBJECTID_t GetObjectID(void);

SetObjectID
Purpose
The CMetaPersist class SetObjectID function sets the object ID of the CMetaObject.
Requirements
To write a new object to the MDS repository, the object ID must be set to 0 (zero). If the object
ID is not 0 (zero), MDS assumes the WriteObject is an update of the specified object ID.
To read or update an object or a collection of objects, or to add or remove an object from a
collection, the object ID must be a known ID of an existing object.
Syntax
void SetObjectID(const OBJECTID_t lOID);

Argument

In/Out

Description

lOID

In

The object ID of the object.

GetClassGUID
Purpose
The CMetaPersist class GetClassGUID function gets the class ID of the object, which is of type
GUID.
Syntax
const GUID GetClassGUID(void);

124

Teradata Meta Data Services Programmer Guide

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

SetClassGUID
Purpose
The CMetaPersist class SetClassGUID function sets the globally unique class ID in the local
object. This is the Class GUID of the class description object given or created for the class
when the AIM was created.
Set this field when you want to read or write an object in the indicated class.
Syntax
void SetClassGUID(const GUID gCLSID);

Argument

In/Out

Description

gCLSID

In

Class ID of the object.

GetClassID
Purpose
The CMetaPersist class GetClassID function gets the internal class ID of the object.
Syntax
const OBJECTID_t GetClassID(void);

SetClassID
Purpose
The CMetaPersist class SetClassID function sets the internal class ID in the local object.
The internal class ID is the ID of the class description object created for the class when the
AIM was created.
Set this field when you want to read or write an object in the indicated class.
Syntax
void SetClassID(const OBJECTID_t CLSID);

Argument

In/Out

Description

CLSID

In

Internal class ID of the object.

GetOwnerID
Purpose
The CMetaPersist class GetOwnerID function gets the owner user ID of the object.

Teradata Meta Data Services Programmer Guide

125

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

Syntax
const OBJECTID_t GetOwnerID(void);

SetOwnerID
Purpose
The CMetaPersist class SetOwner sets the owner user ID of the CMetaObject.
Description
If this attribute is not set (or set to 0 (zero)), the owner ID of a new object is set to the user
specified in CMetaRepository::Initialize.
Syntax
void SetOwnerID(const OBJECTID_t

OwnerID);

Argument

In/Out

Description

OwnerID

In

User internal ID which is to be the owner of the object.

Example:
To get the user ID from the user name, perform the following function call using the
CMetaRepository class:
CMetaRepository repos;
result = repos.GetObjectID(CLSLOID_UserClass,
UserName, &userID);

GetCreateTimestamp
Purpose
The CMetaPersist class GetCreateTimestamp function gets the object creation date and time.
Syntax
HRESULT GetCreateTimestamp(METADATE_STRUCT
*pcreateDate, METATIME_STRUCT *pcreateTime);

Argument

In/Out

Description

pcreateDate

Out

The year, month, day (create date) the object was created.

pcreateTime

Out

The hour, minute, second (time) the object was created.

GetUpdateTimestamp
Purpose
The CMetaPersist class GetUpdateTimestamp function gets the date and time of the last
update of the object.

126

Teradata Meta Data Services Programmer Guide

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

Syntax
HRESULT GetUpdateTimestamp(METADATE_STRUCT
*pupdateDate, METATIME_STRUCT *ppupdateTime);

Argument

In/Out

Description

pUpdateDate

Out

The year, month, day (update date) the object was last updated

pUpdateTime

Out

The hour, minute, second (update time) the object was last updated

GetCallerName
Purpose
The CMetaPersist class GetCallerName function gets the user name of the caller set in the
object.
Syntax
LPCTSTR GetCallerName(void);

SetCallerName
Purpose
The CMetaPersist class GetCallerName function sets the caller name to the specified user.
Description
Subsequent function calls using this object will be validated using the caller users
permissions.
Syntax
void SetCallerName(LPCTSTR user);

Argument

In/Out

Description

user

In

Name of signed on user to use for function calls from this object.

GetSecurityProfileID
Purpose
The CMetaPersist class GetSecurityProfileID function gets the ID of the security profile of the
object.
Syntax
const OBJECTID_t GetSecurityProfileID (void);

Teradata Meta Data Services Programmer Guide

127

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

SetSecurityProfileID
Purpose
The CMetaPersist class SetSecurityProfileID function sets the ID of the security profile of the
CMetaObject.
Syntax
void SetSecurityProfileID (const OBJECTID_t 1SecurityProfile);

Argument

In/Out

Description

ISecurityProfile

In

Security Profile to assign to this object.

GetVersionNumber
Purpose
GetVersionNumber retrieves the version number for the object.
Syntax
VERSIONNUMBER_t GetVersionNumber(void) const;

GetPublishState
Purpose
GetPublishState returns the PublishState common property for an object.
Syntax
META_PUBLISH_STATE GetPublishState(void) const;

IsPublished
The IsPublished function returns true if the version's publish state indicates that it is the
current published version, else it returns false
bool IsPublished(void) const;

IsFrozen
Purpose
IsFrozen indicates if the object version can be modified.
Description
A value of true means the version's properties in the repository can not be changed. A value of
false means the version's properties in the repository can be changed.
Syntax
bool IsFrozen();

128

Teradata Meta Data Services Programmer Guide

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

IsDormant
Purpose
IsDormant indicates if the object version is in a dormant state.
Description
A value of true means the object is dormant and is not normally visible. A value of false
means the object exists and is visible..
Syntax
bool IsDormant();

Teradata Meta Data Services Programmer Guide

129

Chapter 6: CMetaPersist Class


CMetaPersist Class Functions

130

Teradata Meta Data Services Programmer Guide

CHAPTER 7

CMetaObject Class

This chapter describes the C++ Class CMetaObject functions that create, update, and delete
objects in the MDS repository and that create and update collections of objects. CMetaObject
inherits all the functions of the CMetaPersist class.

CMetaObject Class Functions


Table 45 lists the CMetaObject class functions described in this chapter.
Table 45: CMetaObject class functions

CMetaObject Constructors

Initialize

Operator =

Operator ==

Operator <

ReadObject

ReadObjectWithLock

ReadVersion

ReadVersionWithLock

ReadDormantDIMObject

ReadDormantDIMObjectWithLock

GetVersions

GetVersionKeys

GetClassObjects

GetClassObjects

GetClassObjectVersions

GetOrigCollection

GetDestCollection

GetDormantDIMClassObjects

GetDormantDIMClassObjectKeys

GetDormantDIMDestObject

WriteObject

WriteVersion

Delete

DeleteVersion

DeleteVersionRange

ReactivateDIMObject

AddToOrigCollection

AddToDestCollection

AddManyToOrigCollection

AddManyToDestCollection

RemoveFromOrigCollection

RemoveFromDestCollection

RemoveManyFromOrigCollection

RemoveManyFromDestCollection

RemoveAllFromOrigCollection2

RemoveAllFromDestCollection2

ReplaceOrigCollection

Teradata Meta Data Services Programmer Guide

131

Chapter 7: CMetaObject Class


CMetaObject Class Functions
Table 45: CMetaObject class functions (continued)

ReplaceDestCollection

FindLabel

FindAllLabels

FindAllOccurrences

GetPropertyValue

GetClassObjectKeys

GetClassObjectVersionKeys

SetPropertyValue

GetClassObjectsByProperty

GetClassObjectVersionsByProperty

GetClassObjectRange

GetClassObjectVersionsRange

GetOrigCollectionByProperty

GetDestCollectionByProperty

GetOrigCollection3

GetDestCollection3

GetOrigCollectionVersions

GetDestCollectionVersions

GetOrigCollectionVersionKeys

GetDestCollectionVersionKeys

GetOrigCollectionKeys

GetDestCollectionKeys

GetOrigCollectionKeys3

GetDestCollectionKeys3

GetDormantDIMOrigCollection

GetDormantDIMDestCollection

GetDormantDIMOrigCollectionKeys

GetDormantDIMDestCollectionKeys

Dormant Objects
The Retain Associated Business Information feature is implemented by creating dormant
object support for certain types of objects when the objects are deleted. The following routines
work with dormant objects.

ReadDormantDIMObject

ReadDormantDIMObjectWithLock

GetDormantDIMClassObjects

GetDormantDIMClassObjectKeys

GetDormantDIMDestObject

GetDormantDIMDestCollection

GetDormantDIMDestCollectionKeys

GetDormantDIMOrigCollection

GetDormantDIMOrigCollectionKeys

Functions with Additional Search Options


The GetDestCollection, GetOrigCollection, and GetClassObjects functions will return the
entire collection of objects associated with the object or class, and if a name is specified
returns only the objects matching the name.

132

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

The following functions allow for further refinement of the objects returned in the collection
or class. This refinement is based on matching property values in the destination or origin
objects.

GetClassObjectsByProperty

GetClassObjectVersionsByProperty

GetClassObjectRange

GetClassObjectVersionsRange

GetDestCollection3

GetDestCollectionByProperty

GetDestCollectionKeys

GetDestCollectionKeys3

GetDestCollectionVersions

GetDestCollectionVersionKeys

GetOrigCollection3

GetOrigCollectionByProperty

GetOrigCollectionKeys

GetOrigCollectionKeys3

GetOrigCollectionVersions

GetOrigCollectionVersionKeys

GetDormantDIMDestCollection

GetDormantDIMDestCollectionKeys

GetDormantDIMOrigCollection

GetDormantDIMOrigCollectionKeys

Sort List
The sortList can contain zero or more CMetaObjectKey objects. Each CMetaObjectKey
identifies a property by ID or name on which to sort the returned objects. The sort key created
is constructed by concatenating the property values.
The maximum size of the sort key is limited to 4096 bytes. If the sort key is greater than 4096
bytes, the key is truncated and the data may or may not come back in the desired order.
By default, the result values of a character property are sorted in ascending order, using the
collating sequence in effect for the Teradata session.
To enable specifying sort by ascending or descending order, use one of the following two
property values:

PID_SORT_ASCENDING

PID_SORT_DESCENDING

These variables are defined in metaglobals.h. To set the sort order to descending, set a
CMetaObjectKey ObjectID to PID_SORT_DESCENDING and push the object on the sortList
vector. For example:

Teradata Meta Data Services Programmer Guide

133

Chapter 7: CMetaObject Class


CMetaObject Class Functions
CLEARVECTOR(sortList);
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);
propID.SetObjectID(PID_SORT_DESCENDING);
sortList.push_back(propID);
result = obj.GetClassObjectsByProperty(objectList, propFilter,
sortList, gClassID, lClassID, strObjName);
result = obj.GetClassObjectsByProperty(objectList, propFilter, sortList,
gClassID, lClassID, strObjName);

If keys specifying both PID_SORT_ASCENDING and PID_SORT_DESCENDING are pushed


on the list, the sort order will be ascending.
Name Search
To add a search on the name field of the objects in the collection, a character string expression
can be specified in strObjName. This search will return objects which have names which
contain a match of a character string pattern within the object name. The following describes
the search string value:

The search string value can be any character string.

The % and _ characters may be used in any combination in the search string

The % (percent sign) character represents any string of zero or more arbitrary characters.

The _ (spacing underscore) character represents exactly one arbitrary character.

Any single character is acceptable in the position in which the underscore character
appears, and any string of characters is acceptable as a replacement for the percent.

The backslash character (\) can be used as an escape character to search for the \, % or _
characters ( \\, \%, \_ ) in the name.

Both leading and trailing pad characters in the name field must match exactly with the
search string. For example, A%BC matches AxxBC, but not AxxBD, and A%BD
matches AxxBD, but not AxxBC or AxxBD indicates a pad character).

The name search in the functions in the GetClassObjects and GetClassObjectsByProperty


differ by the use of the percent and underscore characters.
In the GetClassObjects function, if the search string contains a % or _, objects are returned
only if the name matches those characters exactly. For example, if the search string is
ABC_123, the only objects returned are those with the name ABC_123.
In the GetClassObjectsByProperty function, the _ (underscore) character is a wildcard
character which represents one arbitrary character, so the search string ABC_123 will return
objects with the names: ABC_123, ABC 123, ABCZ123, and ABC1123. To return a
match for only the object name ABC_123, you must use the backslash escape character in
the search string ABC\_123.
If a strObjName is set and search properties are set in the propFilter, the search will be
performed on the name AND the values in the propFilter.
The propFilter can also contain object names for searching. The differences between using the
strObjName parameter and setting the object name in the propFilter are:

134

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

The name in the strObjName parameter is always ANDd to the values in the propFilter
list. A name in the propFilter can be ORd to other values in the propFilter.

The name in the strObjName parameter is always compared using the REGEX comparison
operator. A name in the propFilter can be set to use any of the other comparison
operators.

Column Filter
Some interfaces provide a column filters parameter. This parameter provides an additional
method to restrict the properties returned for an object. This will reduce the amount of data
transmitted from the repository.
The column filters parameter is a vector of type MetaObjectIDVector. Each entry in the vector
provides the relative propertyID for a property in a class. A property ID can be either one of
the unique properties for the class or it can be one of the common properties present in all
CMetaObject objects. The common properties IDs are defined in the C++ include deck
metaglobals.h and range from PID_CMN_NAME to PID_CMN_ISFROZEN.
Due to processing requirements within MDS, the following common properties will always be
fetched from the repository: PID_CMN_NAME, PID_CMN_OWNERID, PID_CMN_LOID,
and PID_CMN_SECURITYPROFID.
If the column filters parameter is an empty vector, all properties for the objects will be
returned by the interface.
If a non-empty column filters parameter is used, the properties not listed in the vector will
have undefined values in the returned objects. The properties not listed will not be set up by
MDS; this applies to both the unique class properties and the common properties.
Inheritance
A class inherits all the relationships of its superclasses. In Figure 23, there is a relationship
called RelAM that has the origin class of ClassA and the destination class of ClassM. Classes
that inherit from ClassA and ClassM also inherit the relationship. ClassB and ClassC objects
can be origin objects in the relationship and ClassN and ClassO objects can be destination
objects.
Figure 23: Class Inheritance and Collections
Relationship: RelAM
Origin Class: ClassA
DestClass: ClassM
ClassA

Collections
A1
ClassM

M1

RelAM

M3

M2
B Inherits
From A

N Inherits
From M
ClassB

A1
N1

ClassN

O1

O Inherits
From N
ClassC

RelAM

N3

N2

A1
C Inherits
From B

RelAM

O3

O2
ClassO

3047C014

Teradata Meta Data Services Programmer Guide

135

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Figure 23 also shows example collections. In the examples, object A1 has collections with class
M, N, and O objects using the RelAM relationship. The returnClass and allClasses parameters
of GetDestCollection3 determine the class of objects that are returned. To return one specific
class type, set the returnClass to this value. For example to return the collection of ClassN
objects for A1, set the returnClass to the object id of ClassN. To return all destination class
types, set allClasses to true. Getting the destinations objects of A1 in RelAM with allClasses set
to true will return the objects M1,M2,M3,N1,N2,N3,O1,O2, and O3.

CMetaObject Constructors
The first step for users of the CMetaObject class is to instantiate the CMetaObject by calling
one of the constructors for the CMetaObject. The following are the CMetaObject
constructors:
CMetaObject()
This is the default constructor and takes no arguments. It instantiates a CMetaObject with
default values.
CMetaObject(const GUID &gClassID, LPCTSTR strObjName)
This constructor instantiates a CMetaObject with default values and then calls
CMetaPersist::SetClassGUID with gClassID and CMetaPersist::SetObjectName with
strObjName.
CMetaObject(const OBJECTID_t lClassID, LPCTSTR strObjName)
This constructor instantiates a CMetaObject with default values and then calls
CMetaPersist::SetClass with : lClassID and CMetaPersist::SetObjectName with strObjName.
CMetaObject(const OBJECTID_t lOID)
This constructor instantiates a CMetaObject with default values and then calls
CMetaPersist::SetObjectID with lOID.

Initialize
Purpose
Initializes the CMetaObject fields to default values.
Syntax
void Initialize();

136

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Operator =
Purpose
The CMetaObject class = operator function copies objectB to objectA.
Syntax
CMetaObject &operator=(const CMetaObject &);

Usage
CMetaObject objectA, objectB;
.
.
.
objectA = objectB;

Copies Object A to Object B.

Operator ==
Purpose
The CMetaObject class == operator function returns 1 if objectA is equal to objectB, 0 if the
objects are not equal.
Syntax
int operator==(const CMetaObject &);

Usage
CMetaObject objectA, objectB;
.
.
.
if (objectA == objectB)
//objects are equal
.
.
.
else
//objects are not equal
.
.
.

Teradata Meta Data Services Programmer Guide

137

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Operator <
Purpose
The CMetaObject class < operator function returns TRUE if the Object ID of objectA is less
than the Object ID objectB.
Syntax
bool operator<(const CMetaObject &object);

Usage
CMetaObject objectA, objectB;
.
.
.
if (objectA < objectB)
//object identifier A is less than object identifier B
.
.
.
else
//object identifier A is not less than object identifier B
.
.

ReadObject
Purpose
The CMetaObject class ReadObject function reads the current version of an object from the
repository database into the instantiated CMetaObject. This may require waiting for the
release of write locks held by other transactions. MDS does not support reads of write-locked
MDS repository data.
Requirements
The class ID (internal or globally unique) and object name or the object ID (internal or
globally unique) must be set before calling ReadObject. If given, the internal object ID must
be for a version of the object.
Note: The order of evaluation to determine the object to be read is: (1) internal object ID if
not zero; (2) global object ID if not null; (3) internal class ID and name if the internal class ID
is not zero; and (4) global class ID and name.
Syntax
HRESULT ReadObject(void);

138

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

ReadObjectWithLock
Purpose
ReadObjectWithLock reads in the current version of an object from the repository into the
instantiated CMetaObject. ReadObjectWithLock differs from ReadObject in that it acquires
all database locks necessary to both read and write the object. For a subsequent WriteObject
on this object, this will prevent a deadlock caused by lock upgrades. This function should
always be used within an explicit transaction to retain the locks since locks are maintained
until the transaction commits or rolls back.
Requirements
The class ID (internal or globally unique) and object name or the object ID (internal or
globally unique) must be set before calling ReadObjectWithLock.
Note: The order of evaluation to determine the object to be read is: (1) internal object ID if
not zero; (2) global object ID if not null; (3) internal class ID and name if the internal class ID
is not zero; and (4) global class ID and name
Syntax
HRESULT ReadObjectWithLock();

ReadVersion
Purpose
ReadVersion reads in a specific version of an object from the repository into the instantiated
CMetaObject. This may require waiting for write locks held by other transactions to be
released. MDS does not support reads of write-locked MDS repository data
Requirements
The internal object ID for the desired version must be set before calling ReadVersion.
Syntax
HRESULT ReadVersion(void);

ReadVersionWithLock
Purpose
ReadVersionWithLock reads in a specific version of an object from the repository into the
instantiated CMetaObject. ReadVersionWithLock differs from ReadVersion in that it acquires
all database locks necessary to both read and write the object. For a subsequent WriteVersion
on this object, this will prevent a deadlock caused by lock upgrades. This function should
always be used within an explicit transaction to retain the locks since locks are maintained
until the transaction commits or rolls back.

Teradata Meta Data Services Programmer Guide

139

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements
The internal object ID for the desired version must be set before calling
ReadVersionWithLock.
Syntax
HRESULT ReadVersionWithLock();

ReadDormantDIMObject
Purpose
ReadDormantDIMObject extends the functionality of ReadObject to support the Retain
Associated Business Information feature. ReadDormantDIMObject returns an object that is
either active or dormant. The requirements for specifying the object to be returned are the
same as for ReadObject.
If the return status is S_OK, the caller should call IsDormant() to determine if the object exists
or is dormant.
Requirements
You must be initialized as an MDS Administrator (superuser) to use this function.
The class ID (internal or globally unique) and object name or the object ID (internal or
globally unique) must be set before calling ReadDormantDIMObject. If given, the internal
object ID must be for a version of the object.
Syntax
HRESULT ReadDormantDIMObject();

ReadDormantDIMObjectWithLock
Purpose
ReadDormantDIMObjectWithLock extends the functionality of ReadObject to support the
Retain Associated Business Information feature. ReadDormantDIMObjectWithLock returns
an object that is either active or dormant. The requirements for specifying the object to be
returned are the same as for ReadObject. ReadDormantDIMObjectWithLock differs from
ReadDormantDIMObject in that it acquires all database locks necessary to both read and
write the object. For a subsequent WriteObject on this object, this prevents a deadlock caused
by lock upgrades. This function should always be used within an explicit transaction to retain
the locks since locks are maintained until the transaction commits or rolls back.
Requirements
You must be initialized as an MDS Administrator (superuser) to use this function.
The class ID (internal or globally unique) and object name or the object ID (internal or
globally unique) must be set before calling ReadDormantDIMObjectWithLock. If given, the
internal object ID must be for a version of the object.

140

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Syntax
HRESULT ReadDormantDIMObjectWithLock();

GetVersions
Purpose
The CMetaObject class GetVersions returns the objects for all of the versions of an object for
which the caller has read permission. The objects will be ordered in descending order of the
version number, i.e. the object for the highest-numbered (current) version of the object will
be the first entry in the return list.
Description
The order of evaluation to determine the object to be read is:
1

internal object ID if not zero

global object ID if not null

internal class ID and name if the internal class ID is not zero

global class ID and name

Requirements
The class ID (internal or globally unique) and object name or the object ID (internal or
globally unique) must be set before calling GetVersion. If given, the internal object ID must be
for a version of the object.
Syntax
HRESULT GetVersions(MetaObjectVector& returnList);

GetVersionKeys
Purpose
The CMetaObject class GetVersionKeys returns the name, loid, and version for all of the
versions of an object for which the caller has read permission. The keys will be ordered in
descending order of the version number, i.e. the key for the highest-numbered (current)
version of the object will be the first entry in the return list.
Description
The order of evaluation to determine the object to be read is:
1

internal object ID if not zero

global object ID if not null

internal class ID and name if the internal class ID is not zero

global class ID and name

Teradata Meta Data Services Programmer Guide

141

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements
The class ID (internal or globally unique) and object name or the object ID (internal or
globally unique) must be set before calling GetVersionKeys. If given, the internal object ID
must be for a version of the object.
Syntax
HRESULT GetVersionKeys(vector<CMetaVersionedObjectkey>& returnList);

GetClassObjects
Purpose
The CMetaObject class GetClassObjects function returns current versions of objectList (list of
CMetaObjects) in the specified class.
Description
If strObjName is not specified (NULL), all objects in the class are returned.
If strObjName is specified, only the objects of the specified name in the class are returned.
The name search is not case sensitive.
Specifying an empty string () for strObjName returns objects in the class with no name.
Requirements
The internally unique or globally unique class ID must be specified.
The objects in the list returned by GetClassObjects are in ascending sort order of the object
names. Use GetClassObjectsByProperty to specify properties to sort the list by.
Syntax
HRESULT GetClassObjects(
vector<CMetaObject> &objectList,
const GUID &gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL);
HRESULT GetClassObjects(
vector<CMetaObject> &objectList,
const GUID &gClassID,
const OBJECTID_t lClassID,
LPCTSTR strObjName,
const bool WithLock);

142

Argument

In/Out

Description

objectList

In/Out

Reference to the list of CMetaObjects that will hold the


objects returned. The list is cleared before adding the return
collection.

gClassID

In

Class GUID. Can be set to NULLGUID if gClassID is set.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

lClassID

In
(Optional)

Class internal ID. Optional if gClassID is set.

strObjName

In
(Optional)

Specific name of the objects in the class being returned.

WithLock

In

WithLock=true keeps the IClassID 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.

GetClassObjectVersions
Purpose
GetClassObjectVersions returns all versions of the objects (list of CMetaObjects) in the
specified class.
Description
If strObjName is not specified (NULL), all objects in the class are returned.
If strObjName is specified, only the objects of the specified name in the class are returned.
The name search is not case sensitive.
Specifying an empty string () for strObjName returns objects in the class with no name.
If strLabel is specified, only the versions that also have the label will be returned.
Requirements
The internally unique or globally unique class ID must be specified.
The objects in the list returned by GetClassObjectVersions are in ascending sort order of the
object names, and within each name are sorted in descending order of the version number.
Use GetClassObjectsVersionsByProperty to specify properties to sort the list by.
Syntax
HRESULT GetClassObjectVersions(
vector<CMetaObject> &objectList,
const GUID &gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false);

Argument

In/Out

Description

objectList

In/Out

Reference to the list of CMetaObjects that will hold the


objects returned. The list is cleared before adding the return
collection.

Teradata Meta Data Services Programmer Guide

143

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

gClassID

In

Class GUID. Can be set to NULLGUID if gClassID is set.

lClassID

In
(Optional)

Class internal ID. Optional if gClassID is set.

strObjName

In
(Optional)

Specific name of the objects in the class being returned.

strLabel

In

Label to be used as a filter on the returned objects; only


versions with the label are returned

WithLock

In

WithLock=true keeps the IClassID 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.

GetOrigCollection
Purpose
The CMetaObject class GetOrigCollection function returns the collection of objects of the
origin class associated with this CMetaObject for the specified relationship.
If a strObjName is not specified (NULL), all objects in the collection are returned.
If a strObjName is specified, only the objects of the specified name in the collection are
returned. The name search is not case sensitive.
Description
Specifying an empty string () for strObjName returns only objects in the collection with no
name.
When the origin class supports versioning, GetOrigCollection will return object versions in
the origin class that have a rigid relationship to the current version of this CMetaObject. The
returned objects are not guaranteed to be the current version of their respective objects, i.e
CMetaPersist::IsPublished() may be true or false for each returned object
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
CMetaObject must be set with the ObjectID of an object in the destination class of the
relationship.
If the origin class of the relationship is a superclass, this function will only return objects in the
origin class. To return objects in the subclasses, use the GetOrigCollection3 function.
Requirements
The internal object id must be set in the object and it must be for a version of the object.
The objects in the list returned by GetOrigCollection are not in any order. Use
GetOrigCollectionByProperty to specify properties to sort the list by.

144

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Syntax
HRESULT GetOrigCollection(
vector<CMetaObject> &objectList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL);
HRESULT GetOrigCollection(
vector<CMetaObject> &objectList,
const GUID &gRelID,
const OBJECTID_t lRelID,
LPCTSTR strObjName,
const bool WithLock);

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.

gRelID

In

Relationship GUID.
Can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Relationship internal ID.


Optional, if gRelID is set.

strObjName

In
(Optional)

Specific name of objects in the collection to be returned.

WithLock

In

WithLock=true keeps the class table of the Orig Collection


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

GetDestCollection
Purpose
The CMetaObject class GetDestCollection function returns the collection of objects of the
destination class associated with this CMetaObject for the specified relationship.
Description
If a strObjName in the collection is not specified (NULL), then all objects in the collection are
returned.
If strObjName is specified, only the objects of the specified name in the collection are
returned. The name search is not case sensitive.
Specifying an empty string () for strObjName returns only objects in the collection with no
name.
GetDestCollection only returns the current versions of objects referenced by the current
version of this CMetaObject.

Teradata Meta Data Services Programmer Guide

145

Chapter 7: CMetaObject Class


CMetaObject Class Functions

The relationship ID is specified by the GUID relationship ID or the internal relationship ID


(one must be set).
For the GetDestCollection function, CMetaObject must be set with the ObjectID of an object
in the origin class of the relationship.
If the destination class of the relationship is a superclass, this function will only return objects
in the destination class. To return objects in the subclasses, use the GetDestCollection3
function.
Requirements
The internal object id must be set in the object and it must be for a version of the object.
The objects in the list returned by GetDestCollection are not in any order. Use
GetDestCollectionByProperty to specify properties to sort the list by.
Syntax
HRESULT GetDestCollection(
vector<CMetaObject> &objectList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL);
HRESULT GetDestCollection(
vector<CMetaObject> &objectList,
const GUID &gRelID,
const OBJECTID_t lRelID,
LPCTSTR strObjName,
const bool WithLock);

146

Argument

In/Out

Description

objectList

In/Out

Reference to the list of CMetaObjects that holds the collection


returned. The list is cleared before adding the return collection.

gRelID

In

Relationship GUID.
Can be set to NULLGUID if lRelID is set.

lRelID

In (Optional)

Relationship internal ID.


Optional, if gRelID is set.

strObjName

In (Optional)

Specific name of the objects in the collection to be returned.

WithLock

In

WithLock=true keeps the Dest Collection table locked for


WRITE. Use within an explicit transaction. Set WithLock to true
when one of the Dest Collection objects will subsequently be
updated within the transaction. Prevents deadlocks caused by
Teradata promotional locks.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

GetDormantDIMClassObjects
Purpose
GetDormantDIMClassObjects returns in objectList the list of dormant objects in the specified
class that match selection criteria.
Description
The property id, property value and comparison operator on which to perform the search can
all be specified. If multiple properties are specified in the search, the logical operator between
the property searches must also be specified. The name of the property upon which to sort the
returned list can also be specified.
Requirements
You must be initialized as an MDS Administrator (superuser) to use this function.
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 GetDormantDIMClassObjects(
vector<CMetaObject>& objectList,
const MetaFilterInfoVector& propFilter,
const MetaObjectKeyVector& sortlist,
const GUID& gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false);

Teradata Meta Data Services Programmer Guide

147

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

objList

In/Out

Reference to the list of CMetaObjects that will hold the


collection returned. The list is cleared before adding the
return collection.

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.

gClassID

In

Class GUID.

IClassID

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. Prevents deadlocks caused by Teradata
promotional locks.

GetDormantDIMClassObjectKeys
Purpose
GetDormantDIMClassObjectKeys returns a list of CMetaObjectKeys (contains object id and
name only) that identify the dormant objects in the specified class. This API enables a meta
data browser to display the name/id of objects in a class without having to read the entire
collection of objects into memory. This is important for large collections which would
consume a large amount of process space if all read into memory.
Requirements
You must be initialized as an MDS Administrator (superuser) to use this function.
The class ID (internal or globally unique) must be set.
Syntax
HRESULT GetDormantDIMClassObjectKeys(
MetaObjectKeyVector& objectKeyList,
const GUID& gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false);

148

Argument

In/Out

Description

objectKeyList

In/Out

Linked list of CMetaObjectKeys. The list is cleared before


adding the return collection.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

gClassID

In

Class GUID.

IClassID

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. Prevents deadlocks caused by Teradata
promotional locks.

GetDormantDIMDestObject
Purpose
GetDormantDIMDestObject determines if a specific object is dormant or active. sObjName is
the name of an object to search for in the destination class of the relationship.
Description
GetDormantDIMDestObject has three possible return scenarios:

A META_E_OBJECT_NOT_FOUND result indicates that the object does not exist, not
even in dormant form; the returned CMetaObject will have null/default values.

A S_OK and IsPublished()=true result means that the object actually exists in an active
state and the current object will be returned; this would be same as calling
GetDestCollection().

A S_OK and IsDormant()=true result means that the object currently exists in a dormant
form, and the object's previous properties will be returned.

Requirements
You must be initialized as an MDS Administrator (superuser) to use this function.
The calling object must be from the origin class of the relationship specified by relGuid or
relLoid and the calling object must specify the loid or guid of a version of the object.
Syntax
HRESULT GetDormantDIMDestObject(
CMetaObject& returnObj,
LPCTSTR sObjName,
const GUID&relGuid,
const OBJECTID_t relLoid = NULLLOID);

Argument

In/Out

Description

returnObj

In/Out

Object to contain the return object, if found

Teradata Meta Data Services Programmer Guide

149

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

sObjName

In

Name of object to search for in the destination class; may


not be NULL or empty

relGuid

In

Relationship GUID

relLoid

In

Relationship internal ID

WriteObject
Purpose
The CMetaObject class WriteObject function writes the memory object to the repository.
Description
If the object does not exist, the WriteObject function creates the object in the repository. If the
object exists WriteObject will:

overwrite the object in the repository if data versioning is not allowed for the class
containing the object.

will create a new version of the object from the current version of the object if data
versioning is allowed for the class containing the object.

If an existing object is being updated it is strongly recommended that the application do a


ReadObject of the object prior to writing the new values. If a user-defined property is not set
in the object and the object already exists in the repository, WriteObject will:

not change the existing value for the property if data versioning is not allowed for the class
containing the object.

substitute the propertys value from the current version of the object if data versioning is
allowed for the class containing the object.

Requirements
If the object does not exist in the repository, a Class ID attribute is required to be set (internal
or globally unique). All class properties of type SQL_DATE must also be set. The internal
ObjectID set to zero indicates that this object is to be created in the repository. When the
internal ObjectID is not zero, it must be for a version of the object.
Syntax
HRESULT WriteObject(void);

WriteVersion
Purpose
WriteVersion writes out a CMetaObject to the repository. Unlike WriteObject, WriteVersion
always overwrites the current version of the object, i.e. a new version of an existing object is
not created. In all other aspects of functionality, WriteVersion is identical to WriteObject.

150

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements
If the object does not exist in the repository, a Class ID attribute is required to be set (internal
or globally unique). All class properties of type SQL_DATE must also be set. The internal
ObjectID set to zero indicates that this object is to be created in the repository. When the
internal ObjectID is not zero, it must be for a version of the object.
Syntax
HRESULT WriteVersion(void);

Delete
Purpose
The CMetaObject class Delete function deletes all versions of this object from the MDS
repository database. The user must have delete permission on all of the object's versions.
Requirements
The ObjectID must be set in the object. and it must be for a version of the object.
See the section on Delete Propagation in Chapter 3 of this guide.
Syntax
HRESULT Delete(void);

DeleteVersion
Purpose
DeleteVersion deletes a specific version of an object from the MDS Repository database. The
user must have delete permission on the version to be deleted. If the current version is deleted,
then the immediately preceding version will become the current version. Deleting the only
version of an object is the same as issuing Delete().
Requirements
The internal object id must be set in the object and it must be for the version to be deleted.
Syntax
HRESULT DeleteVersion(void);

DeleteVersionRange
Purpose
DeleteVersionRange deletes one or more versions of an object from the MDS Repository
database. The user must have delete permission on the versions to be deleted. startVersion
provides the first version in the range to be deleted; it must have a value greater than zero. If
startVersion is less than one or exceeds the highest numbered version for the object, an error
will be returned. endVersion indicates the last version in the range to be deleted. If endVersion
is not provided, all versions from startVersion through the highest numbered version for the

Teradata Meta Data Services Programmer Guide

151

Chapter 7: CMetaObject Class


CMetaObject Class Functions

object will be deleted. If endVersion is greater than the highest numbered version, the highest
numbered version will be assumed.
Requirements
The internal object id must be set in the object and it must be for a version of the object. The
version represented by the internal object id need not be in the range of startVersion to
endVersion.
Syntax
HRESULT DeleteVersionRange(
const VERSIONNUMBER_t startVersion,
const VERSIONNUMBER_t endVersion = -1);

Argument

In/Out

Description

startVersion

In

The first version to be deleted

endVersion

In

(Optional) The last version to be deleted

ReactivateDIMObject
Purpose
ReactivateDIMObject changes a dormant object to an active object. The change is
immediately made to the repository. By default, the reactivation is propagated to all objects
that are the destination in a relationship from this origin object.
Requirements
You must be initialized as an MDS Administrator (superuser) to use this function.
Reactivating an object will require DELETE permission.
Additional requirements are the same as for WriteObject.
Syntax
HRESULT ReactiveDIMObject();

AddToOrigCollection
Purpose
The CMetaObject class AddToOrigCollection function adds the specified origin class object
ID to the collection of this CMetaObject for the specified relationship ID.
Description
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
AddToOrigCollection only creates a relationship between the current version of this
CMetaObject and the current version of the object referenced by lOrigID. If explanatory

152

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

information, sExplanation, is provided, it will be included in the new entry. If necessary,


AddToOrigCollection will determine the current version for the current object and lOrigID.
Requirements
The internal object id must be set in the object and it must be for a version of the object.
lOrigID must be for a version of an object. CMetaObject must be an object in the destination
class and lOrigID must be an object in the origin class of the relationship.
Syntax
HRESULT AddToOrigCollection(
const OBJECTID_t lOrigID,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT AddToOrigCollection(
const OBJECTID_t lOrigID,
LPCTSTR sExplanation,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);

Argument

In/Out

Description

lOrigID

In

Origin ID of a version of the object to be added to the origin


collection

sExplanation

In

Explanatory Information, limited to 512 characters

gRelID

In

GUID Relationship ID.


Can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Internal Relationship ID.


Optional if gRelID is set.

AddToDestCollection
Purpose
The CMetaObject class AddToDestCollection adds the specified destination class's object ID
to the collection of this CMetaObject for the specified relationship ID. If explanatory
information, sExplanation, is provided, it will be included in the new
entry..AddToDestCollection only creates a relationship between the current version of this
CMetaObject and the current version of the object referenced by lDestID. If necessary,
AddToDestCollection will determine the current version for the current object and lDestID.
Description
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
Requirements
The internal object id must be set in the object and it must be for a version of the object.
lDestID must be the internal object id of a version of the destination object. CMetaObject

Teradata Meta Data Services Programmer Guide

153

Chapter 7: CMetaObject Class


CMetaObject Class Functions

must be an object in the origin class and lDestID must be an object in the destination class of
the relationship.
Syntax
HRESULT AddToDestCollection(
const OBJECTID_t lDestID,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT AddToDestCollection(
const OBJECTID_t lDestID,
LPCTSTR sExplanation,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);

Argument

In/Out

Description

lDestID

In

Destination ID of a version of the object to be added to the


destination collection

sExplanation

In

Explanatory information limited to 512 characters

gRelID

In

GUID Relationship ID, can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Internal Relationship ID
Optional if gRelID is set
Must be provided when gRelID is NULLGUID

AddManyToOrigCollection
Purpose
The CMetaObject class AddManyToOrigCollection function adds a list of origin IDs to the
collection of this CMetaObject for the specified relationship ID.
Description
AddManyToOrigCollection only creates a relationship between the current version of this
CMetaObject and the current versions of the objects referenced by origIDList or origRelList. If
necessary, AddManyToOrigCollection will determine the current version for the current
object and the objects referenced in origIDList or origRelList.
When the variant with origRelList is specified, only the object ID and explanation in each
entry of origRelList will be used; the other fields are ignored.
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
If the origin class of the relationship is a superclass, the origIDList or origRelList can contain
IDs of objects of the origin class type and its subclasses.

154

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements
The ObjectID must be set in the object and it must be for a version of the object. The
ObjectID must be of an object in the destination class and all objectIDs in the origIDList and
origRelList must be IDs of objects in the origin class of the relationship.
Syntax
HRESULT AddManyToOrigCollection(
const LLOBJECTID_t &origIDList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT AddManyToOrigCollection(
const LLOBJECTID_t &origIDList,
const GUID &gRelID,
const OBJECTID_t lRelID,
const bool mergeList);
HRESULT AddManyToOrigCollection(
const vector<CMetaRelationshipKey> &origRelList,
const GUID &gRelID,
const OBJECTID_t lRelID,
const bool mergeList);

Argument

In/Out

Description

origIDList

In

List of object origin IDs added to the origin collection

origRelList

In

List of objects giving the origin ID and explanatory information


for each entry

gRelID

In

GUID Relationship ID.


Can be set to NULLGUID if gRelID is set

lRelID

In
(Optional)

Internal Relationship ID
Optional if gRelID is set

mergeList

In

If true, IDs in the origIDList which are already in the collection


will be ignored. If false, an error will be returned if there are IDs in
the list which are already in the collection. mergeList=false is the
behavior of the function without the mergeList parameter.

AddManyToDestCollection
Purpose
The CMetaObject class AddManyToDestCollection function adds a list of destination IDs to
the collection of this CMetaObject for the specified relationship ID.
Description
AddManyToDestCollection only creates a relationship between the current version of this
CMetaObject and the current version of the objects referenced by destIDList or destRelList. If
necessary, AddToDestCollection will determine the current version for the current object and
each object referenced in destIDList or destRelList.

Teradata Meta Data Services Programmer Guide

155

Chapter 7: CMetaObject Class


CMetaObject Class Functions

The relationship ID is specified by the GUID relationship ID or the internal relationship ID


(one must be set).
When the variant with destRelList is specified, only the object ID and explanation in each
entry of destRelList will be used; the other fields are ignored.
If the destination class of the relationship is a superclass, the destIDList can contain IDs of
objects of the destination class type and its subclasses.
Requirements
The internal object id must be set in the object and it must be for a version of the object.
CMetaObject must be an object in the origin class and all objects in the destIDList must be in
the destination class of the relationship. Each object ID in destIDList and destRelList must be
the internal object ID for a version of an object.
Syntax
HRESULT AddManyToDestCollection(
const LLOBJECTID_t &destIDList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT AddManyToDestCollection(
const LLOBJECTID_t &destIDList,
const GUID &gRelID,
const OBJECTID_t lRelID,
const bool mergeList);
HRESULT AddManyToDestCollection(
const vector<CMetaRelationshipKey> &destRelList,
const GUID &gRelID,
const OBJECTID_t lRelID,
const bool mergeList);

156

Argument

In/Out

Description

destIDList

In

List of object destination IDs to be added to the destination


collection

destRelList

In

List of objects giving a destination ID and an accompanying


explanation string

gRelID

In

GUID Relationship ID. Can be set to NULLGUID, if the gRelID is


set.

lRelID

In
(Optional)

Internal Relationship ID, optional if gRelID is set

mergeList

In

If true, IDs in the destIDList or destRelList which are already in the


collection will be ignored. If false, an error will be returned if there
are objects in the list which are already in the collection. mergeList
= false is the behavior of the function without the mergeList
parameter.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

RemoveFromOrigCollection
Purpose
The CMetaObject class RemoveFromOrigCollection function removes the specified object ID
from the Origin collection.
Description
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
RemoveFromOrigCollection only removes the current version of the CMetaObject from the
collection of lOrigID's current version. If necessary, RemoveFromOrigCollection will
determine the current version for the CMetaObject and lOrigID.
Requirements
The ObjectID of the destination object must be set in the object and it must be for a version of
the object. lOrigID must be for a version of an object.
Syntax
HRESULT RemoveFromOrigCollection(
const OBJECTID_t lOrigID,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);

Argument

In/Out

Description

lOrigID

In

ObjectID to remove from the origin collection.

gRelID

In

Relationship ID.
Can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Internal Relationship ID.


Optional if gRelID is set.

RemoveFromDestCollection
Purpose
The CMetaObject class RemoveFromDestCollection function removes the specified object
from the collection of the specified object.
Description
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set). RemoveFromDestCollection only removes the current version of the
destination object from the collection of the current version of the CMetaObject. If necessary,
RemoveFromDestCollection will determine the current version for the CMetaObject and
lDestID.

Teradata Meta Data Services Programmer Guide

157

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements
The ObjectID of the origin object must be set in the object and it must be for a version of the
object. lDestID must be for a version of an object.
Syntax
HRESULT RemoveFromDestCollection(
const OBJECTID_t lDestID,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);

Argument

In/Out

Description

lDestID

In

ObjectID to remove from the destination collection.

gRelID

In

Relationship ID.
Can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Internal Relationship ID.


Optional if gRelID is set.

RemoveManyFromOrigCollection
Purpose
The CMetaObject class RemoveManyFromOrigCollection function removes a specified list of
object IDs from the Origin collection.
Description
RemoveManyFromOrigCollection only removes the current versions of the objects referenced
by origIDList from the collection of the CMetaObject's current version. If necessary,
RemoveManyFromOrigCollection will determine the current version for the CMetaObject
and the entries in origIDList.
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
RemoveFromOrigCollection only removes the current version of the CMetaObject from the
collection of lOrigID's current version. If necessary, RemoveFromOrigCollection will
determine the current version for the CMetaObject and lOrigID.
If the origin class of the relationship is a superclass, the origIDList can contain IDs of objects
of the origin class type and its subclasses.
Requirements
The ObjectID of the destination object must be set in the object and it must be for a version of
the object. Each key in origIDList must be for a version of an origin object to be removed from
the collection.
Syntax
HRESULT RemoveManyFromOrigCollection(
const LLOBJECTID_t &origIDList,

158

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT RemoveManyFromOrigCollection(
const LLOBJECTID_t &origIDList,
const GUID &gRelID,
const OBJECTID_t lRelID,
const bool mergeList);

Argument

In/Out

Description

origIDList

In

List of ObjectIDs to remove from the CMetaObject origin


collection.

gRelID

In

Relationship ID.
Can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Internal Relationship ID.


Optional if gRelID is set.

mergeList

In

If true, IDs in the origIDList which are not in the collection will be
ignored. If false, an error will be returned if there are IDs in the list
which are not in the collection. mergeList=false is the behavior of
the function without the mergeList parameter.

RemoveManyFromDestCollection
Purpose
The CMetaObject class RemoveManyFromDestCollection function removes the specified list
of object IDs from the collection of the specified object.
Description
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
RemoveManyFromDestCollection only removes the current version of the destination objects
from the collection of the current version of the CMetaObject. If necessary,
RemoveFromDestCollection will determine the current version for the CMetaObject and each
entry in lDestIDs.
If the destination class of the relationship is a superclass, the destIDList can contain IDs of
objects of the destination class type and its subclasses.
Requirements
The ObjectID of the origin object must be set in the object and it must be for a version of the
object. Each object id in lDestIDs must be for a version of an object.
Syntax
HRESULT RemoveManyFromDestCollection(
const LLOBJECTID_t &destIDlist,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);

Teradata Meta Data Services Programmer Guide

159

Chapter 7: CMetaObject Class


CMetaObject Class Functions

HRESULT RemoveManyFromDestCollection(
const LLOBJECTID_t &destIDlist,
const GUID &gRelID,
const OBJECTID_t lRelID,
const bool mergeList);

Argument

In/Out

Description

destIDList

In

List of ObjectIDs to remove from the destination collection.

gRelID

In

Relationship ID.
Can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Internal Relationship ID.


Optional if gRelID is set.

mergeList

In

If true, IDs in the destIDList which are not in the collection will be
ignored. If false, an error will be returned if there are IDs in the list
which are not in the collection. mergeList=false is the behavior of
the function without the mergeList parameter.

RemoveAllFromOrigCollection2
Purpose
RemoveAllFromOrigCollection2 removes all objects in a collection.
Description
The relationship id is specified by the GUID relationship id or internal relationship id (one of
which must be set). If the origin class defined in the relationship is a superclass, the origClass
and allClasses parameters determine the class of objects to be removed. Only the relationships
of the current version of the CMetaObject are affected.
Requirements
The internal object id must be set in the object. CMetaObject must be an object in the
destination class.
Syntax
HRESULT RemoveAllFromOrigCollection2(
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
const OBJECTID_t origClass = NULLLOID,
const bool allClasses = false);

160

Argument

In/Out

Description

gRelID

In

Relationship ID.

lRelID

In

Internal Relationship ID

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

origClass

In

If the allClasses parameter is = true, the origClass parameter is


ignored. If the allClasses parameter = false:
If origClass = 0, the collection for the destination class defined in
the relationship is removed.
if the origin class in the relationship is a superclass, origclass
defines the class type of the collection that will be removed.

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will remove the collections of all class types
(superclass and subclasses). If allClasses = true and the origin
class in the relationship is not a superclass, the collection for the
origin class defined in the relationship is removed.

RemoveAllFromDestCollection2
Purpose
RemoveAllFromDestCollection2 removes all objects in a collection.
Description
The relationship id is specified by the GUID relationship id or internal relationship id (one of
which must be set). If the destination class defined in the relationship is a superclass, the
destClass and allClasses parameters determine the class of objects to be removed. Only the
relationships of the current version of the CMetaObject are affected.
Requirements
The internal object id must be set in the object. CMetaObject must be an object in the origin
class.
Syntax
HRESULT RemoveAllFromDestCollection2(
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
const OBJECTID_t destClass = NULLLOID,
const bool allClasses = false);

Argument

In/Out

Description

gRelID

In

Relationship ID.

lRelID

In

Internal Relationship ID

destClass

In

If the allClasses parameter is = true, the destClass parameter is


ignored. If the allClasses parameter = false:
If destClass = 0, the collection for the destination class defined in
the relationship is removed.
If the destination class in the relationship is a superclass, destclass
defines the class type of the collection that will be removed

Teradata Meta Data Services Programmer Guide

161

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

allClasses

In

If the destination class in the relationship is a superclass, setting


allClasses = true will remove the collections of all class types
(superclass and subclasses). If allClasses = true and the destination
class in the relationship is not a superclass, the collection for the
destination class defined in the relationship is removed.

ReplaceOrigCollection
Purpose
The CMetaObject class ReplaceOrigCollection function replaces the collection with Ids in the
specified list (lOrigIDs or origRelList) by adding the IDs in the list not in the collection;
removing IDs from the collection that are not in the specified list.
The lOrigIDs list contains object ids. The origRelList contains origin loids and explanation
strings.
Description
The relationship id is specified by the GUID relationship id or internal relationship id (one of
which must be set).
ReplaceOrigCollection only modifies the collection of the current version of the
CMetaObject, and it only uses the current version of each object in the lOrigIDs or origRelList
list. If necessary, RemoveFromOrigCollection will determine the current version for the
CMetaObject and each entry in lOrigIDs or origRelList.
When origRelList is specified, only the origin loid and explanation from each entry are used;
the other fields are ignored.
If the origin class of the relationship is a superclass, this function will replace only the
collections for classes of objects on the replace list. Note the example in Figure 24.

162

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions
Figure 24: ReplaceOrigCollection Function Example
Collections
Relationship: RelAM
OriginClass: ClassA
DestClass: ClassM

A2

ClassA

ClassM

A1

RelAM

RelAM

A3

O1

O1
B Inherits
From A

N Inherits
From M
ClassB

A3

B2
ClassN
B1

C Inherits
From B

RelAM

O Inherits
From N

ClassC

ClassO
C1

B3

B1

RelAM

O1

O1

A1

C2

RelAM

C3

C1

O1

RelAM

B3

C3

O1

Replace List = A3,B1,B3


3047C042

The replace list contains object IDs for A3, B1, and B3. The collection of object O1 with
ClassA objects is replaced with A3. The collection of object O1 with ClassB objects is replaced
with B1 and B3. The collection of object O1 with ClassC objects is not affected as there are no
ClassC objects on the replace list. To remove all objects from a collection use the
RemoveAllFromOrigCollection2 function.
Requirements
The internal object id must be set in the object and it must be for a version of the object. Each
object id in lOrigIDs must be for a version of an object. CMetaObject must be an object in the
destination class.
Syntax
HRESULT ReplaceOrigCollection(
const LLOBJECTID_t &origIDList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT ReplaceOrigCollection(
const vector<CMetaRelationship> &origRelList
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);

Argument

In/Out

Description

IOrigIDs

In

List of objectIDs to be set in the origin collection.; if necessary,


they will be adjusted to the current version of the associated
object.

origRelList

In

List of origin IDs and explanatory strings to be set in the origin


collection; if necessary, they will be adjusted to the current version
of each associated object.

gRelID

In

Relationship ID

Teradata Meta Data Services Programmer Guide

163

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

lRelID

In

Internal Relationship ID optional unless gRelID is NULLGUID

ReplaceDestCollection
Purpose
The CMetaObject class ReplaceDestCollection function replaces the collection with Ids in the
specified list (lDestIDs or destRelList) by adding the IDs in the list not in the collection;
removing IDs from the collection that are not in the specified list.
Description
The relationship id is specified by the GUID relationship id or internal relationship id (one of
which must be set).
ReplaceDestCollection only modifies the collection of the current version of the CMetaObject,
and it only uses the current version of each object in the lDestIDs or destRelList list. If
necessary, RemoveFromDestCollection will determine the current version for the
CMetaObject and each entry in lDestIDs or destRelList.
When destRelList is specified, only the origin loid and explanation from each entry are used;
the other fields are ignored.
If the destination class of the relationship is a superclass, this function will replace only the
collections for classes of objects on the replace list. Note the example in Figure 25.
Figure 25: ReplaceDestCollection Function Example
Collections
Relationship: RelAM
OriginClass: ClassA
DestClass: ClassM
ClassA

A2

ClassM

A1

RelAM

RelAM

A3

O1

O1
B Inherits
From A

N Inherits
From M
ClassB

B2
ClassN
B1

C Inherits
From B
ClassC

A3

O Inherits
From N
ClassO
C1

RelAM

B3

B1

RelAM

O1

O1

A1

C2

RelAM

C3

C1

RelAM

B3

C3

O1

O1

Replace List = A3,B1,B3


3047C042

The replace list contains object IDs for M2, N1, and N3. The collection of object A1 with
ClassM objects is replaced with M2. The collection of object A1 with ClassN objects is
replaced with N1 and N3. The collection of object A1 with ClassO objects is not affected as

164

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

there are no ClassO objects on the replace list. To remove all objects from a collection use the
RemoveAllFromDestCollection2 function.
Requirements
The internal object id must be set in the object and it must be for a version of the object. Each
object id in lDestIDs must be for a version of an object.
Syntax
HRESULT ReplaceDestCollection(
const LLOBJECTID_t &destIDList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT ReplaceDestCollection(
const vector<CMetaRelationship> &destRelList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);

Argument

In/Out

Description

IDestIDs

In

List of objectIDs to be set in the destination collection; if necessary,


they will be adjusted to the current version of each associated
object.

destRelList

In

List of destination IDs and explanatory strings to be set in the


destination collection; if necessary, they will be adjusted to the
current version of each associated object

gRelID

In

Relationship ID

lRelID

In

Internal Relationship ID optional unless gRelID is NULLGUID

FindLabel
Purpose
The CMetaObject class FindLabel function returns the key for the first version of the object
that has the specified label.
Description
If none of the versions of the object have the label, the status META_E_LABEL_NOT_USED
will be returned, and the return key will specify a loid of NULLLOID and a version number of
zero. If multiple versions of the object have the label, the status
META_E_MULTIPLE_OBJECTS_FOUND will be returned and the return key will specify the
first version using the label.
Requirements:

The object ID (local or global) or the name and class ID must specify a version of the
object to be searched.

labelToFind may not be null and it must match a known label.

Teradata Meta Data Services Programmer Guide

165

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Syntax
HRESULT FindLabel(
const TCHAR *labelToFind,
CMetaVersionedObjectKey& key);

Argument

In/Out

Description

labelToFind

In

The label name to be used in the search.

Key

Out

Contains the key information for the version matching the search
criteria.

FindAllLabels
Purpose
The CMetaObject class FindAllLabels function returns a list of the labels currently applied to
the versions of the CMetaObject. Each entry in the labels vector will provide the name of a
label and a key for the object version having that label.
Requirements:
The object ID (local or global) or the name and class ID must specify a version of the object to
be searched.
Syntax
HRESULT FindAllLabels(vector<CMetaLabeledObjectKey>& labels);

Argument

In/Out

Description

Labels

Out

Vector of entries identifying the labels applied to the object and


the object version to which each label is applied.

FindAllOccurrences
Purpose
The CMetaObject class FindAllOccurrences function returns a list of version keys for the
versions of the object that satisfy a search condition.
Description
The types of searches possible are: find a property value, find when a class contained a
property, and find when a metamodel contained a class.
When a CMetaProperty object is used, two types of search are allowed:

166

If the object is for a class definition, it is determined if the class currently contains the
property (ClassHasProperties). The property is specified by its name.

If the object is for a class data object, the versions of the object are searched to return those
versions that contain the property value. When a character string value is provided, a

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

substring search is performed; for all other types of property values, an equality search is
made.
When a class name, class GUID, or class loid is given, the calling object is assumed to be a
metamodel definition and it is determined if the class exists in the metamodel
(AIMHasClasses).
Requirements:

The object ID (internal or globally unique) must be set and it must be for one of the
versions of an object.

If a CMetaProperty parameter is not used, a class ID (internal or globally unique) or a class


name must be set.

If a CMetaProperty parameter is used, the property name must be set.

Syntax
HRESULT FindAllOccurrences(
vector<CMetaVersionedObjectKey>& returnKeys,
CMetaProperty& prop,
const TCHAR *strLabel = NULL);
HRESULT FindAllOccurrences(
vector<CMetaVersionedObjectKey>& returnKeys,
const GUID& gClassID,
const OBJECTID_t lClassID = NULLLOID,
const TCHAR *className = NULL,
const TCHAR *strLabel = NULL);

Argument

In/Out

Description

returnKeys

In/Out

Reference to the list of CMetaVersionedObjectKeys that will hold


the collection returned. The list is cleared before adding the return
collection.

prop

In

Specifies a property to search for. The property name must be set.

gClassID

In

Class GUID.

IClassID

In

(optional) Class internal ID.

className

In

(optional) Class name.

strLabel

In

(optional) Label string to filter the objects; only object versions


with the label will be returned

GetPropertyValue
Purpose
The CMetaObject class GetPropertyValue function retrieves the value of the property.

Teradata Meta Data Services Programmer Guide

167

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements
Before calling GetPropertyValue, the user must first call ReadObject or ReadVersion on the
object.
Syntax
HRESULT GetPropertyValue(
const OBJECTID_t lPropID,
CMetaProperty &metaProperty);

Argument

In/Out

Description

lPropID

In

Relative Property ID of the property.

metaProperty

Out

Value of the property in a CMetaProperty object.

GetClassObjectKeys
Purpose
The GetClassObjectKeys function returns a list of CMetaObjectKeys (contains object id and
name only) which identify the current versions of objects in the specified class. The object
keys in the list returned by GetClassObjectKeys are in ascending sort order of the object
names.
Description
The GetClassObjectKeys function returns the names and object ids of class objects without
having to read the entire collection of objects into memory, thereby minimizing the use of
memory and processing time.
Requirements
The internally unique or globally unique class ID must be specified.
Syntax
HRESULT GetClassObjectKeys(
vector<CMetaObjectKey> &objectKeyList,
const GUID &gClassID,
const OBJECTID_t lClassID = NULLLOID);
HRESULT GetClassObjectKeys(
vector<CMetaObjectKey> &objectKeyList,
const GUID &gClassID,
const OBJECTID_t lClassID,
LPCTSTR strObjName,
const bool WithLock = false);

168

Argument

In/Out

Description

objectKeyList

In/Out

Reference to the list of CMetaObjectKeys that will hold the object


keys returned. The list is cleared before adding the return
collection.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

gClassID

In

Global unique Class ID. Can be set to NULLGUID if lClassID is


set.

lClassID

In
(Optional)

Internal Class ID. Optional if gClassID is set.

strObjName

In

Specific name of object in the collection to be returned.

WithLock

In

WithLock=true keeps the IClassID 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.

GetClassObjectVersionKeys
Purpose
GetClassObjectVersionKeys returns a list of CMetaVersionedObjectKeys (object id, name,
version number, and publish state) which identify all of the versions of objects in the specified
class.
Description
The GetClassObjectVersionKeys function is expected to be used by an application to enable it
to display the name or ID of objects in a class without having to read the entire collection of
objects into memory. This is important for large classes which would consume a large amount
of process space if all the objects are read into memory.
Requirements
The internally unique or globally unique class ID must be specified.
Syntax
HRESULT GetClassObjectVersionKeys(
vector<CMetaVersionedObjectKey> &objectKeyList,
const GUID &gClassID,
const OBJECTID_t lClassID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false);

Argument

In/Out

Description

objectKeyList

In/Out

Reference to the list of CMetaVersionedObjectKeys that will hold


the object keys returned. The list is cleared before adding the
return collection.

gClassID

In

Global unique Class ID. Can be set to NULLGUID if lClassID is


set.

Teradata Meta Data Services Programmer Guide

169

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

lClassID

In
(Optional)

Internal Class ID. Optional if gClassID is set.

strObjName

In

Specific name of object in the collection to be returned.

strLabel

In

Label to be used as a filter on the returned objects; only versions


with the label are returned

WithLock

In

WithLock=true keeps the IClassID 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.

SetPropertyValue
Purpose
The CMetaObject class SetPropertyValue function sets the property in the in-memory object
to the value specified.
Requirements
If updating an existing object in the repository, the user must first call ReadObject on the
object before calling SetPropertyValue.
Syntax
HRESULT SetPropertyValue (
const OBJECTID_t &PropID,
CMetaProperty &metaProperty);

The above function sets the value of the property to the value set in metaProperty. This
function uses PropID to identify the property. The Property ID or Property Name set in
metaProperty are ignored.
Note: The property value is not written to the MDS repository until the WriteObject or
WriteVersion function is called.
HRESULT SetPropertyValue (
CMetaProperty &metaProperty

This function sets the value of the property to the value set in metaProperty. The PropertyID
or PropertyName must be set in metaProperty to identify the property.
Note: The property value is not written to the MDS repository until the WriteObject or
WriteVersion function is called.

170

Argument

In/Out

Description

PropID

In

ID of property to be set

metaProperty

In

Value of the property in a CMetaProperty object.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

GetClassObjectsByProperty
Purpose
The CMetaObject GetClassObjectsByProperty returns the list of CMetaObjects in the
specified class which match selection criteria.
GetClassObjectsByProperty only returns the current version for objects in the class.
For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.
Description
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The properties to be returned can be
restricted by using a columns filter.
If multiple properties are specified in the search, the logical operator between the property
searches must also be specified. The name of the property upon which to sort the returned list
can also be specified.
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.

Teradata Meta Data Services Programmer Guide

171

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Syntax
HRESULT GetClassObjectsByProperty (
MetaObjectVector &objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const GUID & gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false);
HRESULT GetClassObjectsByProperty (
MetaObjectVector &objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const MetaObjectIDVector &columnFilters,
const GUID & gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false);

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.

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.

GetClassObjectVersionsByProperty
Purpose
The CMetaObject GetClassObjectVersionsByProperty returns the list of CMetaObjects in the
specified class which match selection criteria.

172

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Description
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The properties to be returned can be
restricted by using a columns filter.
If multiple properties are specified in the search, the logical operator between the property
searches must also be specified. The name of the property upon which to sort the returned list
can also be specified.
GetClassObjectVersionsByProperty returns all versions for objects in the class that match the
search criteria.
For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.
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 GetClassObjectVersionsByProperty (
MetaObjectVector &objectList,
const MetaFilterInfoVector &propFilter,

Teradata Meta Data Services Programmer Guide

173

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const MetaObjectKeyVector &sortList,
const GUID & gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false);
HRESULT GetClassObjectVersionsByProperty (
MetaObjectVector &objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const MetaObjectIDVector &columnFilters,
const GUID & gClassID,
const OBJECTID_t lClassID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false);

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.

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.

strLabel

In

Label to be used as a filter on the returned objects; only versions


with the label are 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.

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.

174

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

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 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.
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);

Teradata Meta Data Services Programmer Guide

175

Chapter 7: CMetaObject Class


CMetaObject Class Functions
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 46 for examples of setting the startNum and returnCount.


Table 46: GetClassObjectRange Example

Total # of objects
in search results

Start Number

Return Count

Number of
objects returned

Objects returned

100

20

20

1-20

100

41

50

50

41-90

100

91

20

10

91-100

100

200

20

20

20

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.

176

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.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

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.

GetClassObjectVersionsRange
Purpose
The CMetaObject class GetClassObjectVersionsRange returns the specified subset of
CMetaObjects in the class that matches the selection criteria. The
GetClassObjectVersionsRange will return any version of an object matching the search criteria
not just the current version.
Description
The function allows you 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.
Syntax
HRESULT GetObjectVersionsRange (
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,
LPCTSTR strLabel = NULL,
const bool WithLock = false);
HRESULT GetObjectVersionsRange (
vector<CMetaObject>&objectList,
int *totalCount,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const MetaObjectKeyVector &columnFilters,
const int startNum,
const int returnCount,
const GUID &gClassID,
const OBJECTID_t lClassID = 0,

Teradata Meta Data Services Programmer Guide

177

Chapter 7: CMetaObject Class


CMetaObject Class Functions
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false);

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


Table 47: GetClassObjectVersionsRange Example

Total # of objects
in search results

Start Number

Return Count

Number of
objects returned

Objects returned

100

20

20

1-20

100

41

50

50

41-90

100

91

20

10

91-100

100

200

20

20

20

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.

178

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

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

StrObjName

In

(optional) Search string for names of objects in the class to be


returned.

strLabel

In

Label to be used as a filter on the returned objects; only versions


with the label are 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.

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.

GetOrigCollectionByProperty
Purpose
GetOrigCollectionByProperty returns the collection (list of CMetaObjects) of the origin class
associated with this CMetaObject for the specified relationship, which match the selection
criteria.
Description
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of
objects in the collection. If multiple properties are specified for the search, the logical operator

Teradata Meta Data Services Programmer Guide

179

Chapter 7: CMetaObject Class


CMetaObject Class Functions

between the property searches must be specified. The name of the property upon which to
sort the returned list can also be specified.
When the origin class supports versioning, GetOrigCollectionByProperty will return object
versions in the origin class that have a rigid relationship to the current version of this
CMetaObject. The returned objects are not guaranteed to be the current version of their
respective objects, i.e CMetaPersist::IsPublished() may be true or false for each returned
object.
If the origin class of the relationship is a superclass, this function will only return objects in the
origin class. To return objects in the subclasses, use the GetOrigCollection3 function.
For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
Requirements

The internal object id must be set in the object and it must be for a version of the origin
object.

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 GetOrigCollectionByProperty(
MetaObjectVector &objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const GUID &gRelID,

180

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false)

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.

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.

gReID

In

Relationship GUID.

lReID

In

Relationship 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.

GetDestCollectionByProperty
Purpose
GetDestCollectionByProperty returns the collection (list of CMetaObjects) of the destination
class associated with this CMetaObject for the specified relationship that matches the selection
criteria.
GetDestCollectionByProperty only returns the current version for objects in the class.
For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
Description
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of
objects in the collection. If multiple properties are specified for the search, the logical operator
between the property searches must be specified. The name of the property upon which to
sort the returned list can also be specified

Teradata Meta Data Services Programmer Guide

181

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements

The internal object id must be set in the object and it must be for a version of the origin
object.

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 GetDestCollectionByProperty (
MetaObjectVector &objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false)

182

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.

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.

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

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.

GetOrigCollection3
Purpose
GetOrigCollection3 returns the collection (list of CMetaObjects) of the origin class associated
with this CMetaObject for the specified relationship, which match the selection criteria.
Description
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search.
The search is performed on the list of objects in the collection. If multiple properties are
specified for the search, the logical operator between the property searches must be specified.
The properties to be returned can be restricted by the use of the column filters vector. The
name of the property upon which to sort the returned list can also be specified.
When the origin class supports versioning, GetOrigCollection3 will return object versions in
the origin class that have a rigid relationship to the current version of this CMetaObject. The
returned objects are not guaranteed to be the current version of their respective objects, i.e
CMetaPersist::IsPublished() may be true or false for each returned object.
Requirements

The internal object id must be set in the object and it must be for a version of the
destination object.

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.

Teradata Meta Data Services Programmer Guide

183

Chapter 7: CMetaObject Class


CMetaObject Class Functions

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 GetOrigCollection3(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);
HRESULT GetOrigCollection3(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const MetaObjectKeyVector &columnFilters,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.

184

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.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

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.

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned.

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

Teradata Meta Data Services Programmer Guide

185

Chapter 7: CMetaObject Class


CMetaObject Class Functions

GetDestCollection3
Purpose
GetDestCollection3 returns the collection (list of CMetaObjects) of the destination class
associated with this CMetaObject for the specified relationship that matches the selection
criteria.
GetDestCollection3 only returns the current version of each object and only uses the current
version of the CMetaObject.
Description
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of
objects in the collection. If multiple properties are specified for the search, the logical operator
between the property searches must be specified. The properties to be returned can be
restricted by the use of the column filters vector. The name of the property upon which to sort
the returned list can also be specified.
Requirements

The internal object id must be set in the object and it must be for a version of the origin
object.

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 GetDestCollection3(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const GUID &gRelID,

186

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);
HRESULT GetDestCollection3(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const MetaObjectKeyVector &Columnfilters,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

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.

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.

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

Teradata Meta Data Services Programmer Guide

187

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.

GetOrigCollectionVersions
Purpose
GetOrgCollectionVersions returns the collection (list of CMetaObjects) of the origin class
associated with this CMetaObject for the specified relationship that matches the selection
criteria.

188

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Description
The function allows you to specify the property id, property value and comparison operator
on which to perform the search. The search is performed on the list of objects in the
collection. If multiple properties are specified for the search, the logical operator between the
property searches must be specified. The properties to be returned can be restricted by the use
of the column filters vector. The name of the property upon which to sort the returned list can
also be specified.
GetOrigCollectionVersions can be used with any version of the object and by default it will
return all object versions that are found via rigid relationships and match the search
conditions. If rigidRelsOnly is set to false, both rigid and semi-rigid relationships will be used
to find origin objects.
Requirements

The internal object id must be set in the object and it must be for a version of the
destination object.

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 GetOrigCollectionVersions(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,

Teradata Meta Data Services Programmer Guide

189

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const bool skipValidation = false,
const bool rigidRelsOnly = true);
HRESULT GetOrigCollectionVersions(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const MetaObjectKeyVector &columnFilters,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false,
const bool rigidRelsOnly = true);

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.

190

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.

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.

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

strLabel

In

(optional) Label string to filter the objects; only object versions


with the label will be returned.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned.

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

rigidRelsOnly

In

If set true, the function will only return origin objects that are
found via rigid relationships, i.e. they are the latest version of the
origin object associated with the version of the calling object. If
set false, the function will return all origin object versions that
can be reached from the destination object version.

GetDestCollectionVersions
Purpose
GetDestCollectionVersions returns the collection (list of CMetaObjects) of the destination
class associated with this CMetaObject for the specified relationship that matches the selection
criteria. The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of
objects in the collection. If multiple properties are specified for the search, the logical operator
between the property searches must be specified. The properties to be returned can be
restricted by the use of the column filters vector. The name of the property upon which to sort
the returned list can also be specified.

Teradata Meta Data Services Programmer Guide

191

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Description
GetDestCollectionVersions can be used with any version of the object and by default it will
return all object versions that are found via rigid relationships and match the search
conditions. If rigidRelsOnly is set to false, both rigid and semi-rigid relationships will be used
to find destination objects.
Requirements

The internal object id must be set in the object and it must be for a version of the origin
object.

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 GetDestCollectionVersions(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false,
const bool rigidRelsOnly = true);
HRESULT GetDestCollectionVersions(
vector<CMetaObject >& objectList,
const MetaFilterInfoVector &propFilter,
const MetaObjectKeyVector &sortList,
const MetaObjectKeyVector &columnFilters,
const GUID &gRelID,

192

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false,
const bool rigidRelsOnly = true);

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on using the columnFilters parameter, see section Column Filter on
page 135.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.
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.

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.

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

strLabel

In

(optional) Label string to filter the objects; only object versions


with the label will be returned.

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

Teradata Meta Data Services Programmer Guide

193

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

rigidRelsOnly

In

If set true, the function will only return destination objects that
are found via rigid relationships, i.e. they are the latest version of
the destination object associated with the version of the calling
object. If set false, the function will return all destination object
versions that can be reached from the origin object version.

GetOrigCollectionVersionKeys
Purpose
GetOrigCollectionVersionKeys returns a list of CMetaVersionedObjectClassKey objects
(contains object id, object name, object version, class id, and class name) or a list of
CMetaRelationshipKey objects (contains object id, object name, object version, class id, class
name, and explanation string) which identify the collection of the destination class objects
associated with this CMetaObject for the specified relationship.
Description
This API is expected to be used by a meta data browser to enable it to display the name/id of
objects in a collection without having to read the entire collection of objects into memory.
This is important for large collections that would consume a large amount of process space if
all read into memory. The function allows you to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of

194

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

objects in the collection. If multiple properties are specified for the search, the logical operator
between the property searches must be specified.
GetOrigCollectionVersionKeys works with any version of the object and by default returns
only versions of the origin objects that are reachable via rigid relationships and satisfy the
other search conditions. Setting rigidRelsOnly to false will return all origin object versions
that satisfy the other search conditions.
Requirements

The internal object id must be set in the object and it must be for a version of the origin
object.

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 GetOrigCollectionVersionKeys(
MetaVersionedObjectClassKeyVector& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false,
const bool rigidRelsOnly = true);
HRESULT GetOrigCollectionVersionKeys(
vector<CMetaRelationshipKey>& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,

Teradata Meta Data Services Programmer Guide

195

Chapter 7: CMetaObject Class


CMetaObject Class Functions
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false,
const bool rigidRelsOnly = true);

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.
Argument

In/Out

Description

ObjectKeyList

In/out

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

propFilter

In

List of FilterInfo objects containing the property id and value to


use to perform the search.

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

strLabel

In

(optional) Label string to filter the objects; only object versions


with the label will be returned.

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned.

196

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

rigidRelsOnly

In

If set true, the function will only return origin objects that are
found via rigid relationships, i.e. they are the latest version of the
origin object associated with the version of the calling object. If
set false, the function will return all origin object versions that
can be reached from the destination object version.

GetDestCollectionVersionKeys
Purpose
GetDestCollectionVersionKeys returns a list of CMetaVersionedObjectClassKey objects
(contains object id, object name, object version, class id, and class name) or a list of
CMetaRelationshipKey objects (contains object id, object name, object version, class id, class
name, and explanation string) which identify the collection of the destination class objects
associated with this CMetaObject for the specified relationship.
Description
This API is expected to be used by a meta data browser to enable it to display the name/id of
objects in a collection without having to read the entire collection of objects into memory.
This is important for large collections that would consume a large amount of process space if
all read into memory.
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of
objects in the collection. If multiple properties are specified for the search, the logical operator
between the property searches must be specified.
GetDestCollectionVersionKeys works with any version of the object and by default returns
only versions of the destination objects that are reachable via rigid relationships and satisfy the
other search conditions. Setting rigidRelsOnly to false will return all destination object
versions that satisfy the other search conditions.

Teradata Meta Data Services Programmer Guide

197

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Requirements

The internal object id must be set in the object and it must be for a version of the origin
object.

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 DestCollectionVersionKeys(
MetaVersionedObjectClassKeyVector& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false,
const bool rigidRelsOnly = true);
HRESULT DestCollectionVersionKeys(
vector<CMetaRelationshipKey>& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
LPCTSTR strLabel = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false,
const bool rigidRelsOnly = true);

198

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.
Argument

In/Out

Description

ObjectKeyList

In/out

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

propFilter

In

List of FilterInfo objects containing the property id and value to


use to perform the search

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

strLabel

In

(optional) Label string to filter the objects; only object versions


with the label will be returned.

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned.

allClasses

In

Teradata Meta Data Services Programmer Guide

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

199

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

rigidRelsOnly

In

If set true, the function will only return destination objects that
are found via rigid relationships, i.e. they are the latest version of
the destination object associated with the version of the calling
object. If set false, the function will return all destination object
versions that can be reached from the origin object version.

GetOrigCollectionKeys
Purpose
The CMetaObject class GetOrigCollectionKeys function returns a list of CMetaObjectKeys
that contains object ID and name of the origin class objects associated with this CMetaObject
for the specified relationship.
The third variant of GetOrigCollectionKeys listed returns a list of CMetaRelationshipKey
objects (contains object id, object name, class id, class name, and optional explanation text)
which identify the collection of the destination class objects associated with this CMetaObject
for the specified relationship. This API functions in all respects the same as
GetOrigCollectionKeys3 except for the type of the return objects.
Description
The GetOrigCollectionKeys function is expected to be used by an application to enable it to
display the name or ID of objects in a collection without having to read the entire collection of
objects into memory. This is important for large collections which consume a large amount of
process space if all objects are read into memory.
When the origin class supports versioning, GetOrigCollectionKeys will return the keys of
object versions in the origin class that have a rigid relationship to the current version of this
CMetaObject. The returned keys are not guaranteed to be for the current version of their
respective objects, i.e CMetaPersist::IsPublished() may be true or false for each returned object
key.
The relationship ID is be specified by the GUID relationship ID or the internal relationship ID
(one must be set).
If the origin class of the relationship is a superclass, this function will only return objects in the
origin class. To return objects in the subclasses, use the GetOrigCollection3 function.
Requirements
The internal object id must be set in the object and it must be for a version of the object. The
ObjectID must be of an object in the destination class of the specified relationship.

200

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

The relationship id is specified by the GUID relationship id or internal relationship id (one of


which must be set). CMetaObject must be an object in the origin class of the relationship.
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.
For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.
Syntax
HRESULT GetOrigCollectionKeys(
vector<CMetaObjectKey> &objectKeyList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT GetOrigCollectionKeys(
vector<CMetaObjectKey> &objectKeyList,
const GUID &gRelID,
const OBJECTID_t lRelID,
LPCTSTR strObjName,
const bool WithLock = false);
HRESULT GetOrigCollectionKeys(
Vector<CMetaRelationshipKey>& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL
const bool WithLock = false);

Teradata Meta Data Services Programmer Guide

201

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

Argument

In/Out

Description

objectKeyList

In/Out

Reference to the list of keys that will hold the collection


returned. The list is cleared before adding the return
collection.

propFilter

In

List of FilterInfo objects containing the property id and


value to use to perform the search

gRelID

In

Relationship ID.
Can be set to NULLGUID if lRelID is set.

lRelID

In
(Optional)

Relationship internal ID.


Optional, if gRelID is set.

strObjName

In

Specific name of object in the collection to be returned.

WithLock

In

WithLock=true keeps the Orig Collection table locked for


WRITE. Use within an explicit transaction. Set WithLock
to true when one of the Orig Collection objects will
subsequently be updated within the transaction. This
prevents deadlocks caused by Teradata promotional locks.

returnClass

In

(Optional) If the allClasses parameter is = true, the


returnClass parameter is ignored. If the allClasses
parameter = false
If returnClass = 0, the origin class defined in the
relationship is returned.
If the origin class in the relationship is a superclass,
return class defines the class type of object keys to return
(the superclass or one of its subclasses)
If the origin class in the relationship is not a superclass
and return class specifies a classid other than the origin
class, an error will be returned.

202

allClasses

In

(Optional) If the origin class in the relationship is a


superclass, setting allClasses = true will return all class
types (superclass and subclasses). If allClasses = false, the
origin class returned is determined by the returnClass
parameter. If allClasses = true and the origin class in the
relationship is not a superclass, only objects of the origin
class defined in the relationship are returned. If allClasses =
true, the return list is sorted first by class.

skipValidation

In

(Optional) The function validates that the id of the object


is an object in the destination class (or subclass) of the
relationship. If returnClass is specified, the function will
validate that the returnClass is the origin class (or subclass)
of the relationship. If skipValidation is true, this validation
is not performed. If the validation is not performed and the
validation would have returned an error, the function will
return zero object keys in the ObjectList.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

GetDestCollectionKeys
Purpose
The CMetaObject class GetDestCollectionKeys function returns a list of CMetaObjectKeys
that contains the object ID and name. The keys identify the collection of the destination class
objects associated with this CMetaObject for the specified relationship.
Description
The GetDestCollectionKeys function is expected to be used by an application to enable it to
display the name or ID of objects in a collection without having to read the entire collection of
objects into memory. This is important for large collections which consume a large amount of
process space if all objects are read into memory.
GetDestCollectionKeys only returns the keys of the current versions of objects referenced by
the current version of this CMetaObject.
The relationship ID is specified by the GUID relationship ID or the internal relationship ID
(one must be set).
If the destination class of the relationship is a superclass, this function will only return objects
in the destination class. To return objects in the subclasses, use the
GetDestinationCollectionKeys3 function.
The third variant of GetDestCollectionKeys listed returns a list of CMetaRelationshipKey
objects (contains object id, object name, class id, class name, and optional explanation text)
which identify the collection of the destination class objects associated with this CMetaObject
for the specified relationship. This API functions in all respects the same as
GetDestCollectionKeys3 except for the type of the return objects.
Requirements
The internal object id must be set in the object and it must be for a version of the object. The
ObjectID must be the ID of an object in the origin class of the specified relationship.
The relationship id is specified by the GUID relationship id or internal relationship id (one of
which must be set). CMetaObject must be an object in the origin class of the relationship.
The propFilter list can 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.

Teradata Meta Data Services Programmer Guide

203

Chapter 7: CMetaObject Class


CMetaObject Class Functions

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 GetDestCollectionKeys(
vector<CMetaObjectKey> &objectKeyList,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID);
HRESULT GetDestCollectionKeys(
vector<CMetaObjectKey> &objectKeyList,
const GUID &gRelID,
const OBJECTID_t lRelID.
LPCTSTR strObjName,
const bool WithLock = false);
HRESULT GetDestCollectionKeys(
Vector<CMetaRelationshipKey>& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID.
LPCTSTR strObjName,
const bool WithLock = false);
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.

204

Argument

In/Out

Description

objectKeyList

In/Out

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

propFilter

In

List of FilterInfo objects containing the property id and value to


use to perform the search

gRelID

In

Relationship ID.
Can be set to NULLGUID if gRelID is set.

lRelID

In
(Optional)

Relationship internal ID.


Optional, if lRelID is set.

strObjName

In

Specific name of object in the collection to be returned.

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

returnClass

In

(Optional) If the allClasses parameter is = true, the returnClass


parameter is ignored. If the allClasses parameter = false:
If returnClass = 0, the destination class defined in the
relationship is returned.
If the destination class in the relationship is a superclass, return
class defines the class type of object to return (the superclass or
one of its subclasses)
If the destination class in the relationship is not a superclass
and return class specifies a classid other than the destination
class, an error will be returned.

WithLock

In

WithLock=true keeps the Dest Collection table locked for WRITE.


Use within an explicit transaction. Set WithLock to true when one
of the Dest Collection objects will subsequently be updated within
the transaction. This prevents deadlocks caused by Teradata
promotional locks.

allClasses

In

(Optional) If the destination class in the relationship is a


superclass, setting allClasses = true will return all class types
(superclass and subclasses). If allClasses = false, the destination
class returned is determined by the returnClass parameter. If
allClasses = true and the destination class in the relationship is not
a superclass, only object keys of the destination class defined in the
relationship are returned. If allClasses = true, the return list is
sorted first by class.

GetOrigCollectionKeys3
Purpose
GetOrigCollectionKeys3 returns a list of CMetaObjectClassKey objects (contains object id,
object name, class id, and class name) which identify the collection of the Origin class objects
associated with the current version of this CMetaObject for the specified relationship.
Description
The GetOrigCollectionKeys3 function only uses the current version of the CMetaObject.
This API is expected to be used by a meta data browser to enable it to display the name/id of
objects in a collection without having to read the entire collection of objects into memory.
This is important for large collections that would consume a large amount of process space if
all read into memory. The function allows you to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of
objects in the collection. If multiple properties are specified for the search, the logical operator
between the property searches must be specified.
When the origin class supports versioning, GetOrigCollectionKeys3 will return the keys of
object versions in the origin class that have a rigid relationship to the current version of this
CMetaObject. The returned keys are not guaranteed to be for the current version of their

Teradata Meta Data Services Programmer Guide

205

Chapter 7: CMetaObject Class


CMetaObject Class Functions

respective objects, i.e CMetaPersist::IsPublished() may be true or false for each returned object
key.
Requirements

The internal object id must be set in the object and it must be for a version of the
destination object.

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 GetOrigCollectionKeys3(
MetaObjectClassKeyVector& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.

206

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

ObjectKeyList

In/out

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

propFilter

In

List of FilterInfo objects containing the property id and value to


use to perform the search.

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned.

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

GetDestCollectionKeys3
Purpose
GetDestCollectionKeys3 returns a list of CMetaObjectClassKey objects (contains object id,
object name, class id, and class name) which identify the collection of the destination class
objects associated with this CMetaObject for the specified relationship.

Teradata Meta Data Services Programmer Guide

207

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Description
This API is expected to be used by a meta data browser to enable it to display the name/id of
objects in a collection without having to read the entire collection of objects into memory.
This is important for large collections that would consume a large amount of process space if
all read into memory.
The function allows the programmer to specify the property id, property value and
comparison operator on which to perform the search. The search is performed on the list of
objects in the collection. If multiple properties are specified for the search, the logical operator
between the property searches must be specified.
GetDestCollectionKeys3 only returns the keys for the current versions of objects and only uses
the current version of the CMetaObject.
Requirements

The internal object id must be set in the object and it must be for a version of the origin
object.

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 GetDestCollectionKeys3(
MetaObjectClassKeyVector& objectKeyList,
const MetaFilterInfoVector &propFilter,
const GUID &gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,
const bool WithLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

208

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.
Argument

In/Out

Description

ObjectKeyList

In/out

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

propFilter

In

List of FilterInfo objects containing the property id and value to


use to perform the search

gRelID

In

Relationship GUID.

lRelID

In

Relationship internal ID.

StrObjName

In

(optional) Search string for names of objects in the collection to


be returned.

WithLock

In

WithLock=true keeps the class table of the Origin Collection


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

returnClass

In

If the allClasses parameter is = true, the returnClass parameter is


ignored. If the allClasses parameter = false:
1) If returnClass = 0, the origin class defined in the relationship is
returned.
2) if the origin class in the relationship is a superclass, return class
defines the class type of object to return (the superclass or one of
its subclasses)
3) if the origin class in the relationship is not a superclass and
return class specifies a classid other than the origin class, an error
will be returned

allClasses

In

If the origin class in the relationship is a superclass, setting


allClasses = true will return all class types (superclass and
subclasses). If allClasses = false, the origin class returned is
determined by the returnClass parameter. If allClasses = true
and the origin class in the relationship is not a superclass, only
objects of the origin class defined in the relationship are returned.

skipValidation

In

The function validates that the id of the object is an object in the


destination class (or subclass) of the relationship. If returnClass is
specified, the function will validate that the returnClass is the
origin class (or subclass) of the relationship. If skipValidation is
true, this validation is not performed. If the validation is not
performed and the validation would have returned an error, the
function will return zero objects in the ObjectList.

Teradata Meta Data Services Programmer Guide

209

Chapter 7: CMetaObject Class


CMetaObject Class Functions

GetDormantDIMOrigCollection
Purpose
GetDormantDIMOrigCollection returns the collection of dormant objects of the origin class
associated with this CMetaObject for the specified relationship that matches the selection
criteria.
Description
The calling object can be dormant or active.
The property id, property value and comparison operator on which to perform the search can
all be specified. The search is performed on the list of objects in the collection. If multiple
properties are specified for the search, the logical operator between the property searches
must be specified. The name of the property upon which to sort the returned list can also be
specified.
Requirements
The requirements are the same as for GetDormantDIMDestCollection.
Syntax
HRESULT GetDormantDIMOrigCollection(
vector<CMetaObject>& objectList,
const MetaFilterInfoVector& propFilter,
const MetaObjectKeyVector& sortList,
const GUID& gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR sObjName = NULL,
const bool withLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

For more information on creating the propFilter for the search, see Chapter 8:
CMetaFilterInfo Class.
For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.

210

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

propFilter

In

List of FilterInfo objects containing the property id and


value to use to perform the search

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

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

gRelID

In

Relationship GUID

IRelID

In

Relationship 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. Prevents deadlocks caused by Teradata
promotional locks.

returnClass

In

If the allClasses parameter is = true, the returnClass


parameter is ignored. If the allClasses parameter = false:
If returnClass = 0, the destination class defined in the
relationship is returned.
If the destination class in the relationship is a superclass,
return class defines the class type of object to return (the
superclass or one of its subclasses)
If the destination class in the relationship is not a superclass
and return class specifies a classid other than the
destination class, an error will be returned

allClasses

In

If the destination class in the relationship is a superclass,


setting allClasses = true will return all class types
(superclass and subclasses).
If allClasses = false, the destination class returned is
determined by the returnClass parameter.
If allClasses = true and the destination class in the
relationship is not a superclass, only objects of the
destination class defined in the relationship are returned.
If allClasses = true, the return list is sorted first by class and
then by the sort properties specified.

SkipValidation

In

Teradata Meta Data Services Programmer Guide

The function validates that the id of the object is an object


in the origin class (or subclass) of the relationship. If
returnClass is specified, the function will validate that the
returnClass is the destination class (or subclass) of the
relationship. If skipValidation is true, this validation is not
performed. If the validation is not performed and the
validation would have returned an error, the function will
return zero objects in the ObjectList.

211

Chapter 7: CMetaObject Class


CMetaObject Class Functions

GetDormantDIMDestCollection
Purpose
GetDormantDIMDestCollection returns the collection of dormant objects of the destination
class associated with this CMetaObject for the specified relationship that matches the selection
criteria.
Description
The calling object can be dormant or active.
The property id, property value and comparison operator on which to perform the search can
all be specified. The search is performed on the list of objects in the collection. If multiple
properties are specified for the search, the logical operator between the property searches
must be specified. The name of the property upon which to sort the returned list can also be
specified.
Requirements
You must be initialized as an MDS Administrator (superuser) to use this function.
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
HRESULTGetDormantDIMDestCollection(
vector<CMetaObject>& objectList,
const MetaFilterInfoVector& propFilter,
const MetaObjectKeyVector& sortList,
const GUID& gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR strObjName = NULL,

212

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const
const
const
const

bool withLock = false,


OBJECTID_t returnClass = NULLLOID,
bool allClasses = false,
bool skipValidation = false);

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

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

gRelID

In

Relationship GUID

IRelID

In

Relationship 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. Prevents deadlocks caused by Teradata
promotional locks.

returnClass

In

If the allClasses parameter is = true, the returnClass


parameter is ignored. If the allClasses parameter = false:
If returnClass = 0, the destination class defined in the
relationship is returned.
If the destination class in the relationship is a superclass,
return class defines the class type of object to return (the
superclass or one of its subclasses)
If the destination class in the relationship is not a superclass
and return class specifies a classid other than the
destination class, an error will be returned

allClasses

In

If the destination class in the relationship is a superclass,


setting allClasses = true will return all class types
(superclass and subclasses).
If allClasses = false, the destination class returned is
determined by the returnClass parameter.
If allClasses = true and the destination class in the
relationship is not a superclass, only objects of the
destination class defined in the relationship are returned.
If allClasses = true, the return list is sorted first by class and
then by the sort properties specified.

Teradata Meta Data Services Programmer Guide

213

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

SkipValidation

In

The function validates that the id of the object is an object


in the origin class (or subclass) of the relationship. If
returnClass is specified, the function will validate that the
returnClass is the destination class (or subclass) of the
relationship. If skipValidation is true, this validation is not
performed. If the validation is not performed and the
validation would have returned an error, the function will
return zero objects in the ObjectList.

GetDormantDIMOrigCollectionKeys
Purpose
GetDormantDIMOrigCollectionKeys returns the collection of dormant objects of the origin
class associated with this CMetaObject for the specified relationship that matches the selection
criteria.
Description
The calling object can be dormant or active.
This enables a meta data browser to display the name/id of objects in a collection without
having to read the entire collection of objects into memory. This is important for large
collections that consume a large amount of process space if all read into memory.
The property id, property value and comparison operator on which to perform the search can
all be specified. The search is performed on the list of objects in the collection. If multiple
properties are specified for the search, the logical operator between the property searches
must be specified.
The calling object may be dormant or active.
Requirements
The requirements are the same as for GetDormantDIMDestCollection.
Syntax
HRESULT GetDormantDIMOrigCollectionKeys(
CMetaObjectClassKeyVector& objectKeyList,
const MetaFilterInfoVector& propFilter,
const MetaObjectKeyVector& sortList,
const GUID& gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR sObjName = NULL,
const bool withLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

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

214

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions

For more information on building the strObjName parameter for a search, see Name Search
on page 134.
For more information on building the sortList parameter, see Sort List on page 133.
For more information on the settings for allClasses and returnClass, see Inheritance on
page 135.
Argument

In/Out

Description

objectKeyList

In/Out

Reference to the list of CMetaObjects that will hold the


collection returned. The list is cleared before adding the
return collection

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

gRelID

In

Relationship GUID

lRelID

In

Relationship 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. Prevents deadlocks caused by Teradata
promotional locks.

returnClass

In

If the allClasses parameter is = true, the returnClass


parameter is ignored. If the allClasses parameter = false:
If returnClass = 0, the destination class defined in the
relationship is returned.
If the destination class in the relationship is a superclass,
return class defines the class type of object to return (the
superclass or one of its subclasses)
If the destination class in the relationship is not a superclass
and return class specifies a classid other than the
destination class, an error will be returned

Teradata Meta Data Services Programmer Guide

215

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

allClasses

In

If the destination class in the relationship is a superclass,


setting allClasses = true will return all class types
(superclass and subclasses).
If allClasses = false, the destination class returned is
determined by the returnClass parameter.
If allClasses = true and the destination class in the
relationship is not a superclass, only objects of the
destination class defined in the relationship are returned.
If allClasses = true, the return list is sorted first by class and
then by the sort properties specified.

SkipValidation

In

The function validates that the id of the object is an object


in the origin class (or subclass) of the relationship. If
returnClass is specified, the function will validate that the
returnClass is the destination class (or subclass) of the
relationship. If skipValidation is true, this validation is not
performed. If the validation is not performed and the
validation would have returned an error, the function will
return zero objects in the ObjectList.

GetDormantDIMDestCollectionKeys
Purpose
GetDormantDIMDestCollectionKeys returns a list of CMetaObjectClassKey objects (contains
object id, object name, class id, and class name) that identify the collection of dormant objects
associated with this CMetaObject for the specified relationship.
Description
The calling object can be dormant or active.
This enables a meta data browser to display the name/id of objects in a collection without
having to read the entire collection of objects into memory. This is important for large
collections that consume a large amount of process space if all read into memory.
The property id, property value and comparison operator on which to perform the search can
all be specified. The search is performed on the list of objects in the collection. If multiple
properties are specified for the search, the logical operator between the property searches
must be specified.
The calling object may be dormant or active.
Requirements
The requirements are the same as for GetDormantDIMDestCollection.
Syntax
HRESULT GetDormantDIMDestCollectionKeys(
MetaObjectClassKeyVector& objectKeyList,
const MetaFilterInfoVector& propFilter,

216

Teradata Meta Data Services Programmer Guide

Chapter 7: CMetaObject Class


CMetaObject Class Functions
const MetaObjectKeyVector& sortList,
const GUID& gRelID,
const OBJECTID_t lRelID = NULLLOID,
LPCTSTR sObjName = NULL,
const bool withLock = false,
const OBJECTID_t returnClass = NULLLOID,
const bool allClasses = false,
const bool skipValidation = false);

Argument

In/Out

Description

objectKeyList

In/Out

Reference to the list of CMetaObjects that will hold the


collection returned. The list is cleared before adding the
return collection

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

gRelID

In

Relationship GUID

lRelID

In

Relationship 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. Prevents deadlocks caused by Teradata
promotional locks.

returnClass

In

If the allClasses parameter is = true, the returnClass


parameter is ignored. If the allClasses parameter = false:
If returnClass = 0, the destination class defined in the
relationship is returned.
If the destination class in the relationship is a superclass,
return class defines the class type of object to return (the
superclass or one of its subclasses)
If the destination class in the relationship is not a superclass
and return class specifies a classid other than the
destination class, an error will be returned

Teradata Meta Data Services Programmer Guide

217

Chapter 7: CMetaObject Class


CMetaObject Class Functions

Argument

In/Out

Description

allClasses

In

If the destination class in the relationship is a superclass,


setting allClasses = true will return all class types
(superclass and subclasses).
If allClasses = false, the destination class returned is
determined by the returnClass parameter.
If allClasses = true and the destination class in the
relationship is not a superclass, only objects of the
destination class defined in the relationship are returned.
If allClasses = true, the return list is sorted first by class and
then by the sort properties specified.

SkipValidation

218

In

The function validates that the id of the object is an object


in the origin class (or subclass) of the relationship. If
returnClass is specified, the function will validate that the
returnClass is the destination class (or subclass) of the
relationship. If skipValidation is true, this validation is not
performed. If the validation is not performed and the
validation would have returned an error, the function will
return zero objects in the ObjectList.

Teradata Meta Data Services Programmer Guide

CHAPTER 8

CMetaFilterInfo Class

This chapter describes the C++ Class CMetaFilterInfo functions that are used to define search
properties for the GetDestCollectionByProperty, GetOrigCollectionByProperty, and
GetClassObjectsByProperty APIs.
This chapter also includes example code for CMetaFilterInfo.

Filter
The CMetaFilterInfo class contains an attribute called Filter which is an object of the
CMetaProperty class:
CMetaProperty

Filter

The Filter object contains the:


1

Relative Property ID or Name of the property on which to perform the search. This can be
any of the objects Common Properties or Unique Properties defined for the class.

Search value.

The id is set using the CMetaProperty::SetPropertyID function. The name is set using the
CMetaProperty::SetName function. For example:
CMetaFilterInfo filterInfo;
filterInfo.Initialize();
filterInfo.Filter.SetPropertyID(3);

The search value is set using a CMetaProperty::Setxxx function such as SetString, SetInt,
SetShort, SetBinary, etc. For example:
filterInfo.Filter.SetString(_TEXT("FOO"));

To search on unique properties of a class, you must specify the relative property id or property
name specified for the Property Description in the Model.

Substring Search
Using the REGEX ComparisonOperator, character string properties can be searched for a
match of a character string pattern within the property character string.
The following describes the search string value:

The search string value can be any character string.

The % and _ characters may be used in any combination in the search string

The % (percent sign) character represents any string of zero or more arbitrary characters.

Teradata Meta Data Services Programmer Guide

219

Chapter 8: CMetaFilterInfo Class


Filter

The _ (spacing underscore) character represents exactly one arbitrary character.

Any single character is acceptable in the position in which the underscore character
appears, and any string of characters is acceptable as a replacement for the percent.

The backslash character (\) can be used as an escape character to search for the %, _ or %
characters ( \\, \%, \_ ) in the name or property value.

Both leading and trailing pad characters in the property field must match exactly with the
search string. For example, A%BC matches AxxBC, but not AxxBD, and A%BD
matches AxxBD, but not AxxBC or AxxBD indicates a pad character).

Example 1
Using the following settings in a CMetaFilterInfo object:
filterInfo.Filter.SetPropertyID(PID_NAME);
filterInfo.Filter.SetString(_T(%Pres%));
filterInfo.SetComparisonOperator(REGEX);

The MDS function will return objects with the following names:
VicePresident
President
PresidentElect
Elvis Presley

Example 2
Changing the search string to:
filterInfo.Filter.SetString(_T(P%));

The MDS function will return all objects with the names beginning with the character P:
Peterson
Powell
Pruitt

Example 3
Changing the search string to:
filterInfo.Filter.SetString(_T(_a%));

Uses the % and _ characters to select a list of names with the letter A as the second letter in the
name. The length of the name returned may be two or more characters. The function will
return objects with the following names:
Marston
Watson
Car

If the example used _a_, the search would be for a three-character string name with the letter
a as the second character. In this case, the only object returned is:
Car

220

Teradata Meta Data Services Programmer Guide

Chapter 8: CMetaFilterInfo Class


CMetaFilterInfo Class Functions

NULL Values
Setting the search string value to NULL would cause indeterminate results so this is not
allowed. MDS will not return NULL property fields as matches.

Property Types
The REGEX ComparisonOperator can only be used with character string properties (those
which have been defined with PropertyType=SQL_CHAR or SQL_VARCHAR). Although
properties with a ProperyType=SQL_DATE accept and return a string value, REGEX is not a
valid ComparisonOperator for those property types.

CMetaFilterInfo Class Functions


The CMetaFilterInfo class functions are:

Constructor

Initialize

GetComparisonOperator

SetComparisonOperator

GetLogicalOperator

SetLogicalOperator

GetParenthesesCount

SetParenthesesCount

These functions are described more fully in the following paragraphs.

Constructor
The CMetaFilterInfo Class constructor is as follows:
CMetaFilterInfo();

Initialize
Purpose
This CMetaFilterInfo Initialize function resets to default conditions and empties the property
constraint.
Syntax
void Initialize();

Teradata Meta Data Services Programmer Guide

221

Chapter 8: CMetaFilterInfo Class


CMetaFilterInfo Class Functions

GetComparisonOperator
Purpose
The CMetaFilterInfo GetComparisonOperator function returns the value of the
ComparisonOperator.
Syntax
MetaComparisonOperator GetComparisonOperator() const;

SetComparisonOperator
Purpose
The CMetaFilterInfo SetComparisonOperator function sets the ComparisonOperator to the
type of comparison to use in the property search.
Description
The default value for the ComparisonOperator is EQUAL.
Syntax
void SetComparisonOperator(
const MetaComparisonOperator &compOp);

Argument

In/Out

Description

comparisonOpera
tor

In

Operator which defines the type of comparison for the property


search. The values are:

EQUAL
LESS_THAN
GREATER_THAN
NOT_EQUAL
LESS_THAN_OR_EQUAL
GREATER_THAN_OR_EQUAL
IS_NULL (matches properties in which the property value has
never been set)
IS_NOT_NULL (matches properties in which a value has been
set. This value can be zero).
REGEX (applicable to string comparisons only searches for a
character string pattern within another character string or
character string expression)

Example 1
filterInfo.SetComparisonOperator(REGEX);

222

Teradata Meta Data Services Programmer Guide

Chapter 8: CMetaFilterInfo Class


CMetaFilterInfo Class Functions

GetLogicalOperator
Purpose
The CMetaFilterInfo GetLogicalOperator function returns the value of the LogicalOperator.
Syntax
MetaLogicalOperator GetLogicalOperator() const;

SetLogicalOperator
Purpose
The CMetaFilterInfo SetComparisonOperator function sets the LogicalOperator to use in the
property search.
Description
If multiple properties are specified in the search, the logical operator between the property
searches must be specified. The default value for the LogicalOperator is META_AND.
Syntax
void SetLogicalOperator(
const MetaLogicalOperator &logicalOp);

Argument

In/Out

Description

logicalOperator

In

Operator which defines the type of operator between


properties. The values are:
META_AND
META_OR

GetParenthesesCount
Purpose
The CMetaFilterInfo GetParenthesesCount returns the number of open or close parentheses
that have been set for this search property.
Syntax
void GetOpenParenthesesCount(short &openCountArg) const;
void GetCloseParenthesesCount(short &closeCountArg) const;

SetParenthesesCount
Purpose
The CMetaFilterInfo SetParenthesesCount function sets the number of open parentheses to
place before this search argument or the number of close parentheses to place after the
argument.

Teradata Meta Data Services Programmer Guide

223

Chapter 8: CMetaFilterInfo Class


CMetaFilterInfo Class Functions

Description
The precedence of the search properties can be set.
The total number of open parentheses set in the CMetaFilterInfo list must match the total
number of close parentheses set.
Syntax
void SetOpenParenthesesCount(const short CountArg);
void SetCloseParenthesesCount(const short CountArg);

Argument

In/Out

Description

CountArg

In

For SetOpenParenthesesCount, the number of open parentheses to place before this property in
the search SQL. For SetCloseParenthesesCount, the number of close parentheses to place after this
property in the search SQL

Example 1
With three search properties and a search precedence of:
Name=basket AND (Type>10 OR Size<999)
The open count of the Parentheses in the CMetaFilterInfo object for the Type property
would be set to 1. The close count of the Parentheses Count in the CMetaFilterInfo object for
the Size property would be set to 1. The following is an example of how this would be coded:
CLEARVECTOR(propFilter);
filterInfo.value.SetPropertyID(PID_CMN_NAME);
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.value.SetString(_T("basket"));
filterInfo.SetLogicalOperator(META_AND);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetPropertyID(10);
filterInfo.SetComparisonOperator(GREATER_THAN);
filterInfo.value.SetInt(10);
filterInfo.SetOpenParenthesesCount(1);
// Open Parenthesis Count = 1
filterInfo.SetLogicalOperator(META_OR);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetPropertyID(12);
filterInfo.SetComparisonOperator(LESS_THAN);
filterInfo.value.SetInt(999);
filterInfo.SetCloseParenthesesCount(1); // Close Parenthesis Count = 1
propFilter.push_back(filterInfo);
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);
result = obj.GetClassObjectsByProperty(objectList, propFilter, sortList,
gClassID, lClassID);

Example 2
Here is an example of using multiple open parentheses:

224

Teradata Meta Data Services Programmer Guide

Chapter 8: CMetaFilterInfo Class


CMetaFilterInfo Class Functions

(y=45 or (x=8888 and (description LIKE %n% or description LIKE %city)))


CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.value.SetPropertyID(10);
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.value.SetShort(45);
filterInfo.SetOpenParenthesesCount(1); // Open count = 1
filterInfo.SetLogicalOperator(META_OR);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetPropertyID(11);
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.value.SetInt(8888);
filterInfo.SetOpenParenthesesCount(1); // Open count = 1
filterInfo.SetLogicalOperator(META_AND);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetPropertyID(PID_CMN_DESCRIPTION);
filterInfo.SetComparisonOperator(REGEX);
filterInfo.value.SetString(_T("%in%"));
filterInfo.SetOpenParenthesesCount(1); // Open count = 1
filterInfo.SetLogicalOperator(META_OR);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetPropertyID(PID_CMN_DESCRIPTION);
filterInfo.SetComparisonOperator(REGEX);
filterInfo.value.SetString(_T("%city"));
filterInfo.SetCloseParenthesesCount(3); // Close count = 3
propFilter.push_back(filterInfo);
result = obj.GetClassObjectsByProperty(objectList, propFilter, sortList,
gClassID, lClassID);

Example Code for CMetaFilterInfo


CMetaFilterInfo filterInfo;
// one property filter entry
MetaFilterInfoVector propFilter; // property filter list
CMetaObject obj;
CMetaObjectVector objectList;
PrintHeader(23.02,
"Ok: get all Autos (by class loid, PID) w/ DesignDate =
'1997-03-30'");
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.Filter.SetPropertyID(3);
filterInfo.Filter.SetString(_TEXT("1997-03-30"));
filterInfo.SetComparisonOperator(EQUAL);
propFilter.push_back(filterInfo);
result = obj.GetClassObjectsByProperty(objectList, propFilter, NULLGUID,
lClassID);
PrintHeader(23.03,
"Ok: get all Autos (by class GUID, PID) w/ BasePrice <
15480");

Teradata Meta Data Services Programmer Guide

225

Chapter 8: CMetaFilterInfo Class


CMetaFilterInfo Class Functions
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo. Filter.SetPropertyID(2);
filterInfo. Filter.SetShort(15480);
filterInfo.SetComparisonOperator(LESS_THAN);
propFilter.push_back(filterInfo);
result = obj.GetClassObjectsByProperty(objectList, propFilter,
NULLGUID, lClassID);
// Composition showing AND binds tighter than OR. If the OR were //
evaluated first, the result set would not contain the Avalon, //but since
the AND is evaluated first, it does.
PrintHeader(23.20,
"Ok: get Autos w/ CarId = '1013abff'XBF OR Review = 'tbd'" \
" AND DesignDate >= '1997-08-01'");
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.Filter.SetName(_TEXT("CarId"));
filterInfo.Filter.SetBinary(avalonId, 4);
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.SetLogicalOperator(META_OR);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.Filter.SetName(_TEXT("Review"));
filterInfo.Filter.SetString(_TEXT("tbd"));
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.SetLogicalOperator(META_AND);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.Filter.SetName(_TEXT("DesignDate"));
filterInfo.Filter.SetString(_TEXT("1997-08-01"));
filterInfo.SetComparisonOperator(GREATER_THAN_OR_EQUAL);
propFilter.push_back(filterInfo);
result = obj.GetClassObjectsByProperty(objectList, propFilter,
NULLGUID, lClassID);

226

Teradata Meta Data Services Programmer Guide

CHAPTER 9

CMetaProperty Class

This chapter describes the C++ Class CMetaProperty functions that get and set CMetaObject
properties.

CMetaProperty Class Functions


The CMetaProperty class functions are:

CMetaProperty Constructors

Operator =

Operator ==

Operator <

Initialize

Copy

GetName

SetName

GetPropertyID

SetPropertyID

PrintProperty

PrintValue

PrintValueType

Functions to Get the Property Value

Functions to Set the Property Value

Set NULL Functions

These functions are described more fully in the following paragraphs.

CMetaProperty Constructors
The first step for users of the CMetaProperty class is to instantiate the CMetaProperty by
calling one of the CMetaProperty constructors.
CMetaProperty(void)
This CMetaProperty Class constructor is the default constructor and takes no arguments. It
instantiates a CMetaProperty with default values.

Teradata Meta Data Services Programmer Guide

227

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

CMetaProperty(const CMetaProperty &metaProperty)


This CMetaProperty Class constructor instantiates a CMetaProperty and copies the values
from the specified CMetaProperty object.

Operator =
Purpose
The CMetaProperty class = operator function copies object B to object A.
Syntax
CMetaProperty & operator=(const CMetaProperty &);

Usage:
CMetaProperty objectA, objectB;
.
.
.
objectA = objectB;

Operator ==
Purpose
The CMetaProperty class == operator function returns 1 if objectA is equal to objectB. The
operator returns 0 if the objects are not equal.
Syntax
int operator==(const CMetaProperty &);

Usage:
CMetaProperty objectA, objectB;
.
.
.
if (objectA == objectB){
//objects are equal
}else{
//Objects are not equal
}

Operator <
Purpose
The CMetaProperty class < operator function returns 1 if the PropertyID of objectA is less
than the PropertyID of objectB.
The operator returns 0 if the PropertyID of objectA is equal to or greater than the PropertyID
of objectB.

228

Teradata Meta Data Services Programmer Guide

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

Syntax
static bool operator<(const CMetaProperty &x const CMetaProperty &y);

Usage:
CMetaProperty objectA, objectB;
.
.
.
if (objectA < objectB){
//property ID of A is less than property ID of B
}else{
//property ID of A is not less than property ID of B
}

Initialize
Purpose
The CMetaProperty class Initialize function resets the CMetaProperty attributes to the default
values.
Syntax
void Initialize(void);

Copy
Purpose
The CMetaProperty class Copy function copies the specified object to this object.
Syntax
HRESULT Copy(const CMetaProperty &prop);

Argument

In/Out

Description

prop

In

CMetaProperty object to copy from.

GetName
Purpose
The CMetaProperty class GetName function retrieves the property name.
Syntax
LPCTSTR GetName(void);

SetName
Purpose
The CMetaProperty class SetName function sets the property name.

Teradata Meta Data Services Programmer Guide

229

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

Syntax
void SetName(LPCTSTR Name);

Argument

In/Out

Description

Name

In

Property name.

GetPropertyID
Purpose
The CMetaProperty class GetPropertyID function returns the property ID of the object.
Syntax
const OBJECTID_t GetPropertyID(void);

SetPropertyID
Purpose
The CMetaProperty class SetPropertyID function sets the property ID of the object.
Syntax
HRESULT

SetPropertyID(OBJECTID_t ObjectID);

Argument

In/Out

Description

objectID

In

Relative propertyID.

PrintProperty
Purpose
The CMetaProperty class PrintProperty function displays the property attributes to standard
output.
Syntax
void PrintProperty(ostream& os=cout);

The format is:


PropertyName=PropertyValue

Examples:
CarId=1003abdf
Property99=103
VehicleType=Sports and GT Cars

230

Teradata Meta Data Services Programmer Guide

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

PrintValue
Purpose
The CMetaProperty class PrintValue function writes the property value to the ostream.
Syntax
void PrintValue(ostream &os);

PrintValueType
Purpose
The CMetaProperty class PrintValueType function writes the property type to the ostream.
Syntax
void PrintValueType(ostream &os);

Functions to Get the Property Value


These functions return the property value of the specified type. An error is returned if the
property is not of the type requested
bool IsNull() const;

Returns true if the Property value is NULL, otherwise returns false.


bool IsBinaryAString() const;

Returns true if the value was set with the SetBinaryString function. Returns false if the value
was set with the SetBinary function or was read from the MDS repository. If true, the value is
a hex string for example 3030303030633034 for the hex value 0x00c4.
HRESULT GetBinary(void* buf, int &bufsz);

Caller must provide a pointer <buf> to a buffer large enough to hold the return value. Copies
the binary buffer to <buf> and sets <bufsz> to the number of bytes in the buffer for a binary
property. Returns <bufsz> = 0 if the property value is NULL.
HRESULT GetBinaryAsString(String &val);

Returns a string containing the value of a binary buffer printed as hexadecimal or an empty
string if the property value is NULL.
HRESULT GetBool(short &val)

Returns the value of a (short) Boolean property or 0 if the property value is NULL.
HRESULT GetChar(char &val);

Returns the value of a char property or 0 if the property value is NULL.


HRESULT GetDate(double &val)

Returns the value of a floating-point date property 0.0 if the property value is NULL.
HRESULT GetDbl(double &val)

Teradata Meta Data Services Programmer Guide

231

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

Returns the value of a double property or 0.0 if the property value is NULL. Equivalent to
GetDouble.
HRESULT GetDouble(double &val)

Returns the value of a double property or 0.0 if the property value is NULL. Equivalent to
GetDbl.
HRESULT GetFloat(float &val)

Returns the value of a floating-point property or 0.0 if the property value is NULL.
HRESULT GetInt(int &val)

Returns the value of an integer property or 0 if the property value is NULL. Equivalent to
GetLong.
HRESULT GetLong(long &val)

Returns the value of a long property or 0 if the property value is NULL. Equivalent to GetInt.
HRESULT GetShort(short &val)

Returns the value of a short property or 0 if the property value is NULL.


HRESULT GetString(String &val);

Returns the value of a string property or an empty string if the property value is NULL.
HRESULT GetUChar(unsigned char &val)

Returns the value of an unsigned char property or 0 if the property value is NULL.
VARIANT GetValue(void);

GetValue returns the property value and type in a Windows VARIANT structure. This
function is used to support the CMetaCOM APIs and will only be available on Windows
platforms. When the caller is done with the VARIANT that is returned, they should clear it
using the VariantClear function provided by Windows to free any string or array pointers it
may contain.
const unsigned short GetVarType(void) const;

GetVarType returns the numeric value for the Variant Type for the current property.

232

Variant Type

Numeric Equivalent of Variant Type

VT_I2

VT_I4

VT_R8

VT_DATE

VT_BSTR

VT_BOOL

11

VT_UI1

17

VT_ARRAY|VT_UI1

8209

Teradata Meta Data Services Programmer Guide

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

Functions to Set the Property Value


HRESULT SetBinary(void* val, const int sz);
HRESULT SetBinary(unsigned long val);
HRESULT SetBinaryString(const void *val, const int sz);

If the data is hex data as follows:


unsigned char b[] = { 0x00, 0x00, 0x0c, 0x04}
use the SetBinary function.
If the data is string hex data such as is created with the sprintf function
sprintf(Buf , "%08lX", DatabaseId);
that for the decimal value 3076, hex value C04 will write the hex string 3030303030633034in
the buffer, you must use the SetBinaryString function.
void SetBool(const short val);
void SetChar(const char val);

A char represents a signed binary integer value in the range 128 to 127.
void SetDate(const double val);

SetDate stores the date value using the DATE data type. DATE is represented as an 8-byte
floating-point number. Days are represented by whole number increments starting with 30
December 1899, midnight as time zero. Hour values are expressed as the absolute value of the
fractional part of the number. The following table illustrates this.
Date and time

Representation

30 December 1899, midnight

0.00

1 January 1950, midnight

52.00

4 January 2000, midnight

105.00

4 January 2000, 6 A.M.

105.25

4 January 2000, noon

105.50

4 January 2000, 9 P.M.

105.875

void SetDbl(const double val)


void SetDouble(const double val)

// same as SetDouble
// same as SetDbl

void SetFloat(const float val)


void SetInt(const long val)
void SetLong(const long val)

// same as SetLong
// same as SetInt

void SetShort(const short val)


void SetString(LPCTSTR val);

Passing in a NULL pointer to SetString is equivalent to setting the property value to NULL.

Teradata Meta Data Services Programmer Guide

233

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions
void SetStringLiteral(LPCTSTR val);

MDS will write the string exactly as specified. For strings set with the SetString function, MDS
will add single quotes around the value when creating the SQL to issue to Teradata to write the
value to the MDS repository. For strings set with the SetStringLiteral function, MDS will not
add the single quotes. Therefore when using SetStringLiteral, val must contain a single quoted
string or a Teradata built in function name. The supported functions are:

CURRENT_DATE

DATE

CURRENT_TIME

CURRENT_TIMESTAMP

The SetStringLiteral function enables specification of Teradata literals or case sensitivity


characters. For example:

TIME 15:30

DATE 1998-06-01

XmL (CS)

XmL (NOT CS)

1A1FXC

void SetUChar(const unsigned char val);

The char type is used to store the integer value of a member of the character set. That integer
value is the ASCII code corresponding to the specified character. Character values of type
unsigned char have a range from 0 to 0xFF hexadecimal or 0 to 255 decimal.
HRESULT SetValue(VARIANT value);

SetValue accepts a Windows VARIANT structure and sets the CMetaProperty value and type
according to those in the VARIANT. This function is used to support the CMetaCOM APIs
and will only be available on Windows platforms. Only the following VARIANT types are
supported:

VT_I2

VT_I4

VT_R8

VT_DATE

VT_BSTR

VT_BOOL

VT_UI1

VT_UI1 | VT_ARRAY

Any other VARIANT type will cause SetValue to return the


META_E_UNSUPPORTED_VARIANT_TYPE error code.

234

Teradata Meta Data Services Programmer Guide

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

Set NULL Functions


The following functions set the variant type according to the Set method called and set the
property value to NULL. The data value written to the repository for this property will be the
database NULL value.
void
void
void
void
void
void
void
void
void
void
void
void
void

SetNull(); // can
SetBinaryNull();
SetBoolNull();
SetCharNull();
SetDateNull();
SetDblNull();
SetDoubleNull();
SetFloatNull();
SetIntNull();
SetLongNull();
SetShortNull();
SetStringNull();
SetUCharNull();

Teradata Meta Data Services Programmer Guide

be used for all data types

// same as SetDoubleNull
// same as setDblNull
// same as SetLongNull
// same as SetIntNull

235

Chapter 9: CMetaProperty Class


CMetaProperty Class Functions

236

Teradata Meta Data Services Programmer Guide

CHAPTER 10

ObjectKey Classes

This chapter describes the following MDS ObjectKey classes.

CMetaObjectKey Class

CMetaObjectClassKey Class

CMetaVersionedObjectKey Class

CMetaVersionedObjectClassKey Class

CMetaLabeledObjectKey Class

CMetaRelationshipKey Class

CMetaObjectKey Class
The CMetaObjectKey class defines the identifiers of an object (Object ID and name). It is
returned from CMetaObject::GetClassObjectKeys, CMetaObject::GetDestCollectionKeys and
CMetaObject::GetOrigCollectionKeys functions. The class has the following functions:

Initialize

Operator ==

Operator <

GetObjectName

SetObjectName

GetObjectID

SetObjectID

Note: ObjectKey API calls return a subset of the properties returned by the standard interface
that returns all of an objects properties. For example, an ObjectKey call can return specific
parameter values for an object, such as the object name and id. If fewer details are required,
use of ObjectKey calls provides more efficiency resulting in better performance.
For something in between the standard object API and ObjectKey calls, use a property filter
that allows fetching additional object properties that are not provided through an ObjectKey
call. Filters allow users to specify specific object properties to be returned.

Initialize
Purpose
The Initialize function resets CMetaObjectKey attributes to default values.

Teradata Meta Data Services Programmer Guide

237

Chapter 10: ObjectKey Classes


CMetaObjectKey Class

Syntax
void Initialize(void);

Operator ==
Purpose
The Operator== function returns 1 if objectA is equal to objectB, 0 if the objects are not
equal.
Syntax
int operator==(const CMetaObjectKey &);

Usage:
CMetaObjectKey objectA, objectb:
...
if (objectA == objectB)
//objects are equal
else
//objects are not equal

Operator <
Purpose
The Operator< function returns TRUE if the object ID of objectA is less than the object ID of
object B.
Syntax
bool operator< (const CMetaObjectKey& object)

Usage:
CMetaObjectKey objectA, objectb:
...
if (objectA < objectB)
//objectid of A is less than objectid of B
else
// objectid of A is not less than objectid of B

GetObjectName
Purpose
The GetObjectName function retrieves the object name.
Syntax
LPCTSTR GetObjectName(void);

238

Teradata Meta Data Services Programmer Guide

Chapter 10: ObjectKey Classes


CMetaObjectClassKey Class

SetObjectName
Purpose
The SetObjectName function sets the object name.
Syntax
void SetObjectName(LPCTSTR strObjName);

GetObjectID
Purpose
The GetObjectID function retrieves the object ID.
Syntax
LPCTSTR GetObjectID (void);

SetObjectID
Purpose
The SetObjectID function sets the object ID.
Syntax
void SetObjectID (LPCTSTR strObjName);

CMetaObjectClassKey Class
The CMetaObjectClassKey Class contains the identifiers of an object (Object ID and name),
from CMetaObjectKey, and adds the Class Name and Class ID of the object.
It is returned from CMetaSecurityProfile::GetObjectsUsingSecurityProfile.
This class inherits CMetaObjectKey.
The class has the following functions:

Initialize

GetClassName

SetClassName

GetClassID

SetClassID

Initialize
Purpose
The Initialize function resets CMetaObjectClassKey attributes to default values.

Teradata Meta Data Services Programmer Guide

239

Chapter 10: ObjectKey Classes


CMetaObjectClassKey Class

Syntax
void Initialize(void);

GetClassName
Purpose
The GetClassName function retrieves the name of the class in which the object belongs.
Syntax
LPCTSTR GetClassName(void);

SetClassName
Purpose
The SetClassName function sets the class name.
Syntax
void SetClassName(LPCTSTR strClassNameArg);

GetClassID
Purpose
The GetClassID function retrieves the class ID of the object.
Syntax
const OBJECTID_t GetClassID(void);

SetClassID
Purpose
The SetClassID function sets the class ID of the object.
Syntax
void SetClassID(const OBJECTID_t lOIDArg);

240

Teradata Meta Data Services Programmer Guide

Chapter 10: ObjectKey Classes


CMetaVersionedObjectKey Class

CMetaVersionedObjectKey Class
The CMetaVersionedObjectKey class defines the identifiers of an object version (Object ID,
name, version number, and publish state).
It is returned from the CMetaObject::GetClassObjectVersionKeys,
CMetaObject::FindAllOccurrences and CMetaObject::FindLabel functions.
This class inherits from CMetaObjectKey class.
The class has the following functions:

Initialize

Operator ==

Operator <

GetVersionNumber

SetVersionNumber

GetPublishState

SetPublishState

IsPublished

IsDormant

IsFrozen

Initialize
Purpose
The Initialize function resets CMetaVersionedObjectKey attributes to default values.
Syntax
void Initialize(void);

Operator ==
Purpose
The Operator== function returns 1 if objectA is equal to objectB, 0 if the objects are not
equal. Two objects are equal if the object ID, name, version number, and publish state are
equal.
Syntax
int operator==(const CMetaObjectKey &);

Usage:
CMetaVersionedObjectKey objectA, objectb:
...
if (objectA == objectB)
//objects are equal

Teradata Meta Data Services Programmer Guide

241

Chapter 10: ObjectKey Classes


CMetaVersionedObjectKey Class
else
//objects are not equal

Operator <
Purpose
The Operator< function returns TRUE if the object ID of ObjectA is less than the object ID or
ObjectB or the version number of ObjectA is less than the version number of ObjectB.
Syntax
bool operator< (const CMetaObjectKey& object)

Usage:
CMetaVersionedObjectKey objectA, objectb:
...
if (objectA < objectB)
//objectid of A is less than objectid of B
else
// objectid of A is not less than objectid of B

GetVersionNumber
Purpose
The GetVersionNumber function retrieves the version number.
Syntax
VERSIONNUMBER_t GetVersionNumber(void) const;

SetVersionNumber
Purpose
The SetVersionNumber function sets the version number.
Syntax
void SetVersionNumber(const VERSIONNUMBER_t lVer);

GetPublishState
Purpose
The GetPublishState function returns the publish state.
Syntax
META_PUBLISH_STATE GetPublishState(void) const;

242

Teradata Meta Data Services Programmer Guide

Chapter 10: ObjectKey Classes


CMetaVersionedObjectClassKey Class

SetPublishState
Purpose
The SetPublishState function sets the publish state.
Syntax
void SetPublishState(const META_PUBLISH_STATE lPublish);

IsPublished
Purpose
The IsPublished function returns true if the version's publish state indicates that it is the
current published version, else it returns false
Syntax
bool IsPublished(void) const;

IsDormant
Purpose
The IsDormant function returns true if the version is dormant, else it returns false
Syntax
bool IsDormant(void) const;

IsFrozen
Purpose
The IsFrozen function returns true if the object is frozen and can not be modified, else it
returns false
Syntax
bool IsFrozen(void) const;

CMetaVersionedObjectClassKey Class
The CMetaVersionedObjectClassKey Class contains the identifiers of an object version
(Object ID, name, version number, and publish state), from CMetaVersionedObjectKey, and
adds the Class Name and Class ID of the object.
It is returned from CMetaObject::GetDestCollectionVersionKeys and
CMetaObject::GetOrigCollectionVersionKeys.
This class inherits CMetaObjectClassKey.

Teradata Meta Data Services Programmer Guide

243

Chapter 10: ObjectKey Classes


CMetaVersionedObjectClassKey Class

The class has the following functions:

Initialize

GetClassName

SetClassName

GetClassID

SetClassID

GetVersionNumber

SetVersionNumber

GetPublishState

SetPublishState

IsPublished

IsDormant

IsFrozen

Initialize
Purpose
The Initialize function resets CMetaVersionedObjectClassKey attributes to default values.
Syntax
void Initialize(void);

GetClassName
Purpose
The GetClassName function retrieves the name of the class in which the object belongs.
Syntax
LPCTSTR GetClassName(void);

SetClassName
Purpose
The SetClassName function sets the class name.
Syntax
void SetClassName(LPCTSTR strClassNameArg);

GetClassID
Purpose
The GetClassID function retrieves the class ID of the object.

244

Teradata Meta Data Services Programmer Guide

Chapter 10: ObjectKey Classes


CMetaVersionedObjectClassKey Class

Syntax
const OBJECTID_t GetClassID(void);

SetClassID
Purpose
The SetClassID function sets the class ID of the object.
Syntax
void SetClassID(const OBJECTID_t lOIDArg);

GetVersionNumber
Purpose
The GetVersionNumber function retrieves the version number.
Syntax
VERSIONNUMBER_t GetVersionNumber(void) const;

SetVersionNumber
Purpose
The SetVersionNumber function sets the version number.
Syntax
void SetVersionNumber(const VERSIONNUMBER_t lVer);

GetPublishState
Purpose
The GetPublishState function returns the publish state.
Syntax
META_PUBLISH_STATE GetPublishState(void) const;

SetPublishState
Purpose
The SetPublishState function sets the publish state.
Syntax
void SetPublishState(const META_PUBLISH_STATE lPublish);

Teradata Meta Data Services Programmer Guide

245

Chapter 10: ObjectKey Classes


CMetaRelationshipKey Class

IsPublished
Purpose
The IsPublished function returns true if the version's publish state indicates that it is the
current published version, else it returns false
Syntax
bool IsPublished(void) const;

IsDormant
Purpose
The IsDormant function returns true if the version is dormant, else it returns false
Syntax
bool IsDormant(void) const;

IsFrozen
Purpose
The IsFrozen function returns true if the object is frozen and can not be modified, else it
returns false
Syntax
bool IsFrozen(void) const;

CMetaRelationshipKey Class
The CMetaRelationshipKey class describes an entry in a repository relationship. It contains
the identifiers of an object version (Object ID, name, version number, and publish state, class
name, and class ID), from CMetaVersionedObjectClassKey, and adds an explanation string
describing the relationship between the referenced object and an origin or destination object.
This class inherits the CMetaVersionedObjectClassKey and all of the routines externalized by
that class.
The class has the following functions:

246

Initialize

Operator =

GetExplanation

SetExplanation

Teradata Meta Data Services Programmer Guide

Chapter 10: ObjectKey Classes


CMetaLabeledObjectKey Class

Initialize
Purpose
The Initialize function resets CMetaRelationshipKey class attributes to default values.
Syntax
void Initialize();

Operator =
Purpose
Assigns the fields of one CMetaRelationshipKey object to those of another
CMetaRelationshipKey object.
Syntax
CMetaRelationshipKey &operator=(const CMetaRelationshipKey &);

GetExplanation
Purpose
The GetExplanation function returns the explanation string for the relationship represented
by this key.
Syntax
String GetExplanation() const;

SetExplanation
Purpose
The SetExplanation function sets the value of the explanation string. The routine will return
an error if memory can not be obtained to save the passed string value.
Syntax
HRESULT SetExplanation(LPCTSTR s);

CMetaLabeledObjectKey Class
The CMetaLabeledObjectKey class contains the name, objectID, version, and publish state of
an object, plus the name of a label that is applied to the object.
This class is returned by CMetaObject::FindAllLabels.
The class has the following functions:

Initialize

GetObjectName

Teradata Meta Data Services Programmer Guide

247

Chapter 10: ObjectKey Classes


CMetaLabeledObjectKey Class

GetObjectID

GetVersionNumber

GetObjectID

GetVersionNumber

GetPublishState

IsPublished

GetLabelName

Initialize
Purpose
The Initialize function resets CMetaLabeledObjectKey attributes to default values.
Syntax
void Initialize(void);

GetObjectName
Purpose
The GetObjectName function retrieves the object name.
Description
This information is necessary because the different versions of an object may have different
names.
Syntax
LPCTSTR GetObjectName(void);

GetObjectID
Purpose
The GetObjectID function retrieves the object ID.
Syntax
LPCTSTR GetObjectID (void);

GetVersionNumber
Purpose
The GetVersionNumber function retrieves the version number.
Syntax
VERSIONNUMBER_t GetVersionNumber(void) const;

248

Teradata Meta Data Services Programmer Guide

Chapter 10: ObjectKey Classes


CMetaLabeledObjectKey Class

GetPublishState
Purpose
The GetPublishState function returns the publish state.
Syntax
META_PUBLISH_STATE GetPublishState(void) const;

IsPublished
The IsPublished function returns true if the version's publish state indicates that it is the
current published version, else it returns false
bool IsPublished(void) const;

GetLabelName
Purpose
The GetLabelName function returns the name of the label that has been applied to the object
version.
Syntax
LPCTSTR GetLabelName(void) const;

Teradata Meta Data Services Programmer Guide

249

Chapter 10: ObjectKey Classes


CMetaLabeledObjectKey Class

250

Teradata Meta Data Services Programmer Guide

CHAPTER 11

CMetaLabel Class

This chapter describes the C++ Class CMetaLabel Class functions that contain the identifiers
of an object (Object ID and name).
Use the CMetaLabel class to define labels and to define the objects that a specific label will
apply to. Because the CMetaLabel class is non-versioned, the class can not be redefined and
the individual entries will never have more than one version.

CMetaLabel Class Functions


The CMetaLabelClass functions are:

CMetaLabel Constructors

Initialize

SetAIMLabel

SetClassLabel

SetObjectsLabel

GetObjectKeys

GetCreatorName

SetCreatorName

SetAndMoveObjectsLabel

DeleteObjectsLabel

CMetaLabel Constructors
CMetaLabel(void)
This constructor instantiates a CMetaLabel object to be created.
CMetaLabel(const OBJECTID_t lOID);
This constructor instantiates a CMetaLabel object identified by the internal object ID lOID.
The user invokes ReadObject to retrieve the object from the repository.
CMetaLabel(const TCHAR *label, const TCHAR *creator);
This constructor instantiates a CMetaLabel object to create. Follow this call with a call to
WriteObject to write the label definition to the MDS Repository. This constructor can also be
used to instantiate an object for reading, in which case the creator value is ignored.

Teradata Meta Data Services Programmer Guide

251

Chapter 11: CMetaLabel Class


CMetaLabel Class Functions

Initialize
Purpose
Initialize sets the CMetaLabel attributes to default values.
Syntax
void Initialize(void);

SetAIMLabel
Purpose
SetAIMLabel applies the current label to all objects in all classes in the specified AIMs.
Description
The label is only applied to the currently published version for each object in an AIM.
Requirements:
The object ID (internal or globally unique) or the name must be set.
Syntax
HRESULT SetAIMLabel(LLOBJECTID_t &AIMList);

Argument

In/Out

Description

AIMList

In

List of object IDs for the metamodels to be labeled.

SetClassLabel
Purpose
SetClassLabel applies the current label to all objects in the specified classes.
Description
If bPropagate is true, the label will also be applied recursively to all destination objects
reachable from the class's objects, else only the specific objects in the class will receive the
label. The label is only applied to the currently published version for each object in a class.
Requirements:
The object ID (internal or globally unique) or the name must be set.
Syntax
HRESULT SetClassLabel(
LLOBJECTID_t &classList,
const bool bPropagate = true);

252

Teradata Meta Data Services Programmer Guide

Chapter 11: CMetaLabel Class


CMetaLabel Class Functions

Argument

In/Out

Description

classList

In

List of object IDs for the classes to be labeled.

bPropagate

In

Flag indicating if the label should also apply to all objects


reachable from the class objects.

SetObjectsLabel
Purpose
SetObjectsLabel applies the current label to all objects in objList.
Description
If bPropagate is true, the label will also be applied recursively to all destination objects
reachable from the objects, else only the specific objects themselves will receive the label. The
label is only applied to the currently published version for each object.
Requirements:
The object ID (internal or globally unique) or the name must be set.
Syntax
HRESULT SetObjectsLabel(
LLOBJECTID_t &objList,
const bool bPropagate = true);

Argument

In/Out

Description

objList

In

List of object IDs for the objects to be labeled.

bPropagate

In

Flag indicating if the label should also apply to all objects


reachable from the objects.

SetAndMoveObjectsLabel
Purpose
SetAndMoveObjectsLabel applies the current label to all objects in objList.
Description
If bPropagate is true, the label will also be applied recursively to all destination objects
reachable from the objects, else only the specific objects themselves will receive the label. The
label is only applied to the currently published version for each object.
If the label is currently applied to a non-current version of one of the objects, the label will be
moved from the non-current version to the current version.
Requirements:
The object ID (internal or globally unique) or the name must be set.

Teradata Meta Data Services Programmer Guide

253

Chapter 11: CMetaLabel Class


CMetaLabel Class Functions

Syntax
HRESULT SetAndMoveObjectsLabel(
LLOBJECTID_t &objList,
const bool bPropagate = true);

Argument

In/Out

Description

objList

In

List of object IDs for the objects to be labeled.

bPropagate

In

Flag indicating if the label should also apply to all objects


reachable from the objects.

DeleteObjectsLabel
Purpose
DeleteObjectsLabel removes the current label from all objects in objList.
Description
If bPropagate is true, the removal will also be applied recursively to all destination objects
reachable from the objects, else only the specific objects themselves will lose the label
Requirements:
The object ID (internal or globally unique) or the name must be set.
Syntax
HRESULT DeleteObjectsLabel(
LLOBJECTID_t &objList,
const bool bPropagate = true);

Argument

In/Out

Description

objList

In

List of object IDs for the objects to be labeled.

bPropagate

In

Flag indicating if the label should also apply to all objects


reachable from the objects.

GetObjectKeys
Purpose
GetObjectKeys returns the keys for all object versions in the repository, in a metamodel, or in
a class that have the current label.
Description
If all of the four parameters gModelGuid, ModelLoid, gClassGuid, and ClassLoid are null or
not specified, then all object versions in the repository with the current label are returned.
If one of gModelGuid or ModelLoid is not null, then all object versions in the metamodel with
the current label are returned.

254

Teradata Meta Data Services Programmer Guide

Chapter 11: CMetaLabel Class


CMetaLabel Class Functions

If both gModelGuid and ModelLoid are null and one of gClassGuid or ClassLoid is not null,
then all object versions in the class with the current label are returned.
Requirements:
The object ID (internal or globally unique) or the name must be set.
Syntax
HRESULT GetObjectKeys(
vector<CMetaVersionedObjectClassKey>& returnList,
const GUID &gModelGuid = NULLGUID,
const OBJECTID_t ModelLoid = NULLLOID,
const GUID &gClassGuid = NULLGUID,
const OBJECTID_t ClassLoid = NULLLOID);

Argument

In/Out

Description

returnList

In

Reference to vector to return the object keys; the list is cleared


before adding the return collection.

gModelGuid

In (Optional)

Globally unique ID for a metamodel.

ModelLoid

In (Optional)

Internal object ID for a metamodel.

gClassGuid

In (Optional)

Globally unique ID for a class.

ClassLoid

In (Optional)

Internal object ID for a class.

GetCreatorName
Purpose
GetCreatorName returns the name of the user that created the label.
Syntax
void GetCreatorName(String& name);

SetCreatorName
Purpose
SetCreatorName sets the name of the label's creator.
Description
This is a free-form string that can provide any desired identifying information. If this
information is not provided, the name of the creating MDS user is used.
Syntax
void SetCreatorName(const TCHAR *name);

Teradata Meta Data Services Programmer Guide

255

Chapter 11: CMetaLabel Class


CMetaLabel Class Functions

256

Teradata Meta Data Services Programmer Guide

CHAPTER 12

AIM Classes

This chapter describes the Meta Data Services APIs that describe to MDS the data that an
application will store in the MDS repository. The data definitions are described in Class,
Property, and Relationship descriptions. The group of data definitions for an application is
called an AIM.
The AIM classes are:

CMetaAIM Class: Class to create and read AIM objects, and to create Class and
Relationship Description objects, linking them to the AIM.

CMetaClassDesc Class: Class to create property description objects, and link them to this
class. Also used to get associated properties, and access the collection of relationship
descriptions involving that class.

CMetaPropertyDesc Class: Class to read a class property description object.

CMetaRelationshipDesc Class: Class to read a relationship description object.

All AIM classes inherit the functions of the CMetaPersist and CMetaObject classes. Changes
that can be made to an AIM are:

Adding class, property and relationship descriptions

Enabling or disabling data versioning for the AIM

Deleting property descriptions

Deleting a class description (deletes all objects in the class as well as the class description)

Deleting a relationship description (deletes all relationships of that type as well as the
relationship description)

Deleting an AIM (deletes all class, property and relationship descriptions in the AIM)

Note: See the WriteObject function in each AIM class section for the list of properties that can
be updated.
MDS manages the creation of these classes within the repository. To create an AIM, perform
the following steps:

Instantiate a CMetaAIM object.

Call CMetaAIM.CreateModel() passing in the AIM name and description parameters to


create a new model object in the MDS repository.

Call CMetaAIM.CreateClassDesc() passing in the appropriate parameters to create a class


description.

Using the CMetaClassDesc object returned from CreateClassDesc, call


CMetaClassDesc.CreatePropertyDesc() to create each of the Property Descriptions
associated with the class.

Teradata Meta Data Services Programmer Guide

257

Chapter 12: AIM Classes


CMetaAIM Class

Repeat the last two steps for each class description being created in the Model.

Call CMetaAIM.CreateRelationshipDesc() to create each relationship in the model.


An application can retrieve these model-related objects in two ways, depending on which
identifying characteristics are known:
If only the name is known for Class, Relationship or Property objects, the application must
create a CMetaAIM object and read the AIM object from the repository. Then invoke the
appropriate CMetaAIM:Getxxx functions directly, passing in the objects name. Use the
same process to get a named Property Description for a Class, once the CMetaClassDesc
object is obtained.
If the ObjectGUID or ObjectID is known, an application can instead:

Create the type of object desired using a constructor taking the ObjectGUID or
ObjectID.

Invoke the ReadObject function within the newly built object.

CMetaAIM Class
CMetaAIM Class Functions
The CMetaAIM class functions are:

CMetaAIM Constructors

Initialize

CreateMDSModel

CreateMDSClassDesc

CreateMDSClassDesc2

CreateMDSDerivedClass

CreateMDSRelationshipDesc

GetClassDesc

GetClassDescCollection

GetRelationshipDesc

GetRelationshipDescColl

GetVersioningSupport

SetModelVersioningFlag

WriteObject/WriteVersion

These functions are described more fully in the following paragraphs.

258

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaAIM Class

CMetaAIM Constructors
CMetaAIM(void);
This CMetaAIM constructor instantiates a CMetaAIM to be created. You need to follow this
call with invocation of the CreateModel function in the newly instantiated CMetaAIM object
to create a new model.
CMetaAIM(const OBJECTID_t lOID);
This CMetaAIM constructor instantiates a CMetaAIM identified by the ObjectID. You then
need to invoke the ReadObject function to retrieve the object from the repository database.
CMetaAIM(const GUID &GID);
This CMetaAIM constructor instantiates a CMetaAIM identified by an ObjectGUID. You then
need to invoke the ReadObject function to retrieve the object from the repository database.
CMetaAIM(LPCTSTR name);
This CMetaAIM constructor instantiates a CMetaAIM identified by the object name. You then
need to invoke the ReadObject function to retrieve the object from the repository database.

Initialize
Purpose
The CMetaAIMclass Initialize function resets the CMetaAIM attributes to default values.
Syntax
void Initialize(void);

CreateMDSModel
Purpose
The CMetaAIM CreateMDSModel function creates an AIM model object.
Description
The GUID can optionally be provided. The default OwnerID is the logged in user. The
metamodel's versioning support will be set from the repository's versioning support flag.
Requirements
When creating an AIM, CMetaAIM names must be unique within the repository database.
Updates to an existing model object are not permitted.
Syntax
HRESULT CreateMDSModel(
LPCTSTR strModelName,
LPCTSTR strModelDesc,
const GUID& gGID,
const OBJECTID_t lOwnerID = NULLLOID,

Teradata Meta Data Services Programmer Guide

259

Chapter 12: AIM Classes


CMetaAIM Class
const OBJECTID_t SecurityProfileID = NULLLOID);

Argument

In/Out

Description

Name

In

Name of the model.

Desc

In

Description of model.

gGUID

In

Global unique identifier of this model. Set to


NULLGUID to have MDS generate the GUID for the
model.

OwnerID

In (Optional)

OwnerID of this object.

SecurityProfileID

In (Optional)

Security Profile assigned to the object.

CreateMDSClassDesc
Purpose
The CMetaAIM CreateMDSClassDesc function creates a new class description in the current
model.
Description
The class can be used to create its associated property descriptions. It can also be used in new
relationship description definitions.
The default OwnerID is the logged in user. The class's versioning support will be set from the
AIM's versioning support.
Requirements
Updates to an existing Class Description object are not permitted.
Class names must be unique within an AIM.
Syntax
HRESULT CreateMDSClassDesc(
CMetaClassDesc *&pClassObj,
LPCTSTR strClassName,
LPCTSTR strClassDesc,
const short sUniqueNamesFlag,
const GUID& gClassID,
const OBJECTID_t lOwnerID,
const OBJECTID_t SecurityProfileID,
const bool bRootClass);

260

Argument

In/Out

Description

pClassObj

In/Out

Pointer to Class Desc object. If pClassObj is a pointer


to NULL, the object is created by the API. The calling
application is responsible for freeing the object.

Name

In

Name of the class.

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaAIM Class

Argument

In/Out

Description

Desc

In

Description of class.

UniqueNamesFlag

In

MD_UNIQUE = maintain unique names (default)


MD_NULL = do not maintain unique names.

gClassID

In

Global unique identifier to assign to this class.

OwnerID

In

OwnerID of this object. The default OwnerID is the


logged in user.

bRootClass

In

True = set this class to be a root class of the model.


The MDS browsers begin tree displays of the data in
the model at the root classes.

SecurityProfileID

in

Security Profile assigned to the object.

CreateMDSClassDesc2
Purpose
Creates a new class description and contains it in the current model.
Description
The class can be used to create its associated property descriptions. It can also be used in new
relationship description definitions.
The default OwnerID is the logged in user. The class's versioning support will be set from the
AIM's versioning support.
Requirements
Class names must be unique within an AIM.
Syntax
HRESULT CreateMDSClassDesc2(
CMetaClassDesc *&pClassObj,
LPCTSTR strClassName,
LPCTSTR strClassDesc,
const short sUniqueNamesFlag,
const GUID& gClassID,
const OBJECTID_t lOwnerID,
const OBJECTID_t SecurityProfileID,
const bool bRootClass,
const bool bAbstractClass,
const bool bDescriptionRequired,
MetaObjectIDVector &superClasses);

Teradata Meta Data Services Programmer Guide

261

Chapter 12: AIM Classes


CMetaAIM Class

Argument

In/Our

Description

pClassObj

in/out

Pointer to Class Desc object. If pClassObj is a pointer to


NULL, the object will be created by the API. The calling
application is responsible for freeing the object.

strClassName

in

name of the class

strClassDesc

in

description of class

sUniqueNamesFlag

in

MD_UNIQUE = maintain unique names, MD_NULL = do


not maintain unique names, default is MD_NULL

gClassID

in

Global unique identifier to assign to this class

lOwnerID

in

OwnerID of this object

SecurityProfileID

in

Security Profile assigned to the object.

bRootClass

in

True = set this class to be a root class of the model. The MDS
browsers begin tree displays of the data in the model at the
root classes.

bAbstractClass

in

If true, creates the class as an abstract class. An abstract class


does not have instances. It is created to enable inheritance of
properties and relationships.

bDescriptionRequired

in

Indicates if an object in the class must have a non-null


Description property. Classes in protected metamodels (DIM,
CLM, and CWM) may not set this value to True.

superClasses

in

The list of superclasses that the new class will inherit


properties and relationships from. The superClasses list can
contain zero or one class ids.

CreateMDSDerivedClass
Purpose
The CMetaAIM CreateMDSDerivedClass function creates a derived class in the current
model.
Description
A derived class is similar to a View in an RDBMS. It allows for creation of a logical class using
properties that exist in already defined classes. A derived class is a class that contains the
properties of a base class plus properties of related classes. A read of a derived class object will
return all properties (base and derived) and searches can be performed on all of the properties
of the derived class.
The default OwnerID is the logged in user. The class's versioning support will be set from the
derived classs base classs versioning support.
Requirements
Names must be unique for classes and derived classes within an AIM.

262

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaAIM Class

Syntax
HRESULT CreateMDSDerivedClass(
CMetaClassDesc *&pClassObj,
LPCTSTR strClassName,
LPCTSTR strClassDesc,
const GUID& gClassID,
const OBJECTID_t BaseClassID,
const OBJECTID_t lOwnerID = NULLLOID,
const OBJECTID_t SecurityProfileID = NULLLOID);

Argument

In/Out

Description

pClassObj

In/Out

Pointer to Class Desc object. If pClassObj is a pointer


to NULL, the object is created by the API. The calling
application is responsible for freeing the object.

Name

In

Name of the class.

Desc

In

Description of class.

gClassID

In

Global unique identifier to assign to this class.

BaseClassID

In

The class ID of the class that is the base class for this
derived class.

OwnerID

In

OwnerID of this object. The default OwnerID is the


logged in user.

OwnerID

In

OwnerID of this object.

SecurityProfileID

In

Security Profile assigned to the object.

CreateMDSRelationshipDesc
Purpose
The CMetaAIM CreateMDSRelationshipDesc function creates a new relationship description
between two classes.
Description
Relationships can be between two classes either within one AIM, or across different AIMs.
The origin class and the destination class can be the same class.
The default OwnerID is the logged in user.
Note: A class description can be defined in multiple relationships, however, all relationships
that have the same class ID as the origin or destination class must have unique names. Since all
relationships within a metamodel must have unique names, this is only an issue if
relationships with the same name were created in two different metamodels with the same
class as an origin or destination class. The create of the second relationship will fail.
Requirements
Updates to an existing Relationship Description object are not permitted. Both
lOriginClassOID and lDestClassOID are not a NULLLOID.

Teradata Meta Data Services Programmer Guide

263

Chapter 12: AIM Classes


CMetaAIM Class

Both classes must have been previously defined to MDS before creating the relationship.
Syntax
HRESULT CreateMDSRelationshipDesc(
CMetaRelationshipDesc *&pRelObj,
LPCTSTR strRelName,
LPCTSTR strRelDesc,
const OBJECTID_t lOriginClassOID,
const OBJECTID_t lDestClassOID,
const short sUniqueNamesFlag,
const short sPropagateDeleteFlag,
const GUID& gGUID,
const OBJECTID_t lOwnerID = 0,
const OBJECTID_t SecurityProfileID = 0);

Argument

In/Out

Description

pRelObj

Out

If pRelObj is a pointer to NULL, the object is


created by the API. The calling application is
responsible for freeing the object.

Name

In

Name of the relationship.

Desc

In

Relationship description.

OriginClassOID

In

Internal Object ID Origin class description.

DestClassOID

In

Internal Object ID of Destination class


description.

UniqueNamesFlag

In

Enforce unique names in destination collections.

PropagateDeleteFlag

In

Set the Propagate Delete flag on in the relationship.


Specify MD_PROPDEL to specify delete
propagation, MD_NULL to not set the flag.

GUID

In

Global unique identifier to assign to this


relationship. Set to NULLGUID to have MDS
generate the GUID for the Relationship
Description.

OwnerID

In (Optional)

OwnerID of this object.

SecurityProfileID

In (Optional)

Security Profile assigned to the object.

GetClassDesc
Purpose
The CMetaAIM GetClassDesc function returns the class description object specified by name.
Description
If an application has the ObjectGUID or ObjectID of this object, it can instantiate the
CMetaClassDesc using these identification parameters, and use the ReadObject function to
read this object.

264

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaAIM Class

The application is responsible to free the returned object.


Requirements
The class must be in the current model.
Syntax
HRESULT GetClassDesc (
LPCTSTR Name,
CMetaClassDesc *&pClassPtr);

Argument

In/Out

Description

Name

In

Name of the class.

pClassPtr

Out

Pointer to the class object.

GetClassDescCollection
Purpose
The CMetaAIM GetClassDescCollection function returns all of the class description objects in
the model.
Syntax
HRESULT GetClassDescCollection (
LLCMetaClassDesc& classobjectList);

Argument

In/Out

Description

classobjectList

Out

List of class description objects.

GetRelationshipDesc
Purpose
The CMetaAIM GetRelationshipDesc function returns the relationship object specified by
Name.
Description
The application is responsible to free the relationship description object returned.
Requirements
The relationship must be in the current model.
Syntax
HRESULT GetRelationshipDesc (
LPCTSTR Name,
CMetaRelationshipDesc *&pRelationship);

Teradata Meta Data Services Programmer Guide

265

Chapter 12: AIM Classes


CMetaAIM Class

Argument

In/Out

Description

Name

In

Name of the relationship.

pRelationship

Out

Pointer to relationship object.

GetRelationshipDescColl
Purpose
The CMetaAIM GetRelationshipDescColl function returns all the relationship objects in the
model.
Syntax
HRESULT GetRelationshipDescColl (
LLCMetaRelationshipDesc &relobjectList);

Argument

In/Out

Description

relobjectList

Out

List of relationship description objects in the model.

GetVersioningSupport
Purpose
GetVersioningSupport returns the current setting for the VersioningSupport property of a
CMetaAIM object.
Description
The VersioningSupport property has three possible values:

META_NO_VERSIONING - the AIM does not support data versioning, none of the
existing classes created by the AIM support versioning, and any new classes for the AIM
will not support versioning.

META_HAD_DATA_VERSIONING - the AIM does not support data versioning and any
new classes for the AIM will not support versioning. However, some of the classes in the
AIM currently retain multiple versions of data objects that existed when data versioning
was disabled for the AIM. Even though multiple versions may exist for a data object,
WriteObject will never create new versions for existing data objects; only the latest version
for an object will be modified

META_HAS_DATA_VERSIONING - the AIM supports data versioning and any new class
for the model will, by default, support versioning; existing classes may or may not support
versioning.

For an existing AIM, this value is only meaningful after calling ReadObject for the AIM.
Syntax
META_VERSIONING_SUPPORT_LEVELS GetVersioningSupport();

266

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaAIM Class

SetModelVersioningFlag
Purpose
SetModelVersioningFlag allows an application to dynamically enable or disable data
versioning for a metamodel.
Description
If bVersioningAllowed is false, versioning will be disabled for the metamodel.
If bVersioningAllowed is true and the repository allows versioning, then versioning will be
enabled for the metamodel, else versioning will be left disabled for the metamodel.
bDeleteVersions indicates if existing historical versions for objects in the AIM's classes should
be deleted or retained.
The metamodel is specified with the same values as needed for ReadObject.
When versioning is enabled:

All existing classes in the metamodel are modified to support versioning.

Any new classes added to the metamodel will also support versioning.

No changes are made to the existing objects in any of the model's classes, however
whenever any object in the classes is modified, a new version of the object will be
automatically created, as if the class had always supported data versioning

When versioning is disabled:

All existing classes in the metamodel are modified to not support versioning.

Any new classes added to the metamodel will be created without support of versioning

If bDeleteVersions is true, all objects in the metamodel's classes will be modified so that all
non-published versions are deleted and the remaining versions will be renumbered to
version one. This can be a very lengthy operation.

If bDeleteVersions is false, all existing versions of data objects in the metamodel's classes
will be retained.

Requirements
The caller must have write permission for the metamodel and for all classes in the metamodel.
The object name or the object ID (internal or globally unique) must be set
Syntax
HRESULT SetModelVersioningFlag(
const bool bVersioningAllowed,
const bool bDeleteVersions = false);

Argument

In/Out

Description

bVersioningAllowed

in

Value of versioning support for the metamodel.

Teradata Meta Data Services Programmer Guide

267

Chapter 12: AIM Classes


CMetaClassDesc Class

Argument

In/Out

Description

bDeleteVersions

in

Indicates if existing data objects in the metamodel's classes should


have their non-published versions deleted. True = delete all nonpublished versions; false = retain all non-published versions.

WriteObject/WriteVersion
Purpose
The CMetaAIM WriteObject and WriteVersion functions update the CMetaAIM object.
Description
The properties of a CMetaAIM object that can be modified are:

Name

Description

OwnerID

SecurityProfileID

Updates to other fields will be ignored.


Note: It is recommended that you do not change the name of the ClientLoadModel.
Requirements
The ObjectID must be set.
The engine does not permit updates to the following predefined CMetaAIM objects:
ObjectID

Name

10

MDSMetaModel

11

Core

1000

DatabaseModel

Syntax
HRESULT WriteObject ();
HRESULT WriteVersion();

CMetaClassDesc Class
CMetaClassDesc Class Functions
The CMetaClassDesc class functions are:

268

CMetaClassDesc Constructors

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class

Initialize

CreateMDSPropertyDesc

CreateMDSDerivedProperty

GetUniqueNamesFlag

SetUniqueNamesFlag

GetPropertyDesc

GetPropertyDescColl

GetRelationshipDescColl

GetAbstractClassFlag

SetAbstractClassFlag

GetSuperClasses

SetSuperClasses

GetSubClasses

GetDerivedClassFlag

SetDerivedClassFlag

GetBaseClassID

SetBaseClassID

GetVersioningSupport

SetClassDescVersioningFlag

WriteObject/WriteVersion

These functions are described more fully in the following paragraphs.

CMetaClassDesc Constructors
To create a new CMetaClassDesc object, use the CMetaAIM class.
To read an existing ClassDesc, use the CMetaAIM object only if the objects name is known.
If the objects name is not known and ObjectGUID or ObjectID is known, use the
constructors listed below, followed with ReadObject invocation.
CMetaClassDesc();
This is the default CMetaClassDesc constructor.
CMetaClassDesc(const GUID &GID);
This CMetaClassDesc constructor instantiates a CMetaClassDesc identified by the
ObjectGUID.
CMetaClassDesc(const OBJECTID_t lOID);
This CMetaClassDesc constructor instantiates a CMetaClassDesc identified by the ObjectID.

Teradata Meta Data Services Programmer Guide

269

Chapter 12: AIM Classes


CMetaClassDesc Class

Initialize
Purpose
The CMetaClassDesc Initialize function resets the CMetaClassDesc attributes to default
values.
Syntax
void Initialize(void);

CreateMDSPropertyDesc
Purpose
The CMetaClassDesc CreateMDSPropertyDesc function creates a property description and
associates it with the specified class.
Description
This function allows setting of the Character Set in which the property data will be stored.
Updates to an existing Property Description object are not permitted.
The property Name is used as the column name of the class table in the repository database.
Because of this, the name of a property description has the same restrictions as a Teradata
column name. Refer to the Teradata SQL documentation for more information.
The property can be defined as "required" so that all objects added to the class must contain a
value for the property. If a property is required and a value is not specified for the property
when adding or updating an object in the class, the WriteObject will fail with the status
META_E_MISSING_REQUIRED_PROPERTY.
Property names and the RelativePropID must be unique for a class.
The default OwnerID is the logged in user.
Syntax
HRESULT CreateMDSPropertyDesc(
CMetaPropertyDesc *&pPropertyDescObj,
LPCTSTR strPropertyName,
LPCTSTR strPropertyDesc,
const short sTotalDigits,
const long sPropLength,
const short sPropType,
const long lRelativePropID,
const unsigned short sVariantType,
const GUID& GID = NULLGUID,
LPCTSTR strCharacterSetName = NULL,
const OBJECTID_t OwnerID = NULLLOID,
const OBJECTID_t SecurityProfileID = NULLLOID);
HRESULT CreateMDSPropertyDesc(
CMetaPropertyDesc *&pPropertyDescObj,
LPCTSTR strPropertyName,
LPCTSTR strPropertyDesc,
const bool bIsRequired,

270

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class
LPCTSTR strDefaultValue,
const short sTotalDigits,
const long sPropLength,
const short sPropType,
const long lRelativePropID,
const unsigned short sVariantType,
const GUID& GID = NULLGUID,
LPCTSTR strCharacterSetName = NULL,
const OBJECTID_t OwnerID = NULLLOID,
const OBJECTID_t SecurityProfileID = NULLLOID);

The following tables define data types supported and the associated variant types.
Argument

In/Out

Description

PropertyDescObj

Out

If PropertyDescObj is a pointer to NULL, the object will be created by the API.


The calling application is responsible for freeing the object.

strPropertyName

In

Name of the Property to create. MDS creates common properties in each class.
The names of these properties are reserved by MDS and cannot be used as the
name of a property. The reserved property names are:

loid
name
ApplicationGroupID
OwnerID
AccessRights
goid
description
CreateDate
CreateTime
UpdateDate
UpdateTime
SecurityProfileID
IsFrozen
BaseVersionLoid
PredecessorVersionLoid
VersionNumber
PublishState

strPropertyDesc

In

Property description

bIsRequired

In

Set to true if class objects must contain a value for the property; set to false if class
objects need not set the property

strDefaultValue

In

The value to be assigned for this property to existing objects in the class; may be
set NULL if the class contains no objects or bIsRequired is false

TotalDigits

In

The number of digits to the right of the decimal point for a numeric property. The
precision of TIME and TIMESTAMP properties.

Teradata Meta Data Services Programmer Guide

271

Chapter 12: AIM Classes


CMetaClassDesc Class

Argument

In/Out

Description

PropSize

In

The size in bytes of the property if defined as characters. The number of digits if
the property is defined as a numeric type. This value is ignored if the data type of
the property inherently specifies the size of the property (such as integer).

PropType

In

The SQL data type of the property. This type defines how the data field is stored in
the database repository.
Note: Teradata does not have a long data type -- use SQL_INTEGER. See the
tables below to relate VariantTypes and with acceptable PropTypes.

RelativePropID

In

The Relative Property ID is a user-defined id number for this property. The ID


number must be unique for each property in a class and must be a positive
number 501 or larger. Property values from 1 to 500 are reserved for MDS-defined
property values. The Relative Property ID is used to identify the property in get
and set functions.

VariantType

In

Defines the data type that will be used by the application to set and get the data
field.
See the tables below to relate VariantTypes with acceptable PropTypes

GID

In

GUID of this Property Description

AccessRights

In

Obsolete Access Permissions assigned to this object

OwnerID

In

OwnerID of this object

AppGroupID

In

Obsolete Internal object ID of Application Group, if any, for security.

strCharacterSetName

In

Character set type in which this property field will be stored in Teradata. If not
specified, the column character type will be the default character type for the
database user (the database user configured for MDS to use to connect to the
MDS repository database). Two of the character set types supported are LATIN
and UNICODE. See Teradata documentation for information on additional
character sets that are supported.

SecurityProfileID

In

Security Profile assigned to the object.

Teradata Database column type created for


property

Parameters Specified on Create Property


PropType

PropSize

SQL_CHAR

>= 1

CHAR[(size)]

SQL_VARCHAR

>= 1

VARCHAR(size)

SQL_DATE

TotalDigits

DATE

SQL_BINARY

>= 1

BYTE[(size)]

SQL_VARBINARY

>= 1

VARBYTE(size)

SQL_SMALLINT

SMALLINT

SQL_INTEGER

INTEGER

272

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class

Teradata Database column type created for


property

Parameters Specified on Create Property


PropType

PropSize

TotalDigits

SQL_DECIMAL

1-18

0-scale

DECIMAL[(size[,scale])]

SQL_NUMERIC

1-18

0-scale

NUMERIC[(size[,scale])]

SQL_FLOAT

0-54

FLOAT[(size)]

SQL_REAL

REAL

SQL_DOUBLE

DOUBLE [PRECISION]

SQL_TINYINT

BYTEINT

SQL_TIME

0-6

TIME

SQL_TIMESTAMP

0-6

TIMESTAMP

CMetaProperty Get/Set
Functions

VariantType

Compatible PropType

VT_I1

SQL_TINYINT

GetChar(),
SetChar()

VT_I2

SQL_SMALLINT

GetShort()
SetShort()

VT_I4

SQL_INTEGER

GetInt()
SetInt()

VT_R8

SQL_DECIMAL (Teradata stores a decimal as 1-8


bytes.) (SQL_DECIMAL and SQL_NUMERIC are
fixed point and correspond to a single Teradata native
type.)
SQL_NUMERIC
SQL_FLOAT (Teradata stores a float as 8 bytes.)
(SQL_FLOAT, SQL_REAL and SQL_DOUBLE are
floating point and correspond to a single Teradata
native type.)
SQL_REAL
SQL_DOUBLE

GetDouble()
GetDbl()
SetDouble()
SetDbl()

VT_DATE

SQL_DOUBLE

GetDate()
SetDate ()

VT_BSTR

SQL_CHAR
SQL_VARCHAR
SQL_DATE

GetString(
SetString()

VT_BOOL

SQL_SMALLINT

GetBool()
SetBool()

Teradata Meta Data Services Programmer Guide

273

Chapter 12: AIM Classes


CMetaClassDesc Class

CMetaProperty Get/Set
Functions

VariantType

Compatible PropType

VT_UI1

SQL_BINARY (size=1)

GetUChar ()
SetUChar ()

VT_ARRAY | VT_UI1

SQL_BINARY
SQL_VARBINARY

GetBinaryAsString()
GetBinary()
SetBinary()

CreateMDSDerivedProperty
Purpose
The CMetaClassDesc class CreateMDSDerivedProperty function creates a derived property
description and associates it with the specified derived class.
Description
A derived property creates a join between the base class specified for the derived class and a
property in a related class. A read of a derived class object will return all properties (base and
derived) and searches can be performed on all of the properties of the derived class.
Class: Author
Properties:
name
description
author
AuthorHasBooks
Class: Book
Properties:
name
description
title
3047A056

In the above metamodel, a derived class can be created with the base class of Book. The
derived class (AuthBook) will have all properties of Book (name, description, title). Because
the Author class is an origin class related to the Book class with the AuthorHasBooks
relationship, derived properties can be created for each of the properties of the Author class
(name, description, author). If we create one derived property with the property author in the
Author class, the derived class will have the following properties:
Derived Class: AuthBook
Properties:
name
description
title
author
3047A057

274

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class

There are no actual objects in a derived class. A derived class joins together properties in the
base class and the properties in related classes.
Derived properties can be created from relationships from 1 to 6 levels. In the first level
relationship, the destination class of the relationship must be the base class of the derived
property. In the next level relationship, the destination class must be the origin class of the
previous level relationship. This continues until the last relationship. Note in the following
picture, the classes and relationships of the database model.
Database
DatabaseHasTables
Table
TableHasColumns
Column

3047A018

This is a valid hierarchy for derived properties. If a derived class was created with the base class
Column, derived properties could be created from properties in the Table, Database, and
DBSystem classes.
A derived class can contain derived properties from multiple related classes.

Class: Publisher
Properties:
name
description

PublisherHasAuthors
Class: Author
Properties:
name
description
author
AuthorHasBooks
Class: Book
Properties:
name
description
title
3047A058

In the above metamodel, a derived class (ExBook) is created with the base class of Book. It has
a derived property (author) using the author property of the Author class and a derived
property (PublisherName) using the name property of the Publisher class.

Teradata Meta Data Services Programmer Guide

275

Chapter 12: AIM Classes


CMetaClassDesc Class

Derived Class: ExBook


Properties:
name
description
title
author
PublisherName
3047A059

Note that the name of the derived property can be the name of the base property if the name is
a unique name for the properties in the base class and the derived class. In ExBook, the
derived property, author, is the same name as the property in its class. However, the derived
property, PublisherName, could not be given the name of the base property (name) as the
base class already has a name property.
If multiple derived properties are defined for a derived class, their relationships must all be on
the same hierarchical path. For example:
DBSystem
SystemHasDatabases
Database
DatabaseHasTables
Table
TableHasColumns
Column

3047A017

a derived class with a base class of Column could contain derived properties from the
DBSystem, Database, and Table classes. An example, which is not permitted, is:
View

Table

ViewHasTableColumns

TableHasColumns
Column
3047A016

a derived class with a base class of Column CANNOT contain derived properties from both
the View and Table classes.
Property names and RelativePropID must be unique in the derived class and the base class of
the derived class.

276

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class

The default OwnerID is the logged in user.


Syntax
HRESULT CreateMDSDerivedProperty(
CMetaPropertyDesc *&pPropertyDescObj,
LPCTSTR strPropertyName,
LPCTSTR strPropertyDesc,
LPCTSTR BasePropertyName,
MetaObjectIDVector &RelationshipsToProperty,
const long lRelativePropID,
const GUID& PropGUID = NULLGUID,
const OBJECTID_t lOwnerID = NULLLOID,
const OBJECTID_t SecurityProfileID = NULLLOID);

Argument

In/Out

Description

PropertyDescObj

Out

If PropertyDescObj is a pointer to NULL, the object will be


created by the API. The calling application is responsible for
freeing the object.

Name

In

The name of the derived property to create. The name must


be unique to all properties in the derived class and to the
base class. The name cannot be one of the reserved property
names, which are:

loid
name
ApplicationGroupID
OwnerID
AccessRights
goid
description
CreateDate
CreateTime
UpdateDate
UpdateTime
SecurityProfileID
IsFrozen
BaseVersionLoid
PredecessorVersionLoid
VersionNumber
PublishState

Desc

In

Property description

BasePropertyName

In

The name of the property in the related class.

RelationshipsToProperty

In

The list of relationships to follow to get to the related class.

Teradata Meta Data Services Programmer Guide

277

Chapter 12: AIM Classes


CMetaClassDesc Class

Argument

In/Out

Description

RelativePropID

In

The Relative Property ID is a user-defined id number for


this property. The ID number must be unique for each
property in a class and must be a positive number 501 or
larger. Property values from 1 to 500 are reserved for MDSdefined property values. The Relative Property ID is used to
identify the property in get and set functions.

GID

In

GUID of this Property Description.

OwnerID

In

OwnerID of this object.

SecurityProfileID

In

Security profile assigned to the object.

GetUniqueNamesFlag
Purpose
The CMetaClassDesc GetUniqueNamesFlag function retrieves the flag that indicates if unique
naming is turned on for the class description.
Syntax
const short GetUniqueNamesFlag(void);

SetUniqueNamesFlag
Purpose
SetUniqueNamesFlag sets the unique naming flag for the class.
Syntax
void SetUniqueNamesFlag (const short FlagArg)

Argument

In/Out

Description

FlagArg

In

If FlagArg = MD_NULL (0), duplicate names will be allowed in


the class.
If FlagArg = MD_UNIQUE (1), duplicate names will not be
allowed.

GetPropertyDesc
Purpose
The CMetaClassDesc GetPropertyDesc function returns the property description object
specified by name. The application is responsible to free returned PropertyDesc object.
Syntax
HRESULT GetPropertyDesc(
LPCTSTR strPropertyName,

278

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class
CMetaPropertyDesc *&pProperty);

Argument

In/Out

Description

Name

In

Name of the Property.

pProperty

Out

Pointer to Property object.

GetPropertyDescColl
Purpose
The CMetaClassDesc GetPropertyDescColl function returns all property description objects
for the class.
Syntax
HRESULT GetPropertyDescColl(
LLCMetaPropertyDesc &objectList);

Argument

In/Out

Description

objectList

Out

List of Property objects.

GetRelationshipDescColl
Purpose
The CMetaClassDesc GetRelationshipDescColl function returns the relationship description
collection associated with the class of the object.
Syntax
HRESULT GetRelationshipDescColl(
LLCMetaRelationshipDesc &relobjectList);

Argument

In/Out

Description

relobjectList

Out

List of relationship description objects for the class of the object.

GetAbstractClassFlag
Purpose
GetAbstractClassFlag retrieves the flag that indicates if the class is an abstract class.
Syntax
const short GetAbstractClassFlag()

Teradata Meta Data Services Programmer Guide

279

Chapter 12: AIM Classes


CMetaClassDesc Class

SetAbstractClassFlag
Purpose
SetAbstractClassFlag sets the flag indicating if this will be a abstract class.
Syntax
void SetAbstractClassFlag (const short FlagArg)

Argument

In/Out

Description

FlagArg

In

If FlagArg = 1, the class will be created as an abstract class.


If FlagArg = 0, the class will not be an abstract class.

GetDescriptionRequired
Purpose
GetDescriptionRequired returns the current value of the DescriptionRequired property for
the class. It is assumed that the application has called ReadObject or WriteObject for the
current object.
Syntax
const bool GetDescriptionRequired();

SetDescriptionRequired
Purpose
SetDescriptionRequired is used to change the current setting of the class property indicating if
a class object must have a non-null Description property. The change will not be effective
until WriteObject is called.
The class loid must be greater than 10000.
If bRequired is true the class may not be in the reserved metamodels: DIM, CLM, MDSBase
and CWM.
If bRequired is true and one or more existing objects in the class do not currently have a
description, the error META_E_MISSING_REQUIRED_DESCRIPTION will be returned by
WriteObject
Syntax
HRESULT SetDescriptionRequired(const bool bRequired);

Argument

In/Out

Description

bRequired

In

True = class objects must have non-null Description property


False = class objects do not require a Description property

280

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class

GetSuperClasses
Purpose
GetSuperClasses retrieves the list of superclasses defined for the class.
Syntax
void GetSuperClasses(MetaObjectIDVector &superClassesList);

Argument

In/Out

Description

superClassesList

Out

List of classIDs defined as the superclasses for this class.

SetSuperClasses
Purpose
SetSuperClasses sets the list of classes that this class will inherit from.
Syntax
HRESULT SetSuperClasses (MetaObjectIDVector &superClassesList)

Argument

In/Out

Description

superClassesList

In

Class IDs that this class will inherit from.

GetSubClasses
Purpose
GetSubClasses retrieves the list of subclasses that inherit from this class.
Syntax
HRESULT GetSubClasses(MetaObjectKeyVector &returnSubClassList);

Argument

In/Out

Description

returnSubClassList

Out

List of keys (classIDs and class names) of all subclasses that


inherit from this class.

GetDerivedClassFlag
Purpose
GetDerivedClassFlag retrieves the flag that indicates if the class is an derived class.
Syntax
const short GetDerivedClassFlag ()

Teradata Meta Data Services Programmer Guide

281

Chapter 12: AIM Classes


CMetaClassDesc Class

SetDerivedClassFlag
Purpose
SetDerivedClassFlag sets the flag indicating if this will be a derived class.
Syntax
void SetDerivedClassFlag (const short FlagArg)

Argument

In/Out

Description

FlagArg

In

If FlagArg = 1, the class will be created as a derived class.


If FlagArg = 0, the class will not be a derived class.

GetBaseClassID
Purpose
GetBaseClassID retrieves the base class ID of the derived class.
Syntax
const OBJECTID_t GetBaseClassID ()

SetBaseClassID
Purpose
SetBaseClassID sets the base class id for the derived class.
Syntax
void SetBaseClassID (const OBJECTID_t ClassIDArg)

Argument

In/Out

Description

ClassIDArg

In

Class ID of the class that this class is to be derived from.

GetVersioningSupport
Purpose
GetVersioningSupport returns the current value for the class object's VersioningSupport
property.
Description
The VersioningSupport property has three possible values:

282

META_NO_VERSIONING - the class does not support data versioning.

META_HAD_DATA_VERSIONING - he class does not support data versioning and any


new objects for the class will not support versioning. However, some of the objects in the
class currently retain multiple versions that existed when data versioning was disabled for

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaClassDesc Class

the class. Even though multiple versions may exist for a data object, WriteObject will never
create new versions for existing data objects; only the latest version for an object will be
modified.

META_HAS_DATA_VERSIONING - the class supports data versioning.

For an existing class, the value is only meaningful after a ReadObject of the class.
Syntax
META_VERSIONING_SUPPORT_LEVELS GetVersioningSupport();

SetClassDescVersioningFlag
Purpose
SetClassDescVersioningFlag allows an application to dynamically enable or disable data
versioning for a class.
Description
If bVersioningAllowed is false, data versioning will be disabled for the class. If
bVersioningAllowed is true and repository versioning is enabled, then data versioning will be
enabled for the class, else versioning will be left disabled for the class. bDeleteVersions
indicates if existing historical versions for objects in the class should be deleted or retained.
The class is specified with the same values as needed for ReadObject.
Disabling versioning can affect the existing objects in the class. If bDeleteVersions is true, all
objects in the class will be modified so that all non-published versions are deleted and the
remaining versions will be renumbered to version one. This can be a very lengthy operation. If
bDeleteVersions is false, all existing versions of data objects in the class will be retained. Any
new objects added to the class will be created without support of versioning.
Changing the data versioning support for a class will also change the versioning support for
any derived classes that have the class as their base class. A derived class's data versioning
support is always the same as that of the base class.
Requirements
The object name or the object ID (internal or globally unique) must be set
Derived classes may not be used with this API.
The caller must have write permission for the class.
Syntax
HRESULT SetClassDescVersioningFlag(
const bool bVersioningAllowed,
const bool bDeleteVersions = false);

Argument

In/Out

Description

bVersioningAllowed

in

Value of versioning support for the class

Teradata Meta Data Services Programmer Guide

283

Chapter 12: AIM Classes


CMetaClassDesc Class

Argument

In/Out

Description

bDeleteVersions

in

Indicates if existing data objects in the class should have their nonpublished versions deleted. True = delete all non-published
versions; false = retain all non-published versions

WriteObject/WriteVersion
Purpose
The CMetaClassDesc WriteObject and WriteVersion functions update the CMetaClassDesc
object.
Description
The properties of a CMetaClassDesc object that can be modified are:

Name

Description

DescriptionRequired

OwnerID

SecurityProfileID

SuperClasses

Updates to other fields will be ignored.


It is recommended that you do not change the names of the ClientLoadModel classes.
Restriction
When updating an existing class, you can not remove from it or add to it a SuperClass that has
properties. When initially creating a class with superclasses, the superclasses can contain
properties. However, once the initial WriteObject() for a class definition has completed
successfully, any superclasses added or removed from the class can not have properties.
Requirements
The ObjectID must be set.
The engine does not permit updates to the following predefined CMetaAIM objects:
ObjectID

Name

100-1063

MDSMetaModel classes

Syntax
HRESULT WriteObject ();
HRESULT WriteVersion ();

284

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaPropertyDesc Class

CMetaPropertyDesc Class
CMetaPropertyDesc Class Functions
The CMetaPropertyDesc class functions are:

CMetaPropertyDesc Constructors

Initialize

GetCharacterSetName

SetCharacterSetName

GetPropertyLength

GetPropType

SetPropType

GetRelPropID

SetRelPropID

GetTotalDigits

SetTotalDigits

GetVarType

SetVarType

GetDerivedPropertyFlag

SetDerivedPropertyFlag

GetBasePropertyName

SetBasePropertyName

GetRelationshipsToProperty

SetRelationshipsToProperty

Initialize

WriteObject/WriteVersion

ReadObject/ReadVersion

These functions are described more fully in the following paragraphs.

CMetaPropertyDesc Constructors
To create a PropertyDesc object initially, use the CMetaClassDesc object for the owning class.
To read an existing CMetaPropertyDesc, if the ObjectID or ObjectGUID is known, instantiate
the object using the appropriate constructor, then use the ReadObject function.
CMetaPropertyDesc();
This is the default CMetaPropertyDesc constructor.

Teradata Meta Data Services Programmer Guide

285

Chapter 12: AIM Classes


CMetaPropertyDesc Class

CMetaPropertyDesc(const GUID &GID);


This CMetaPropertyDesc constructor instantiates a CMetaPropertyDesc identified by the
ObjectGUID.
CMetaPropertyDesc (const OBJECTID_t lOID);
This CMetaPropertyDesc constructor instantiates a CMetaPropertyDesc identified by the
ObjectID.

Initialize
Purpose
The CMetaPropertyDesc Initialize function resets the CMetaPropertyDesc attributes to
default values.
Syntax
void Initialize(void);

GetCharacterSetName
Purpose
The CMetaPropertyDesc GetCharacterSetName function returns the character set name for
the property if specified.
Syntax
LPCTSTR GetCharacterSetName();

SetCharacterSetName
Purpose
The CMetaPropertyDesc GetCharacterSetName function sets the character set name for the
property.
Syntax
void SetCharacterSetName (LPCTSTR charSetArg)

Argument

In/Out

Description

charSetArg

In

Defines the character set for the property.

GetPropertyLength
Purpose
The CMetaPropertyDesc GetPropertyLength function retrieves the size in bytes of the
property if the property is defined as characters, or the number of digits if the property is
defined as a numeric type.

286

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaPropertyDesc Class

Syntax
const long GetPropertyLength(void)

SetPropertyLength
Purpose
The CMetaPropertyDesc SetPropertyLength function sets the size in bytes of the property if
the property is defined as characters, or the number of digits if the property is defined as a
numeric type.
Syntax
void SetPropertyLength (const long propLengthArg)

Argument

In/Out

Description

propLengthArg

In

The size in bytes of the property if defined as characters. The


number of digits if the property is defined as a numeric type.

GetPropType
Purpose
The CMetaPropertyDesc GetPropType function retrieves the property type of the property.
Syntax
const short GetPropType(void);

SetPropType
Purpose
The CMetaPropertyDesc SetPropType function sets the property type of the property.
Syntax
void SetPropType (const short propTypeArg)

Argument

In/Out

Description

proTypeArg

In

The SQL data type of the property.

GetRelPropID
Purpose
The CMetaPropertyDesc GetRelPropID function retrieves user-defined ID number for this
property.

Teradata Meta Data Services Programmer Guide

287

Chapter 12: AIM Classes


CMetaPropertyDesc Class

Syntax
const long GetRelPropID(void);

SetRelPropID
Purpose
The CMetaPropertyDesc SetRelPropID function sets the user-defined ID number for this
property.
Syntax
void SetRelPropID (const short propIDArg)

Argument

In/Out

Description

propIDArg

In

The ID number must be unique for each property in a class and


must be a positive number 501 or larger. Property values from 1
to 500 are reserved for MDS-defined property values. The
Relative Property ID is used to identify the property in get and
set functions.

GetTotalDigits
Purpose
The CMetaPropertyDesc GetTotalDigits function retrieves the number of digits to the right of
the decimal point for a numeric property.
Syntax
const long GetTotalDigits(void)

SetTotalDigits
Purpose
The CMetaPropertyDesc SetTotalDigits function sets the number of digits to the right of the
decimal point for a numeric property.
Syntax
void SetTotalDigits (const short totalDigitsArg)

288

Argument

In/Out

Description

totalDigitsArg

In

The number of digits to the right of the decimal point for a


numeric property. The precision for TIME and TIMESTAMP
properties.

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaPropertyDesc Class

GetVarType
Purpose
The CMetaPropertyDesc GetVarType function retrieves the variant type of the property.
Syntax
const unsigned short GetVarType(void);

SetVarType
Purpose
The CMetaPropertyDesc SetVarType function sets the variant type of the property.
Syntax
void SetVarType (const unsigned short varTypeArg)

Argument

In/Out

Description

varTypeArg

In

Defines the data type that will be used by the application to set
and get the data field. If COM and the CMetaCOM APIs are to
be used to reference this class, then this Variant Type must match
the OLE Automation type of the property.

GetDerivedPropertyFlag
Purpose
GetDerivedPropertyFlag retrieves the flag that indicates if this is a derived property.
Syntax
const short GetDerivedPropertyFlag ()

SetDerivedPropertyFlag
Purpose
SetDerivedPropertyFlag sets the flag that indicates if this is a derived property.
Syntax
void SetDerivedPropertyFlag (const short flagArg)

Argument

In/Out

Description

flagArg

In

flagArg = 1 to create this property as a derived property


flagArg = 0 to not create this property as a derived property

Teradata Meta Data Services Programmer Guide

289

Chapter 12: AIM Classes


CMetaPropertyDesc Class

GetBasePropertyName
Purpose
GetBasePropertyName retrieves the name of the property in the origin class that is retrieved
for the derived property.
Syntax
LPCTSTR GetBasePropertyName ()

SetBasePropertyName
Purpose
SetBasePropertyName sets the name of the property in the origin class that is retrieved for the
derived property.
Syntax
void SetBasePropertyName (LPCTSTR basePropArg)

Argument

In/Out

Description

basePropArg

In

Name of the property to be added as a derived property.

GetRelationshipsToProperty
Purpose
GetRelationshipsToProperty retrieves the relationships used to traverse to the origin property.
Syntax
void GetRelationshipsToProperty (MetaObjectIDVector &relList)

Argument

In/Out

Description

relListArg

Out

List of relationships to traverse to get to the base property.

SetRelationshipsToProperty
Purpose
SetRelationshipsToProperty sets the relationships used to traverse to the origin property.
Syntax
HRESULT SetRelationshipsToProperty (MetaObjectIDVector &relList)

290

Argument

In/Out

Description

relListArg

In

List of relationships to traverse to get to the base property.

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaPropertyDesc Class

GetIsRequired
Purpose
GetIsRequired indicates if the property is required to have a value.
Syntax
const bool GetIsRequired();

WriteObject/WriteVersion
Purpose
The CMetaPropertyDesc WriteObject and WriteVersion functions update the
CMetaPropertyDesc object.
Description
The properties of a CMetaPropertyDesc object that can be modified are:

Description

OwnerID

SecurityProfileID

Updates to other fields will be ignored.


Requirements
The ObjectID must be set.
Versioning of property objects is not supported.
Name changes are not permitted as the name is used as a column name in the repository table.
The engine does not permit updates to the following predefined CMetaPropertyDesc objects:
ObjectID

Name

301-399

MDSMetaModel properties

Syntax
HRESULT WriteObject ();
HRESULT WriteVersion();

ReadObject/ReadVersion
Purpose
ReadObject and ReadVersion functions read the specified property object.
Requirements
Versioning of property objects is not supported.

Teradata Meta Data Services Programmer Guide

291

Chapter 12: AIM Classes


CMetaRelationshipDesc Class

The ObjectID must be set.


Syntax
HRESULT ReadObject ();
HRESULT ReadVersion ();

CMetaRelationshipDesc Class
CMetaRelationshipDesc Class Functions
The CMetaRelationshipDesc class functions are:

CMetaRelationshipDesc Constructors

Initialize

SetPropagateDeleteFlag

SetUniqueNamesFlag

SetDestClassID

SetOrigClassID

GetDestClassID

GetOriginClassID

GetPropagateDeleteFlag

GetUniqueNamesFlag

WriteObject/WriteVersion

ReadObject/ReadVersion

These functions are described more fully in the following paragraphs.

CMetaRelationshipDesc Constructors
To create a new CMetaRelationshipDesc object, use the CMetaAIMDesc object for the owning
AIM.
To read an existing CMetaRelationshipDesc, use the parent CMetaAIM object if only the
name is known.
If the ObjectGUID or ObjectID is known, use the constructors listed below, followed by the
ReadObject function invocation.
CMetaRelationshipDesc(const GUID GID);
This CMetaRelationshipDesc constructor instantiates a CMetaRelationshipDesc identified by
the ObjectGUID.
CMetaRelationshipDesc(const OBJECTID_t lOID);
This CMetaRelationshipDesc constructor instantiates a CMetaRelationshipDesc identified by
the internal ObjectID.

292

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaRelationshipDesc Class

CMetaRelationshipDesc();
This is the default CMetaRelationshipDesc constructor.

Initialize
Purpose
The Initialize function resets the CMetaRelationshipDesc attributes to default values.
Syntax
void Initialize(void);

SetPropagateDeleteFlag
Purpose
SetPropagateDeleteFlag sets the flag that indicates if delete propagation is set on the
relationship description.
Syntax
void SetPropagateDeleteFlag (const short flagArg)

Argument

In/Out

Description

flagArg

In

FlagArg = MD_PROPDEL (1) objects in the destination class


will be deleted when the origin object is deleted.
FlagArg = MD_NULL (0) destination objects will not be deleted

SetUniqueNamesFlag
Purpose
SetUniqueNamesFlag sets the flag that indicates if unique naming is set on the relationship
description
Syntax
void SetUniqueNamesFlag (const short flagArg)

Argument

In/Out

Description

flagArg

In

FlagArg = MD_UNIQUE (1) objects in the destination


collection must have unique names
FlagArg = MD_NULL (0) objects with duplicate names are
permitted in the destination collection.

Teradata Meta Data Services Programmer Guide

293

Chapter 12: AIM Classes


CMetaRelationshipDesc Class

SetDestClassID
Purpose
SetDestClassID sets the destination class id of the relationship description
Syntax
void SetDestClassID (const OBJECTID_t classArg)

Argument

In/Out

Description

classArg

In

ID of the destination class.

SetOrigClassID
Purpose
SetOrigClassID sets the origin class id of the relationship description.
Syntax
void SetOrigClassID (const OBJECTID_t classArg)

Argument

In/Out

Description

classArg

In

ID of the destination class.

GetDestClassID
Purpose
The GetDestClassID function retrieves the destination class ID of the relationship description.
Syntax
const OBJECTID_t GetDestClassID(void);

GetOriginClassID
Purpose
The GetOriginClassID function retrieves the origin class ID of the relationship description.
Syntax
const OBJECTID_t GetOriginClassID(void);

GetPropagateDeleteFlag
Purpose
The GetPropagateDeleteFlag function retrieves the flag that indicates if delete propagation is
set on the relationship description.

294

Teradata Meta Data Services Programmer Guide

Chapter 12: AIM Classes


CMetaRelationshipDesc Class

Syntax
const short GetPropagateDeleteFlag(void);

GetUniqueNamesFlag
Purpose
The GetUniqueNamesFlag function retrieves the flag that indicates if unique naming is set on
the relationship description.
Syntax
const short GetUniqueNamesFlag(void);

WriteObject/WriteVersion
Purpose
The WriteObject and WriteVersion functions update the CMetaRelationshipDesc object.
Description
The properties of a CMetaRelationshipDesc object that can be modified are:

Name

Description

OwnerID

SecurityProfileID

UniqueNamesFlag

Updates to other fields will be ignored.


Requirements
The ObjectID must be set.
Versioning of relationship objects is not supported, thus there exists only one version of a
relationship object.
Exceptions: The engine does not permit updates to the following predefined
CMetaRelationshipDesc objects
ObjectID

Name

200-208

MDSMetaModel relationships

Syntax
HRESULT WriteObject ();
HRESULT WriteVersion();

Teradata Meta Data Services Programmer Guide

295

Chapter 12: AIM Classes


CMetaRelationshipDesc Class

ReadObject/ReadVersion
Purpose
ReadObject and ReadVersion read the specified relationship object.
Requirements
Versioning of relationship objects is not supported, thus there exists only one version of a
relationship object.
The object ID (internal or globally unique) must be set.
Syntax
HRESULT ReadObject ();
HRESULT ReadVersion ();

296

Teradata Meta Data Services Programmer Guide

CHAPTER 13

Security Classes

This topic describes the MDS security classes:

CMetaApplicationGroup Class

CMetaUser Class

CMetaSecurityProfileEntry Class

CMetaSecurityProfile Class

The CMetaApplicationGroup class and CMetaUser class define users who have access to meta
data objects.
A user must be defined to enable logon to MDS. The logged on user has access to objects based
on the access permissions defined for each object.
An Applications Group defines a set of users. For objects assigned to an Application Group, all
users in the Application Group have the same access to the objects based on the Application
Group access permissions assigned to objects.
The CMetaSecurityProfile and CMetaSecurityProfileEntry classes are used to create, delete,
and update permissions in security profiles.
Only a super user can use these APIs.

CMetaApplicationGroup Class
CMetaApplicationGroup Class Functions
The following is a list of the functions in the CMetaApplicationGroup Class:

CMetaApplicationGroup Constructors

AddUserToApplicationGroup

CreateApplicationGroup

GetUserCollection

RemoveUserFromApplicationGroup

Initialize

These functions are described more fully in the following paragraphs.

Teradata Meta Data Services Programmer Guide

297

Chapter 13: Security Classes


CMetaApplicationGroup Class

CMetaApplicationGroup Constructors
To create a CMetaApplicationGroup object initially, use the default constructor. Follow the
constructor with a call to the CreateApplicationGroup function.
Note: Names of application groups must be unique within the repository database.
To read an existing group object from the repository database, instantiate the object using the
appropriate constructor, then use the ReadObject function.
CMetaApplicationGroup();
This is the default constructor.
CMetaApplicationGroup(const OBJECTID_t lOID);
This constructor instantiates a CMetaApplicationGroup identified by the ObjectID. Follow
the constructor with a call to the ReadObject function.
CMetaApplicationGroup(LPCTSTR name);
This constructor instantiates a CMetaApplicationGroup identified by a name. Follow the
constructor with a call to the ReadObject function.

AddUserToApplicationGroup
Purpose
The AddUserToApplicationGroup function adds user strName to the collection of users
belonging to this Application Group.
Syntax
HRESULT AddUserToApplicationGroup(
LPCTSTR strName);

Argument

In/Out

Description

strName

In

Name of the user being added to the collection of users.

CreateApplicationGroup
Purpose
The CreateApplicationGroup function creates an application group object in the repository
database.
Requirements
The name of an application group must be unique.
Syntax
HRESULT CreateApplicationGroup(LPCTSTR Name,
LPCTSTR Description=NULL);

298

Teradata Meta Data Services Programmer Guide

Chapter 13: Security Classes


CMetaApplicationGroup Class

Argument

In/Out

Description

Name

In

Name of the Application Group.

Description

In (Optional)

Description for the Application Group.

GetUserCollection
Purpose
The GetUserCollection function retrieves the collection of users belonging to this
ApplicationGroup.
Syntax
HRESULT GetUserCollection(
vector<CMetaUser> &UserList);

Initialize
Purpose
The Initialize function resets the CMetaApplicationGroup attributes to default values.
Syntax
void Initialize(void);

RemoveUserFromApplicationGroup
Purpose
The RemoveUserFromApplicationGroup function removes user strName from the collection
of users belonging to this Application Group.
Syntax
HRESULT RemoveUserFromApplicationGroup(
LPCTSTR strName);

Argument

In/Out

Description

strName

In

Name of the user being removed from the collection of users.

ReadObject / ReadVersion
The CMetaApplicationGroup class does not support versioning, thus there exists only one
version for such an object, and ReadVersion functions equivalently to ReadObject.

Teradata Meta Data Services Programmer Guide

299

Chapter 13: Security Classes


CMetaUser Class

WriteObject / WriteVersion
CMetaApplicationGroup does not support versioning, thus there exists only one version for
such an object, and WriteVersion functions equivalently to WriteObject.

CMetaUser Class
CMetaUser Class Functions
The following is a list of the functions in the CMetaUser class:

CMetaUser Constructors

Initialize

CreateUser

CreateSuperuser

SetPassword

ChangePassword

IsSuperUser

ReadObject / ReadVersion

WriteObject / WriteVersion

CMetaUser Constructors
CMetaUser ();
This is the default CMetaUser constructor.
CMetaUser (const OBJECTID_t lOID);
This CMetaUser constructor instantiates a CMetaUser identified by the ObjectID.
CMetaUser (LPCTSTR UserName);
This CMetaUser constructor instantiates a CMetaUser identified by name.

Initialize
Purpose
The Initialize function resets the CMetaUser attributes to default values.
Syntax
void Initialize(void);

300

Teradata Meta Data Services Programmer Guide

Chapter 13: Security Classes


CMetaUser Class

CreateUser
Purpose
The CreateUser function creates a user to enable the application to logon to Meta Data
Services.
Requirement
The Name of the user must be unique.
Syntax
HRESULT CreateUser(LPCTSTR Name,
LPCTSTR Password,
LPCTSTR Desc=NULL);

Argument

In/Out

Description

Name

In

Name of the user.

Password

In

Password assigned to the user.


5-14 characters.

Desc

In (Optional)

Description of the user.

CreateSuperuser
Purpose
Creates a super user to enable login to Meta Data Services.
Note: A super user has all of the privileges currently allowed to the built-in meta super user
'metasu'.
Requirements
The name of the super user must be unique. A super user may only be created by another
super user.
Syntax
HRESULT CreateSuperuser(LPCTSTR Name,
LPCTSTR Password,
LPCTSTR Desc=NULL);

Argument

In/Out

Description

Name

In

Name of the super user.

Password

In

Password assigned to the super user.


5-14 characters.

Desc

In (Optional)

Description of the super user.

Teradata Meta Data Services Programmer Guide

301

Chapter 13: Security Classes


CMetaUser Class

SetPassword
Purpose
The SetPassword function sets the password in the user object.
Requirement
This must be followed by a WriteObject function.
Note: It is recommended that the application use the ChangePassword function to change a
user password.
Syntax
HRESULT SetPassword(
const LPCTSTR NewPassword);

Argument

In/Out

Description

NewPassword

In

Password assigned to the user.

ChangePassword
Purpose
The ChangePassword function changes the password of the user.
Requirements
Only the user or a super user can change the password.
The name of the user must be set in the object. OldPassword must be the current password for
the user unless the logged on user is a super user.
Note: If the logged on user is a super user, OldPassword is not required to change any users
password.
Syntax
HRESULT ChangePassword(
LPCTSTR OldPassword,
LPCTSTR NewPassword);

Argument

In/Out

Description

OldPassword

In

Password assigned to the user.

NewPassword

In

New Password.

IsSuperUser
Purpose
The IsSuperUser function returns the TRUE if the current user is a super user.

302

Teradata Meta Data Services Programmer Guide

Chapter 13: Security Classes


CMetaSecurityProfileEntry Class

Syntax
bool IsSuperUser ();

ReadObject / ReadVersion
The CMetaUser does not support versioning, thus there exists only one version for such an
object, and ReadVersion functions equivalently to ReadObject.

WriteObject / WriteVersion
CMetaUser does not support versioning, thus there exists only one version for such an object,
and WriteVersion functions equivalently to WriteObject.

CMetaSecurityProfileEntry Class
Purpose
The CMetaSecurityProfileEntry class is used to add or change a user or application groups
permissions in a security profile.

Syntax
class CMetaSecurityProfileEntry
{
public:
bool: isUser;
OBJECTID_t ObjectID;
short permissions;
};

Argument

Description

isUser

Set to "true" if the ObjectID is that of a user.


Set to "false if the ObjectID is that of an application group.

ObjectID

Set to the ObjectID of the user or application group that is being granted
permissions in the security profile.

Permissions

Set to one of the following:

Teradata Meta Data Services Programmer Guide

MD_READ - grants read access


MD_COLLECTION - Grants read and collection permissions
MD_UPDATE - Grants read, collection, write, and delete permissions.
MD_FULL - Grants all permissions.

303

Chapter 13: Security Classes


CMetaSecurityProfileEntry Class

Functions
GetAll
Purpose

Gets the values from the CMetaSecurityProfileEntry object.


Syntax
HRESULT GetAll (
bool &isUser,
OBJECTID_t &ObjectID,
META_ACCESS_TYPES &accessType);

Argument

In/Out

Description

isUser

Out

Set to "true" if the ObjectID is the ID of a user.


Set to "false" if the ObjectID is the ID of an application group.

ObjectID

Out

ID of the user or application group.

AccessType

Out

Permissions granted to the user or application group in the security


profile.

SetAll
Purpose

Sets the specified values in the CMetaSecurityProfileEntry object.


Syntax
HRESULT SetAll (
const bool isUser, const
OBJECTID_t ObjectID,
const META_ACCESS_TYPES accessType);

304

Argument

In/Out

Description

isUser

In

Set to "true" if the ObjectID is the ID of a user.


Set to "false" if the ObjectID is the ID of an application group.

ObjectID

In

ID of the user or application group to add to the security profile

AccessType

In

Permissions granted to the user or application group in the security


profile.

Teradata Meta Data Services Programmer Guide

Chapter 13: Security Classes


CMetaSecurityProfile Class

CMetaSecurityProfile Class
This section describes the CMetaSecurityProfile class functions that create, update, and delete
security profiles.

CMetaSecurityProfile Class Functions


The CMetaSecurityProfile class functions are:

GetObjectsUsingSecurityProfile

GetPermissionList

PrintCMetaSecurityProfile

RemoveManyPermissions

RemovePermission

ReplacePermissions

SetAIMSecurityProfile

SetClassSecurityProfile

SetObjectSecurityProfile

SetSecurityProfile

UpdateManyPermissions

UpdatePermission

ReadObject

WriteObject

These functions are described more fully in the following paragraphs.

GetObjectsUsingSecurityProfile
Purpose
The GetObjectsUsingSecurityProfile function returns all objects using this profile.
Syntax
HRESULT GetObjectsUsingSecurityProfile (
MetaObjectClassKeyVector &keyList);

Argument

In/
Out

keyList

Out

Teradata Meta Data Services Programmer Guide

Description
List of object class keys (classID, className, name and ID) of objects
assigned to this profile.

305

Chapter 13: Security Classes


CMetaSecurityProfile Class

GetPermissionList
Purpose
The GetPermissionList function returns a vector of CMetaSecurityProfileEntrys that is the list
of the permissions in the profile.
Syntax
const SecurityProfileEntryVector &GetPermissionList(void) const;

PrintCMetaSecurityProfile
Purpose
The PrintCMetaSecurityProfile function displays to standard output the security profile
name, object ID, and permissions.
Syntax
void PrintCMetaSecurityProfile(void);

RemoveManyPermissions
Purpose
The RemoveManyPermissions function removes a list user or application group permissions
from the profile. The application must issue a WriteObject to write the change to the MDS
repository.
Syntax
HRESULT RemoveManyPermissions (
MetaObjectIDVector &ObjectIDList);

Argument

In/
Out

ObjectIDList

In

Description
List of IDs of the users and application groups to remove from
the profile.

RemovePermission
Purpose
The RemovePermission function removes a user or application group permission from the
profile. The application must issue a WriteObject to write the change to the MDS repository.
Syntax
HRESULT RemovePermission (
const OBJECTID_t ObjectID);

306

Teradata Meta Data Services Programmer Guide

Chapter 13: Security Classes


CMetaSecurityProfile Class

Argument

In/
Out

Description

ObjectID

In

ID of user or application group to remove from the profile.

ReplacePermissions
Purpose
The ReplacePermissions function replaces all existing permissions in the profile with the
permissions in the list. The application must issue a WriteObject to write the change to the
MDS repository.
Syntax
HRESULT ReplacePermissions (
SecurityProfileEntryVector &entryList);

Argument

In/
Out

Description

entryList

In

List of permissions.

SetAIMSecurityProfile
Purpose
The SetAIMSecurityProfile function assigns the Security Profile ID (set in the object) to the
AIMs specified in the AIMList. If PropagateFlag is set to MD_PROPAGATE, the Security
Profile ID in all class, property and relationship descriptions in the AIM will also be updated.
You must be initialized as a super user to use this function.
Syntax
HRESULT SetAIMSecurityProfile (
MetaObjectIDVector &AIMList,
const short PropagateFlag);

Argument

In/
Out

Description

AIMList

In

List of AIM object IDs.

PropagateFlag

In

Set to one of the following:


MD_NULL do not update class, property and relationship
descriptions.
MD_PROPAGATE - update the security profile ID in the class,
property and relationship descriptions.

Teradata Meta Data Services Programmer Guide

307

Chapter 13: Security Classes


CMetaSecurityProfile Class

SetClassSecurityProfile
Purpose
The SetClassSecurityProfile function assigns the Security Profile ID (set in the object) to the
Class Description objects specified in the classList. If PropagateFlag is set to
MD_PROPAGATE, the Security Profile ID in all objects in the class will also be updated. You
must be initialized as a super user to use this function.
Syntax
HRESULT SetClassSecurityProfile (
MetaObjectIDVector &classList,
const short PropagateFlag);

Argument

In/
Out

Description

classList

In

List of class IDs.

PropagateFlag

In

Set to one of the following:


MD_NULL do not update class objects.
MD_PROPAGATE - update the security profile ID in all objects in
the class.

SetObjectSecurityProfile
Purpose
The SetObjectSecurityProfile function assigns the Security Profile ID (set in the object) to the
objects specified in the objList.
Requirements
All objects in the list must be in the same class.
You must be initialized as a super user to use this function.
Description
If PropagateFlag is set to MD_PROPAGATE, the Security Profile ID in all related objects will
also be updated.
Related objects are determined by the containment relationships of the specified object. A
containment relationship is a relationship that has delete propagation flag turned on. If object
A is said to contain object B, it means that A is the origin object and B is the destination object
of a containment relationship. Propagation will continue until an object is reached which has
no containment relationships.
It is assumed that many customers will partition access to DIM objects based on databases.
Most of the DIM relationships are containment relationships. The propagate feature allows
administrators to set the security profile ID on a specific database object and the security
profile ID will be propagated to all objects in the database.

308

Teradata Meta Data Services Programmer Guide

Chapter 13: Security Classes


CMetaSecurityProfile Class

Syntax
HRESULT SetObjectSecurityProfile (
MetaObjectIDVector &objList,
const short PropagateFlag);

Argument

In/
Out

Description

objList

In

List of object IDs.

PropagateFlag

In

Set to one of the following:


MD_NULL do not update related objects.
MD_PROPAGATE - update the security profile ID in all related
objects.

Figure 26: Propagate Permissions from Database


DatabaseOwnsDatabases

Setting the group


permissions here

DataBase

DatabaseHasTables

DatabaseHasViews

Table
TableHasCheckConstraints
Check

View

TableHasColumns
Column

TableHasIndices
Index

IndexContainsColumns
IndexColumn

ViewHasTableColumns

ViewHasColumns
ViewColumn

TableHasRefConstraints
Reference

ConstraintReferenceColumns
ReferenceColumn

Can set the group


permissions group in all
destination classes

3047A010

SetSecurityProfile
Purpose
The SetSecurityProfile function assigns the Security Profile ID (set in the object) to the objects
in a list.
Description
The list can contain objects in different classes.
Requirements
The ClassID and the ObjectID of the object must be set in each CMetaObjectClassKey in the
ObjList.
You must be initialized as a super user to use this function.

Teradata Meta Data Services Programmer Guide

309

Chapter 13: Security Classes


CMetaSecurityProfile Class

Syntax
HRESULT SetSecurityProfile (
MetaObjectClassKeyVector &ObjList);

Argument

In/
Out

ObjectList

In

Description
List of object class keys (classID, className, name and ID) of objects
assigned to this profile.

UpdateManyPermissions
The UpdateManyPermissions function updates a list of user and application group
permissions in the profile.
The application must issue a WriteObject to write the change to the MDS repository.
HRESULT UpdateManyPermissions (
SecurityProfileEntryVector &entryList,);

Argument

In/
Out

Description

EntryList

In

List of permissions.

UpdatePermission
Purpose
The UpdatePermission function changes the permission for a user or application group in the
profile.
Requirements
The application must issue a WriteObject to write the change to the MDS repository.
Syntax
HRESULT UpdatePermission (
const bool IsUser,
const OBJECTID_t ObjectID,
const short AccessType);

310

Argument

In/
Out

IsUser

In

Set to "true" if the ObjectID is that of a user.


Set to "false if the ObjectID is that of an application group.

ObjectID

In

ID of user or application group to remove from the profile.

AccessType

In

Access Type setting for the user or group.

Description

Teradata Meta Data Services Programmer Guide

Chapter 13: Security Classes


CMetaSecurityProfile Class

ReadObject
Purpose
Reads the security profile object.
Requirements:
The internal object ID must be set.
Syntax
HRESULT ReadObject(void);

WriteObject
Purpose
Writes the security profile object.
Requirements:
The internal object ID must be set.
Syntax
HRESULT WriteObject(void);

Teradata Meta Data Services Programmer Guide

311

Chapter 13: Security Classes


CMetaSecurityProfile Class

312

Teradata Meta Data Services Programmer Guide

CHAPTER 14

MetaCOMExport Library

The COM libraries supplement the C++ classes by providing access to the repository using
Visual Basic, J++, and scripting languages such as VBScript, JScript, and XML.

Library and Location


The library type name for this release is MetaCOM 2.6. For compatibility, the previous
functionality provided by the 2.1, 2.2, 2.3, 2.4, and 2.5 type libraries is still fully supported.
The type libraries for these five components are installed separately from the DLL in the files
metacom21.tlb, metacom22.tlb, metacom23.tlb, metacom24.tlb, and metacom25.tlb (in
%METAHOME%\bin). All type libraries are automatically registered and unregistered with
MDS installation and uninstallation. No action by the user is necessary.

ColumnFilter
Prior to MDS 13.0, new GetClassObject and Get Collection routines in the MetaActive Class
return all the properties for an object. This can be time consuming if only a few of the unique
properties are actually needed.
The following routines provide the ability to specify and restrict the unique properties to be
returned through the used of a ColumnFilter parameter:

GetClassObjectsByProperty2

GetClassObjectVersionsByProperty2

GetCollectionsByProperty3

GetCollectionVersionsByProperty3

GetClassObjectsByRange2

GetClassObjectVersionsByRange2

If the ColumnFilter parameter for these routines is NULL (or the IMetaInfoKeyList is empty)
all unique properties of every object are returned by the method call. This is the same
behavior as that of the previous version of the call.
Specify only those unique properties to be returned by adding an IMetaInfoKey object, with
its ObjectID set to the Property ID (PID) of the property, for each property needed, to the
ColumnFilter list.

Teradata Meta Data Services Programmer Guide

313

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Depending on the number of objects and the number of unique properties not needed, and
therefore not returned, this can result in a significant savings in time, and database spoolspace. (The SQL generated by the MDS engine requests only those columns (properties)
specified when it builds the SELECT statement.)
For security and other reasons, all "common" properties are always returned, with the
exception of the Description and ObjectGUID properties. When unique properties are
specified in the ColumnFilter list, these two common properties will have empty and
NULLGUID values respectively, unless their PIDs are also added to the ColumnFilter list.
(Note: the PIDs for common properties can be found in the MetaGlobals_h.bas file.)

Example
Dim colList As METACOMEXPORT21Lib.MetaInfoKeyList
Set colList = New MetaInfoKeyList
Dim col As MetaInfoKey
Set col = New MetaInfoKey
col.ObjectID = dbaim_h.PID_DATABASE_DATABASEID
colList.Add col
col.ObjectID = dbaim_h.PID_DATABASE_TYPE
colList.Add col

The "colList" object can now be used for the ColumnFilter parameter to retrieve objects from
the DIM Column class. The result will be the usual number of objects, based on any other
filters present, but with only the DatabaseID and DatabaseType unique properties present in
each object's PropertyItem collection. Each object will also have all its common property
values present, except for Description and ObjectGUID. To have either of these returned also,
simply add their PIDs to the colList.

Objects and Collections Classes


This section describes the classes used to create and maintain MDS objects and collections.

MetaActive Class
The IMetaActive COM class contains one interface: IMetaActive. The interface supports a
variety of functions and methods to maintain repository objects.

314

Property

Type

Description

DIMInfoNeeded

Boolean

Used to indicate that the DIM information is needed on the


GetClassObjectsByProperty, GetClassObjectsByRange,
GetCollectionsByProperty, and GetCollectionsByProperty2 calls.
True by default.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Initialize
Purpose:

Use this method to initialize with the MDS repository.


Description:

The Initialize method will create a connection to the MDS repository. Either the Initialize or
SignOn method must be called before any other MDS COM calls. The connection remains
open until the DeInitialize method is called.
Syntax:
HRESULT Initialize(
[in] BSTR Username,
[in] BSTR Password);

Argument

In/Out

Description

Username

In

Username The MDS user name that exists in the MDS


repository. Required.

Password

In

Password The MDS user password. Required.

DeInitialize
Purpose:

The DeInitialize method removes or closes the connection to the MDS repository.
Description:

This method should always be called before terminating to insure the database connection to
the MDS repository is properly closed.
Syntax:
HRESULT DeInitialize();

SignOn
Purpose:

Use this method to sign on to the MDS repository as a different user.


Description:

Each MDS MetaActive COM class object will support one user. If the user signs on with a
different user name, any subsequent MDS API calls will have the new user name as the caller
and the security will be based on the user access rights. To support multiple users in a single
process, create multiple MetaActive objects and assign one user per each of the MetaActive
objects.
If the MDS repository has not already been initialized, it will be at this time.
Syntax:
HRESULT SignOn(

Teradata Meta Data Services Programmer Guide

315

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
[in] BSTR Username,
[in] BSTR Password);

Argument

In/Out

Description

Username

In

Username The MDS user name that exists in the MDS


repository. Required.

Password

In

Password The MDS user password. Required.

SignOff
Purpose:

Use this method to sign off the user that was signed on.
Description

If the MDSUserName is not specified, the MDS user associated with this MetaActive object is
signed off. An MDS user can be associated with a MetaActive object in one of three ways: first,
during an Initialize call, second, during a SignOn call or third, by setting the MDSCaller
property for the object. If no user name is specified for the call, and no user is associated with
the MetaActive object, the engine will return a META_E_USER_NOT_SIGNED_ON error.
Syntax:
HRESULT SignOff([in] BSTR MDSUserName);

ReadObject
Purpose:

Use this method to read in an object from the MDS repository.


Description:

This may require waiting for write locks held by other transactions to be released. MDS does
not support reads of write-locked MDS repository data.
In a repository with versioning on, ReadObject always returns the published or current
version. This includes the case where the LOID of the MetaInfo object to be read is *not* the
LOID of the published version. This allows ReadObject to behave in a similar fashion on
repositories with versioning on or off. To read a specific object version, use
ReadObjectVersion.
Reading an object from one of the classes in the DIM AIM (DatabaseModel meta model) will
also return the object's DIM information (System Name, Database Name and Table Name).
This DIM information is placed in the "DIMInfo" property of the MetaInfo object. This
information is acquired by several JOIN operations, and can cause some performance
overhead, especially in version-enabled repositories.
If DIM information is not needed for an object from a DIM class, set the MetaActive
DIMInfoNeeded property to FALSE before the object is read. With this setting the MDS
engine executes the read as if the object is from a non-DIM class, so it will not execute the
DIM-related JOINs. All other object properties will be retrieved as usual; the DIM fields will

316

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

be empty. The result can be significant performance savings when the DIM information is not
needed. Note that objects from classes not in the DIM AIM never retrieve DIM information,
and so never incur the JOIN overhead.
Requirements:

The MDS COM MetaInfo object must be created and the object identification attributes must
be set before calling the ReadObject method. The object identification attributes can be the
class ID (internal or globally unique) and the object name or the object identifier (internal or
globally unique).
Syntax:
HRESULT ReadObject(
[in] IMetaInfo *MetaInfo);

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

ReadObjectVersion
Purpose:

Use this method to read in an object from the MDS repository.


Description:

Identical to the ReadObject call, except that in a repository with versioning on, the version of
the object read is the one specifically identified by the LOID in the MetaInfo interface object.
In contrast, the ReadObject call always returns the published version of the object no matter
which version the LOID is associated with.
Reading an object from one of the classes in the DIM AIM (DatabaseModel meta model) will
also return the object's DIM information (System Name, Database Name and Table Name).
This DIM information is placed in the "DIMInfo" property of the MetaInfo object. This
information is acquired by several JOIN operations, and can cause some performance
overhead, especially in version-enabled repositories.
If DIM information is not needed for an object from a DIM class, set the MetaActive
DIMInfoNeeded property to FALSE before the object is read. With this setting the MDS
engine executes the read as if the object is from a non-DIM class, so it will not execute the
DIM-related JOINs. All other object properties will be retrieved as usual; the DIM fields will
be empty. The result can be significant performance savings when the DIM information is not
needed. Note that objects from classes not in the DIM AIM never retrieve DIM information,
and so never incur the JOIN overhead.
Syntax:
HRESULT ReadObjectVersion(
[in] IMetaInfo *MetaInfo);

Teradata Meta Data Services Programmer Guide

317

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

ReadDormantObject
Purpose:

This routine extends the functionality of ReadObject to return an object that is either active
("mdsCurrent") or dormant.
Description:

If the DIMInfoNeeded property for this class has been set to True, the IMetaInfo object will
have its DIMInfo information associated with it.
If the return status is S_OK, check the PublishState to determine if the object is current
(PublishState is "mdsCurrent") or is dormant (PublishState is "mdsDormant").
The order of evaluation to determine the object to be read is:
1

ObjectID if not zero

ObjectGUID if not null

ClassID and Name if the ClassID is not zero

ClassGUID and Name

Reading an object from one of the classes in the DIM AIM (DatabaseModel meta model) will
also return the object's DIM information (System Name, Database Name and Table Name).
This DIM information is placed in the "DIMInfo" property of the MetaInfo object. This
information is acquired by several JOIN operations, and can cause some performance
overhead, especially in version-enabled repositories.
If DIM information is not needed for an object from a DIM class, set the MetaActive
DIMInfoNeeded property to FALSE before the object is read. With this setting the MDS
engine executes the read as if the object is from a non-DIM class, so it will not execute the
DIM-related JOINs. All other object properties will be retrieved as usual; the DIM fields will
be empty. The result can be significant performance savings when the DIM information is not
needed. Note that objects from classes not in the DIM AIM never retrieve DIM information,
and so never incur the JOIN overhead.
Requirements:

The requirements for specifying the object to be returned are the same as those for
ReadObject.
This routine can only be called by an administrative user.
Syntax:
HRESULT ReadDormantObject(
[in] IMetaInfo *MetaInfo);

318

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

WriteObject
Purpose:

Use this method to write the object into the MDS repository.
Description:

This may require waiting for write locks held by other transactions to be released. MDS does
not support reads of write-locked MDS repository data.
In a repository with versioning on, WriteObject writes a new version of the object to the
repository. The new object has the same GUID as the current version, but the LOID is
different and of course, and the version number is one greater than the current version of
the object. This also means that this write produces the new current or published version
of the object, replacing the previous current version (which is now in the inactive published
state). To re-write the current version of the object when versioning is on, use
WriteObjectVersion.
Requirements

The MDS COM MetaInfo object must be created and the object identification attributes must
be set before calling the WriteObject method. The object identification attributes can be the
class ID (internal or globally unique) and the object name or the object identifier (internal or
globally unique).
Syntax:
HRESULT WriteObject(
[in] IMetaInfo *MetaInfo);

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

WriteObjectVersion
Purpose:

Use this method to write the object into the MDS repository.
Description:

Identical to the WriteObject method except that in a repository with versioning on, the
published (current) version is updated, that is, a new version is not written. Since only the
current version of an object can be updated, if WriteObjectVersion is attempted on any other
version, the user will receive an error (META_E_OBJECT_ISFROZEN).

Teradata Meta Data Services Programmer Guide

319

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax:
HRESULT WriteObjectVersion(
[in] IMetaInfo *MetaInfo);

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

Delete
Purpose:

Use this method to delete an object from the MDS repository.


Description:

This may require waiting for write locks held by other transactions to be release.
In a repository with versioning on, Delete deletes all versions of the object from the repository
so that the object is completely removed from the repository. This makes its behavior
consistent with that of a non-versioned repository, where a Delete also completely removes the
object from the repository. If you wish to remove a specific version(s) of the object, use
DeleteVersion or DeleteVersionRange.
If the object is from a DIM class that has business information associated with it, and the
retain-business-objects feature is enabled, the object will have its PublishState changed to
"dormant" (mdsDormant) and not be removed from the repository. The object can be reactivated or removed at a later time with the appropriate function call (see
ActivateDormantObject or DeleteDormantObject, respectively). If the objects PublishState is
mdsDormant, this call will fail; use the DeleteDormantObject to specifically delete dormant
objects.
Requirements

The MDS COM MetaInfo object must be created and the object identification attribute must
be set before calling the Delete method. The object identification attribute is the object
identifier.
Syntax:
HRESULT Delete(
[in] IMetaInfo *MetaInfo);

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

DeleteDormantObject
Purpose:

Use this method to force the deletion an object from the MDS repository even if the object
would otherwise be a candidate for having its publish state set to dormant because the retainbusiness-objects feature is enabled.
320

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

The object can be either dormant or non-dormant.


Requirements

This routine can only be called by an administrative user.


Syntax:
HRESULT DeleteDormantObject (
[in] IMetaInfo *MetaInfo);

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

ActivateDormantObject
Purpose:

Use this method to change a dormant object to an active object, and re-associate of all its
business information back to it.
Description:

The change is immediately made to the repository. By default, the (re)activation is propagated
to all objects that are in the destination class of any relationship from this (origin) object, and
those objects also have their business information (if any), re-associated. The call has no
effect if the object is already active, i.e. the PublishState is already "mdsCurrent".
Requirements

This routine can only be called by an administrative user.


Reactivating an object will require DELETE permission.
Syntax:
HRESULT ActivateDormantObject (
[in] IMetaInfo *MetaInfo);

Argument

In/Out

Description

Metainfo

In/out

Interface pointer to the MDS COM MetaInfo object in memory.

DeleteVersion
Purpose:

Use this method to delete an object from the MDS repository.


Description:

Identical to the Delete routine except that the DeleteVersion routine removes only that version
identified by the MetaInfo object; no other versions are deleted. If the current or published
version is deleted, then the previous version becomes the current version.

Teradata Meta Data Services Programmer Guide

321

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax:
HRESULT DeleteDormantObject(
[in] IMetaInfo *MetaInfo);

DeleteVersionRange
Purpose:

Use this method to delete an object from the MDS repository.


Description:

Identical to the DeleteVersion routine except that the user can specify a range of versions to be
deleted. If the startVersion parameter is less than 1, or greater than the highest version for the
object, an error will be returned. The endVersion parameter indicates the highest version to be
deleted. If endVersion is not provided, all versions from startVersion to the current version
will be deleted, and the new highest version number will become the current version. If
endVersion is 0, or greater than the current version number, the current version number will
be assumed to be the end version.
Syntax:
HRESULT
[in]
[in]
[in]

DeleteVersionRange(
IMetaInfo *MetaInfo
long startVersion.
long endVersion = 0);

GetObjectID
Purpose:

Use this method to get the local internal object identifier given the class identification and
name or object GUID.
Description:

If the ObjectGUID is known, it is sufficient by itself to retrieve the objects ID. However, if the
objects GUID is not known, you will need to specify either the ClassGUID or ClassID, along
with the objects name.
If the object is not found in the repository and there were not repository errors reported (that
is, HRESULT is S_OK), an ObjectID of 0 is returned.
Syntax:
HRESULT GetObjectID(
[in, optional] BSTR ObjectGUID,
[in, optional] BSTR ClassGUID,
[in, optional] long ClassID,
[in, optional] BSTR Name,
[out, retval] long *lpObjectID);

Argument

In/Out

Description

ObjectGUID

In

The string GUID of the object. The string format of the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

322

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

ClassGUID

In

The string GUID of the class. The string format of the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

ClassID

In

The local class internal identifier.

Name

In

The name of the object.

IPObjectID

Out

A returned long that is the internal object ID of the identified


object ("0" if the object is not found).

GetClassObjects
Purpose:

Use this method to retrieve the MDS objects in a particular class.


Description:

This may require waiting for write locks held by other transactions to be release. If the
optional Name parameter is specified, the method will only retrieve the object with the
matching object name.
Requirements:

The class identification can be a class GUID or a class internal identifier. The class GUID is a
string representation of the GUID format (for example: {8CAF7740-EECD-11d3-9D0100902781A33F}).
Syntax:
HRESULT GetClassObjects(
[in] BSTR ClassGUID,
[in] long ClassID,
[in, optional] BSTR Name,
[out, retval] IMetaInfoList **InfoList);

Argument

In/Out

Description

ClassGUID

In

The string GUID of the object. The string format of the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

ClassID

In

The internal object identifier of the class. If the class object


identifier is 0, the string GUID of the class is required.

Name

In

The object name in the class. This parameter is used as a filter to


retrieve only the objects with this specified name.

InfoList

Out

A returned interface to a list of MetaInfo objects.

Teradata Meta Data Services Programmer Guide

323

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

GetClassObjectVersions
Purpose:

Use this method to get the local internal object identifier given the class identification and
name or object GUID.
Description:

Identical to the GetClassObjects routine except for the addition of the optional LabelName
parameter.
For repositories that have versioning enabled, this routine returns not only all objects for the
class, but all versions of each object, unless a label is specified by the LabelName parameter. In
that case, the label acts like a filter returning only those object versions that have the label
attached to them.
Syntax:
HRESULT GetClassObjects(
[in] BSTR ClassGUID,
[in] long ClassID,
[in, optional] BSTR Name,
[in, optional] BSTR LabelName,
[out, retval] IMetaInfoList **InfoList);

GetClassObjectKeys
Purpose:

Use this method to retrieve the MDS object keys in a particular class. This may require waiting
for write locks held by other transactions to be release.
Description:

If a value for the optional Name parameter is specified, only those objects whose names match
the pattern are returned. (Name-patterns accept Teradata wildcard characters.) If the Name
parameter is omitted, all objects from the class are returned. For a version-enabled repository,
the returned objects are the current, non-frozen versions only. To get inactive or frozen
versions of an object, use GetClassObjectVersionKeys or any GetClassObjects call.
Requirements:

The class identification can be a class GUID or a class internal identifier. The class GUID is a
string representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D0100902781A33F}).
Syntax:
HRESULT GetClassObjectKeys(
[in] BSTR ClassGUID,
[in] long ClassID,
[in, optional] BSTR Name,
[out, retval] IMetaInfoKeyList **InfoKeyList);

324

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

ClassGUID

In

The string GUID of the object. The string format of the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

ClassID

In

The internal object identifier of the class. If the class object


identifier is 0, the string GUID of the class is required.

Name

In

If the optional Name parameter is used, only those objects whose


names match the pattern are returned. (Name-patterns accept
Teradata wildcard characters.) If omitted, all objects from the
class are returned.

InfoKeyList

Out

A returned interface to a list of MetaInfoKey objects.

GetDormantClassObjectKeys
Purpose:

Use this method to retrieve only the keys for dormant objects in a particular class.
Description:

This routine returns a list of IMetaInfoKeys in the InfoKeyList parameter, that identifies the
dormant objects in the specified class. Only the keys of dormant objects (PublishState =
"mdsDormant") are returned. The class must be specified by either the ClassGUID or ClassID.
If only one named object is to be returned from the class, its name should be specified in the
Name parameter.
This routine is expected to be used by a meta data browser to enable it to display the name
and/or id of objects in a class without having to read the entire collection of objects into
memory.
This routine can only be called by an administrative user.
Syntax:
HRESULT GetDormantClassObjectKeys(
[in] BSTR ClassGUID,
[in] long ClassID,
[in, optional] BSTR Name,
[out, retval] IMetaInfoKeyList **keyList);

GetClassObjectVersionKeys
Purpose:

Use this method to retrieve the MDS object keys in a particular class.
Description:

Identical to the GetClassObjectKeys routine except for the addition of the optional LabelName
parameter, and the return of a collection of MetaVersionedInfoKeys instead of MetaInfoKeys.
For repositories that have versioning enabled, this routine returns not only keys of all objects
in the repository, but all versions of all objects, unless a label is specified. If a label is specified

Teradata Meta Data Services Programmer Guide

325

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

by the LabelName parameter, it acts as a filter returning only those object versions that have
the label attached to them.
If the optional Name parameter is provided, only those objects whose Name matches the
parameter are returned. [The match is exact but case-insensitive. The effect is similar to
adding a filter of WHERE (...) AND Name = name-value to the SQL.]
Syntax:
HRESULT GetClassObjectVersionKeys(
[in] BSTR ClassGUID,
[in] long ClassID,
[in, optional] BSTR LabelName,
[in, optional] BSTR Name,
[out, retval] IMetaversionedInfoKeyList **keyList);

GetCollections
Purpose:

Use this method to retrieve the MDS collection objects in the object relationship.
Description:

This may require waiting for write locks held by other transactions to be release. If the
optional Name parameter is specified, the method will only retrieve the object with the
matching object name in the object relationship.
Requirements

The relationship identification can be a relationship GUID or a relationship internal


identifier. The relationship GUID is a string representation of the GUID format (i.e.,
{8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT GetCollections(
[in] CollectionType Direction,
[in] long ObjectID,
[in] BSTR RelationshipGUID,
[in] long RelationshipID,
[in, optional] BSTR Name,
[out, retval] IMetaInfoList **InfoList);

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string () is entered, the relationship identifier is
required.

326

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

Name

In

The object name in the class. This parameter is used as a filter to


retrieve only the objects with this specified name within the
specified relationship.

InfoList

Out

A returned interface to a list of MetaInfo objects.

GetCollectionKeys
Purpose:

Use this method to retrieve the MDS collection object keys in the object relationship.
Description:

This may require waiting for write locks held by other transactions to be release. If the
optional Name parameter is specified, the method will only retrieve the object key with the
matching object name in the object relationship.
Requirements

The relationship identification can be a relationship GUID or a relationship internal


identifier. The relationship GUID is a string representation of the GUID format (i.e.,
{8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT GetCollectionKeys(
[in] CollectionType Direction,
[in] long ObjectID,
[in] BSTR RelationshipGUID,
[in] long RelationshipID,
[in, optional] BSTR Name,
[out, retval] IMetaInfoKeyList **InfoKeyList);

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string () is entered, the relationship identifier is
required.

Teradata Meta Data Services Programmer Guide

327

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

Name

In

The object name in the class. This parameter is used as a filter to


retrieve only the objects with this specified name within the
specified relationship.

InfoKeyList

Out

A returned interface to a list of MetaInfoKey objects.

GetClassObjectsByProperty
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.
Description:

The GetClassObjectsByProperty method returns a list of MetaInfo objects that matches the
selected criteria. The function allows the programmer to specify the property id, property
value and comparison operator on which to perform the search. If multiple properties are
specified in the search, the logical operator between the property searches must also be
specified.
If the DIMInfoNeeded property for this class has been set to True, the IMetaInfo objects
returned will each have DIM information associated with them. For more information on this
method and its usage, see Chapter 8: CMetaFilterInfo Class, and
GetClassObjectsByProperty in Chapter 7: CMetaObject Class.
Requirements:

The class identification must be set.


The class identification can be a class GUID or a class internal identifier. The class GUID is
a string representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D0100902781A33F}).

The Filters parameter list must contain zero or more MetaFilter objects.
For each of the MetaFilter object, the property identifier or the property name must be set
and must contain a valid relative property identifier or name of a property description in
the class. The value must also be set 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
the relative property identifier = 1 and the relative property identifier is defined as an
integer, the value must be set to an integer.

Syntax:
HRESULT
[in]
[in]
[in]
[in]

328

GetClassObjectsByProperty(
BSTR ClassGUID,
long ClassID,
BSTR NamePattern,
IMetaFilterList *Filters,

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
[in] IMetaInfoKeyList *SortKeys,
[out, retval] IMetaInfoList **InfoList);

Argument

In/Out

Description

ClassGUID

In

The string GUID of the class. The string format of the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string ("") is entered, the class identifier is required.

ClassID

In

The internal object identifier of the class. If the class object


identifier is 0, the string GUID of the class is required.

NamePattern

In

If not empty, only return the objects found in the collection


whose name matches the string pattern in this parameter. If
empty, return all objects found in the collection with any name.
In either case, the caller can still specify other filters in the Filters
parameter below.

Filters

In

An MDS COM MetaInfoList object that contains zero or more


MDS MetaFilter objects. See CMetaFilterInfo Class Functions
for more detailed information on the usage.

SortKey

In

An MDS COM MetaInfoKeyList object that contains zero or


more MDS MetaInfoKey objects. This parameter is used to
specify the ordering of the returned list.

InfoList

Out

A returned interface to a list of MetaInfo objects.

GetClassObjectsByProperty2
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.
Description:

This method is identical to the GetClassObjectsByProperty method except that the


ColumnFilter parameter allows the caller to specify which properties are to be returned by the
implementation.
Refer to ColumnFilter on page 313 for additional information.
Syntax:
HRESULT GetClassObjectsByProperty2(
[in] BSTR ClassGUID,
[in] long ClassID,
[in] BSTR NamePattern,
[in] IMetaFilterList *Filters,
[in] IMetaInfoKeyList *SortKeys,
[in, optional] IMetaInfoKeyList* ColumnFilter,
[out, retval] IMetaInfoList **InfoList);

Teradata Meta Data Services Programmer Guide

329

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

GetClassObjectVersionsByProperty
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.
Description:

Identical to the GetClassObjectsByProperty except for the addition of the optional LabelName
parameter.
For a repository that has versioning enabled, this routine returns all versions of those objects
that match the property filter, unless a label is also specified by the LabelName parameter. In
that case, the label acts as another filter returning only those objects that also have the label
attached to them. (Note also that the filter list and sort key list are both optional.)
Syntax:
HRESULT GetClassObjectVersionsByProperty(
[in] BSTR ClassGUID,
[in] long ClassID,
[in] BSTR NamePattern,
[in, optional] BSTR LabelName,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[out, retval] IMetaInfoList **InfoList);

GetClassObjectVersionsByProperty2
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.
Description:

Identical to the GetClassObjectVersionsByProperty except that the ColumnFilter parameter


allows the caller to specify which properties are to be returned by the implementation.
Refer to ColumnFilter on page 313 for additional information
Syntax:
HRESULT GetClassObjectVersionsByProperty2(
[in] BSTR ClassGUID,
[in] long ClassID,
[in] BSTR NamePattern,
[in, optional] BSTR LabelName,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[in, optional] IMetaInfoKeyList *ColumnFilter,
[out, retval] IMetaInfoList **InfoList);

GetClassObjectsByRange
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.

330

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

This method is identical to the GetClassObjectsByProperty method with the addition of three
new parameters. The new parameters allow the caller to specify how many items are to be
returned in "RequestCount", and the offset in the result set at which to start returning in
"Start". It also returns the actual count of items in the ReturnCount parameter.
If the DIMInfoNeeded property for this class has been set to True, the IMetaInfo objects
returned will each have DIM information associated with them.
This method was created especially for browser applications where there are 10s or 100s of
thousands of items that could be returned, but only a "page full" at a time will be displayed. It
would be of no value for the application to wait for all the items to become available (which
could take some time), as happens in the GetClassObjectsByProperty call. With this method,
the user can specify a page-full of items starting at anywhere in the result set, and thereby get
results much faster than waiting for the entire result set.
Requirements:

The requirements are the same as for GetClassObjectVersionsByProperty on page 330


Syntax:
HRESULT GetClassObjectsByRange(
[in] BSTR ClassGUID,
[in] long ClassID,
[in] BSTR NamePattern,
[in] int Start,
[in] int RequestCount,
[out] VARIANT *ReturnCount,
[in] IMetaFilterList *Filters,
[in] IMetaInfoKeyList *SortKeys,
[out, retval] IMetaInfoList **InfoList);

Argument

In/Out

Description

ClassGUID

In

The string GUID of the class. The string format of the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string ("") is entered, the class identifier is required.

ClassID

In

The internal object identifier of the class. If the class object


identifier is 0, the string GUID of the class is required.

NamePattern

In

If not empty, only return the objects found in the collection


whose name matches the string pattern in this parameter. If
empty, return all objects found in the collection with any name.
In either case, the caller can still specify other filters in the Filters
parameter below.

Start

In

This should be an integer value indicating where in the result set


the user wants to start getting items.

RequestCount

In

This should be the maximum number of items the user wants


returned.

Teradata Meta Data Services Programmer Guide

331

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

ReturnCount

Out

A VARIANT reference/pointer filled in by the interface as the


number of items actually returned by Teradata that matched the
request.

Filters

In

An MDS COM MetaInfoList object that contains zero or more


MDS MetaFilter objects. See CMetaFilterInfo Class Functions
for more detailed information on the usage.

SortKey

In

An MDS COM MetaInfoKeyList object that contains zero or


more MDS MetaInfoKey objects. This parameter is used to
specify the ordering of the returned list.

InfoList

Out

A returned interface to a list of MetaInfo objects.

GetClassObjectsByRange2
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.
Description:

Identical to the GetClassObjectsByRange routine except that the ColumnFilter parameter


allows the caller to specify which properties are to be returned by the implementation.
Refer to ColumnFilter on page 313 for additional information
Requirements:

The requirements are the same as for GetClassObjectVersionsByProperty on page 330


Syntax:
HRESULT GetClassObjectsByRange2(
[in] BSTR ClassGUID,
[in] long ClassID,
[in] BSTR NamePattern,
[in] int Start,
[in] int RequestCount,
[out] VARIANT *ReturnCount,
[in] IMetaFilterList *Filters,
[in] IMetaInfoKeyList *SortKeys,
[in] IMetaInfoKeyList *ColumnFilter,
[in, optional] IMetaInfoKeyList* ColumnFilter,
[out, retval] IMetaInfoList **InfoList);

GetClassObjectVersionsByRange
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.

332

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

Identical to the GetClassObjectsByRange routine except for the addition of the optional
LabelName parameter.
For repositories that have versioning enabled, this routine returns the range of all versions of
those class objects that match the property filter, unless a label is also supplied. If a label is
supplied by the LabelName parameter, it acts as a filter returning only those versions of the
objects that have the label attached to them. Since the LabelName is used with a "LIKE" clause
when the request is sent to the database, it can have Teradata wildcard search characters in it.
(Note that the filter list and sort-key list are also optional.)
Requirements:

The requirements are the same as for GetClassObjectVersionsByProperty on page 330


Syntax:
HRESULT GetClassObjectVersionsByRange(
[in] BSTR ClassGUID,
[in] long ClassID,
[in] BSTR NameParameter,
[in] int Start,
[in] int RequestCount,
[out] VARIANT* ReturnCount,
[in, optional] BSTR LabelName,
[in, optional] IMetaFilterList* Filters
[in, optional] IMetaInfoKeyList* SortKeys,
[out, retval] IMetaInfoList** InfoList);

GetClassObjectVersionsByRange2
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified class.
Description:

Identical to the GetClassObjectsVersionsByRange routine except that the ColumnFilter


parameter allows the caller to specify which properties are to be returned by the
implementation.
Refer to ColumnFilter on page 313 for additional information
Requirements:

The requirements are the same as for GetClassObjectVersionsByProperty on page 330


Syntax:
HRESULT GetClassObjectVersionsByRange2(
[in] BSTR ClassGUID,
[in] long ClassID,
[in] BSTR NameParameter,
[in] int Start,
[in] int RequestCount,
[out] VARIANT* ReturnCount,
[in, optional] BSTR LabelName,

Teradata Meta Data Services Programmer Guide

333

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
[in, optional] IMetaFilterList* Filters
[in, optional] IMetaInfoKeyList* SortKeys,
[in, optional] IMetaInfoKeyList* ColumnFilter,
[out, retval] IMetaInfoList** InfoList);

GetDormantClassObjects
Purpose:

Use this method to search for objects with their publish state set to mdsDormant in the
specified class.
Description:

This routine is essentially the same as the GetClassObjectsbyProperty routine, except the only
objects returned are those that are "dormant", i.e. they all have their PublishState =
"mdsDormant".
If the DIMInfoNeeded property for this class has been set to True, the IMetaInfo objects
returned will each have DIMInfo information associated with them.
Requirements:

This routine may only be called by an administrative user.


Syntax:
HRESULT GetDormantClassObjects(
[in] BSTR ClassGUID,
[in, optional, defaultvalue(0)] long ClassID,
[in, optional] BSTR NamePattern,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[out, retval] IMetaInfoList **InfoList);

Argument

In/Out

Description

ClassGUID

In

The string GUID of the class. The string format of the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string ("") is entered, the class identifier is required.

334

ClassID

In

The internal object identifier of the class. If the class object


identifier is 0, the string GUID of the class is required.

NamePattern

In

If not empty, only return the objects found in the collection


whose name matches the string pattern in this parameter. If
empty, return all objects found in the collection with any name.
In either case, the caller can still specify other filters in the Filters
parameter below.

Filters

In

An MDS COM MetaInfoList object that contains zero or more


MDS MetaFilter objects. See CMetaFilterInfo Class Functions
for more detailed information on the usage.

SortKey

In

An MDS COM MetaInfoKeyList object that contains zero or


more MDS MetaInfoKey objects. This parameter is used to
specify the ordering of the returned list.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

InfoList

Out

A returned interface to a list of MetaInfo objects.

GetCollectionsByProperty
Purpose:

Use this method to perform searching on the matching properties of the objects in the
specified relationship.
Description:

The GetCollectionByProperty method returns a list of MetaInfo objects that matches the
selected criteria in the specified relationship. The function allows the programmer to specify
the property id, property value, and comparison operator on which to perform the search. If
multiple properties are specified in the search, the logical operator between the property
searches must also be specified.
If the DIMInfoNeeded property for this class has been set to True, the IMetaInfo objects
returned will each have DIM information associated with them. For more information on this
method and its usage, see Chapter 8: CMetaFilterInfo Class and Chapter 7: CMetaObject
Class.
Requirements:

The relationship identification must be set.


The relationship identification can be a relationship GUID or a relationship internal
identifier. The relationship GUID is a string representation of the GUID format (i.e.,
{8CAF7740-EECD-11d3-9D01-00902781A33F}).

The Filters parameter list must contain zero or more MetaFilter objects.
For each of the MetaFilter object, the property identifier or the property name must be set
and must contain a valid relative property identifier or name of a property description in
the class. The value must also be set 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
the relative property identifier = 1 and the relative property identifier is defined as an
integer, the value must be set to an integer.

Syntax:
HRESULT GetCollectionsByProperty(
[in] CollectionType Direction,
[in] long ObjectID,
[in] BSTR RelationshipGUID,
[in] long RelationshipID,
[in] BSTR NamePattern,
[in] IMetaFilterList *Filters,
[in] IMetaInfoKeyList *SortKeys,
[out, retval] IMetaInfoList **InfoList);

Teradata Meta Data Services Programmer Guide

335

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

Direction

In

An enumeration type specifying the direction of the relationship


typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string () is entered, the relationship identifier is
required.

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

NamePattern

In

If not empty, only return the objects found in the collection


whose name matches the string pattern in this parameter. If
empty, return all objects found in the collection with any name.
In either case, the caller can still specify other filters in the Filters
parameter below.

Filters

In

An MDS COM MetaInfoList object that contains zero or more


MDS MetaFilter objects. See CMetaFilterInfo Class Functions
for more detailed information on the usage.

SortKey

In

An MDS COM MetaInfoKeyList object that contains zero or


more MDS MetaInfoKey objects. This parameter is used to
specify the ordering of the returned list.

InfoList

Out

A returned interface to a list of MetaInfo objects.

IsVersioningEnabled
Purpose:

Returns the repository versioning setting.


Description:

Returns VARIANT_TRUE (true) if versioning is enabled (on) for the repository, else it returns
FALSE. Currently, repository versioning can only be enabled/disabled during a metacreate or
metamigrate.
Syntax:
HRESULT IsVersioningEnabled(
[out, retval] VARIANT_BOOL* val);

put_DIMInfoNeeded
Purpose:

This call sets the DIMInfoNeeded property for this class.

336

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

When this property is set to "true" (its default setting), the DIM information will be set for
each of the returned items. This means that the MetaInfo property get_DIMInfo will return a
filled-out MetaDIMInfo class. This is the normal case. However, for performance reasons, the
user may not need DIM info for the returned MetaInfo items, and so can save time (and
memory) by setting the DIMInfoNeeded property to "false" before making the MetaActive
call. The only method calls affected by this property are:

ReadObject

ReadObjectVersion

GetClassObjectsByProperty

GetClassObjectVersionsByProperty

GetCollectionsByProperty

GetClassObjectsByRange

GetClassObjectVersionsByRange

GetCollectionsByProperty2

GetCollectionVersionsByProperty2

GetDormantClassObjects

ReadDormantObject

Syntax:
HRESULT put_DIMInfoNeeded(
[in] VARIANT_BOOL newVal);

get_DIMInfoNeeded
Purpose:

This call returns the current setting of the DIMInfoNeeded property.


Syntax:
HRESULT get_DIMInfoNeeded(
[out, retval] VARIANT_BOOL *pVal);

AddManyToCollection
Purpose:

Use this method to add a list of object keys to the object relationship.
Description:

This may require waiting for write locks held by other transactions to be release. The merge
argument indicates whether the specified object key list should be merged with the object
collection. If the merge argument is true (1), the MDS repository will ignore any object ids in
the list that are already in the object collection. If false, an error will be returned if the object
ids are already in the object collection.

Teradata Meta Data Services Programmer Guide

337

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Requirements:

The relationship identification must be set. The relationship identification can be a


relationship GUID or a relationship internal identifier. The relationship GUID is a string
representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT
[in]
[in]
[in]
[in]
[in]
[in,

AddManyToCollection(
CollectionType Direction,
long ObjectID,
BSTR RelationshipGUID,
long RelationshipID,
IMetaInfoKeyList *ObjectList,
optional] BOOL Merge);

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string () is entered, the relationship identifier is
required.

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

ObjectList

In

An MDS COM MetaInfoKeyList object that contains zero or


more MDS MetaInfoKey objects. The MetaInfoKey items need
only have their ObjectIDs set; the Name values if present, will be
ignored.

Merge

In

A flag to indicate how to add the object list. If true, the operation
will merge the object list with the object collection. If false, an
error will be returned if the object identifier is already in the
object collection.

AddManyToRelCollection
Purpose:

Use this method to add a list of object keys to the object relationship where an Explanation
property is to be attached to relationship associations.
Description:

This call is identical to the AddManyToCollection call, except that the ObjectList parameter is
of type IMetaRelationInfoKeyList. This list contains MetaRelationInfoKey objects, instead of
MetaInfoKey objects which the AddManyToCollection call uses. The MetaRelationInfoKey

338

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

object includes an Explanation property which can be used to set the "Explanation" for the
each of the objects in the association. If relationship associations do not have an Explanation
property attached (which is the normal case), use the AddManyToCollection call.
Requirements:

The relationship identification must be set. The relationship identification can be a


relationship GUID or a relationship internal identifier. The relationship GUID is a string
representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT
[in]
[in]
[in]
[in]
[in]
[in,

AddManyToRelCollection(
CollectionType Direction,
long ObjectID,
BSTR RelationshipGUID,
long RelationshipID,
IMetaRelationshipInfoKeyList *ObjectList,
optional] VARIANT_BOOL Merge);

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string () is entered, the relationship identifier is
required.

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

ObjectList

In

An MDS COM MetaRelationInfoKeyList object that contains zero


or more MDS MetaRelationInfoKey objects. The
MetaRelationInfoKey items need only have their ObjectIDs set;
the Name values if present, will be ignored.

Merge

In

A flag to indicate how to add the object list. If true, the operation
will merge the object list with the object collection. If false, an
error will be returned if the object identifier is already in the
object collection.

RemoveManyFromCollection
Purpose:

Use this method to remove a list of object keys to the object relationship.

Teradata Meta Data Services Programmer Guide

339

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

This may require waiting for write locks held by other transactions to be release. The merge
argument indicates whether the specified object key list should be removed from the object
collection. If the merge argument is true, the MDS repository will ignore any object ids in the
list that are not already in the object collection. If false, an error will be returned if the object
ids are not already in the object collection.
Requirements:

The relationship identification must be set. The relationship identification can be a


relationship GUID or a relationship internal identifier. The relationship GUID is a string
representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT
[in]
[in]
[in]
[in]
[in]
[in,

RemoveManyFromCollection(
CollectionType Direction,
long ObjectID,
BSTR RelationshipGUID,
long RelationshipID,
IMetaInfoKeyList *ObjectList,
optional] BOOL Merge);

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of


the GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

If the empty string () is entered, the relationship


identifier is required.

340

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

ObjectList

In

An MDS COM MetaInfoKeyList object that contains zero


or more MDS MetaInfoKey objects. (Note: the
MetaInfoKey items need only have their ObjectIDs set; the
Name values if present will be ignored.)

Merge

In

A flag to indicate how to handles the case when object IDs


present in the ObjectList input parameter are not found in
the repository collection. If Merge is true and the
ObjectList contains object IDs not found in the collection,
they are ignored. If Merge is false, and the ObjectList
contains object IDs not found in the collection, an error is
returned.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

RemoveAllFromCollection
Purpose:

Use this method to remove all the objects from a collection, as specified by the direction,
object ID and Relationship indicated.
Description:

Objects are removed from the collection, not the repository. That is, collections are the result
of relationships which indicate a mapping between two objects, one set from the "Origin"
class(es) and the other from the "Destination" class(es). (We say "classes" because due to
inheritance, more that one class may be part of the Origin or Destination set of classes.) So
this routine removes objects from the collection, which means deleting the mapping, but not
the objects themselves, from the repository.
The optional parameters "TargetClass" and "AllClasses" are used for collections that involve
inheritance.
This routine call ultimately calls CMetaObject:: RemoveAllFromOrigCollection2 and
RemoveAllFromDestCollection2 in the MDS C++ class library.
Requirements:

The relationship identification must be set. The relationship identification can be a


relationship GUID or a relationship internal identifier. The relationship GUID is a string
representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT
[in]
[in]
[in,
[in,
[in,
[in,

RemoveAllFromCollection(
CollectionType Direction,
long ObjID,
optional] BSTR RelGUID,
optional] long RelID, ,
defaultvalue(0)] long TargetClass,
defaultvalue(0)] VARIANT_BOOL AllClasses);

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}

If the empty string () is entered, the relationship identifier is


required.
RelationshipID

Teradata Meta Data Services Programmer Guide

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

341

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

TargetClass

In

If the AllClasses parameter is true, this parameter is ignored.


Else, if AllClasses if false, this parameter indicates which specific
class from which to remove the collection objects.
The default value is 0;

AllClasses

In

This is a VARIANT_BOOL where VARIANT_TRUE indicates


that if the relationship is inherited, all objects of the collection are
to be removed from all sub-classes; and VARIANT_FALSE
indicates that the TargetClass parameter is to be used to
determine which (single) class will be the object of the remove
request. (VARIANT_TRUE and VARIANT_FALSE are just True
and False in Visual Basic.)
The default value is VARIANT_FALSE.

ReplaceCollection
Purpose:

Use this method to replace a list of object keys of the object relationship. This may require
waiting for write locks held by other transactions to be release.
Description:

See CMetaObject::ReplaceXXXCollection for more detail.


Note: For Relationships inherited by sub-classes, target class-object collections will be
replaced only if they appear in the ObjectList. For example, if the ObjectList has objects from
two of three possible sub-classes inherited with the relationship, then only those two
collections will be replaced by this call (all current objects removed, being replaced by the
ones in the ObjectList), and whatever objects were in the third classs collection, will remain
the same.
Requirements:

The relationship identification must be set. The relationship identification can be a


relationship GUID or a relationship internal identifier. The relationship GUID is a string
representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT
[in]
[in]
[in]
[in]
[in]

342

ReplaceCollection(
CollectionType Direction,
long ObjectID,
BSTR RelationshipGUID,
long RelationshipID,
IMetaInfoKeyList *ObjectList);

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string () is entered, the relationship identifier is
required.

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

ObjectList

In

An MDS COM MetaInfoKeyList object that contains zero or


more MDS MetaInfoKey objects. The MetaInfoKey items need
only have their ObjectIDs set; the Name values if present, will be
ignored

ReplaceRelCollection
Purpose:

Use this method to replace a list of object keys of the object relationship. This may require
waiting for write locks held by other transactions to be release.
Description:

Identical to the ReplaceCollection call, except that the ObjectList parameter is of type
IMetaRelationInfoKeyList. This list contains MetaRelationInfoKey objects, instead of
MetaInfoKey objects which the ReplaceCollection call uses. The MetaRelationInfoKey object
includes an Explanation property which can be used to set the Explanation for the each of the
objects in the association. If not attaching an Explanation to the relationship associations
(which would be the normal case), use the ReplaceCollection call.
Requirements:

The relationship identification must be set. The relationship identification can be a


relationship GUID or a relationship internal identifier. The relationship GUID is a string
representation of the GUID format (i.e., {8CAF7740-EECD-11d3-9D01-00902781A33F}).
Syntax:
HRESULT
[in]
[in]
[in]
[in,
[in]

ReplaceRelCollection(
CollectionType Direction,
long ObjectID,
BSTR RelationshipGUID,
optional, defaultvalue(0)] long RelationshipID,
IMetaRelationInfoKeyList *ObjectList);

Teradata Meta Data Services Programmer Guide

343

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is:
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string () is entered, the relationship identifier is
required.

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

ObjectList

In

An MDS COM MetaRelationInfoKeyList object that contains zero


or more MDS MetaInfoKey objects. The MetaRelationInfoKey
items need only have their ObjectIDs set; the Name values if
present, will be ignored

GetBIZObjectsByRange
Purpose:

This routine returns business-related properties from the business classes, based on the
requested filter list. The Start and RequestCount parameters can be used to request a specific
range of the total result to be returned.
The following business classes and properties are included in the search:

344

Class

Properties

Table

Name, Description, CommentString

View

Name, Description, CommentString

Column

Name, Description, CommentString

ViewColumn

Name, Description, CommentString

Subject Area

Name, Description, BusinessDefinition

BusinessEntity

Name, Description, BusinessDefinition, BusinessNotes

BusinessAttribute

Name, Description, BusinessDefinition, BusinessNotes

BusinessRule

Name, Description, RuleDefinition

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

This routine is the only way that MetaBIZInfoList can be created. This routine ultimately calls
CMetaBIZObject::GetBIZObjectsByRange in the MDS C++ class library.
Requirements:

Although the Filters parameter shows as optional, the engine will return a "missing required
parameter" if one is not set.
Syntax:
HRESULT GetBIZObjectsByRange(
[in] int Start,
[in] int RequestCount,
[in] MetaSortType SortType,
[out] VARIANT *ReturnCount,
[in] IMetaFilterList *Filters,
[in, optional] BSTR Label,
[out, retval] IMetaBIZInfoList **BIZInfoList);

Argument

In/Out

Description

Start

In

Used to specify the start record of the result set.

RequestCount

In

Used to specify the total number of rows to return for this call.

SortType

In

This is of type MetaSortType (mdsALPHA, mdsWEIGHTED).


Use mdsALPHA to specify that the rows returned are sorted
alphabetically
Use mdsWEIGHTED to specify that the rows returned are in an
order based on how well the filter (below) matched the various
BIZ property attributes.

ReturnCount

Out

The total number of matches (rows) produced by the query.

Filters

In

A single filter indicating what value to search on. (This shows as


"optional" but actually the engine requires one to be set.)

Label

In

Optional. A label that is used as an additional filter in the search.


It is ANDed with the filter in the Filters parameter. This
parameter makes sense to use only when the repository is
versioned.

BIZInfoList

Retval

The rows returned by the query in the form of IMetaBIZInfo


interface objects in this BIZInfoList

GetBIZObjectVersionsByRange
Purpose:

Returns all versions of each object.


Description:

This routine is identical to the GetBIZObjectsByRange except that all versions of each object
are returned, not just the "Current" (or Published) version. What this means is that, unlike the

Teradata Meta Data Services Programmer Guide

345

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

GetBIZObjectsByRange call, if a label is specified in the Label parameter, it does not have to be
applied to the Current version of an object for that version of the object to be returned.
This routine makes sense to use only in versioned repositories; for non-versioned repositories,
use the GetBIZObjectsByRange call described above.
Syntax:
HRESULT GetBIZObjectVersionsByRange(
[in] int Start,
[in] int RequestCount,
[in] MetaSortType SortType,
[out] VARIANT *ReturnCount,
[in] IMetaFilterList *Filters,
[in, optional] BSTR Label,
[out, retval] IMetaBIZInfoList **BIZInfoList);

GetCollectionKeysByProperty
Purpose:

This routine is used to search the repository for the origin or destination collection of the
relationship of the object.
Description:

The search can be for repository objects of a given name (if desired), and/or using a filter list.
(The "origin or destination" is given by the Direction parameter, the "relationship" is given by
either the RelationshipGUID or RelationshipID parameter, the "object" itself is identified by
the ObjectID parameter, the "name" is given by the Name parameter and the "filter list" is
given by the Filters parameter.)
The caller can also specify the class ID of a particular class to search (the ReturnClass
parameter), or that all classes are to be searched (the AllClasses parameter). These two
parameters are useful for searches of relationships that have been inherited by the given object,
and can therefor include many classes in the resulting collection.
The user can also ask that the MDS engine check to see that the object ID is in the proper
origin or destination class for the given Destination and Relationship. Set the SkipValidation
parameter to false if this check is desired. If validation is not preformed (SkipValidation is
true), and this step would have returned an error, the call will simply return S_OK and have 0
objects in the InfoKeyList collection.
What is returned is a collection of IMetaInfoClassKey interface objects, which contain the
"keys", i.e. object IDs and Names, of all the items found in the repository for the collection,
which also match any filters given.
This routine ultimately calls CMetaObject::GetOrigCollectionKeys3 or
CMetaObject::GetDestCollectionKeys3 in the C++ class library.
Syntax:
HRESULT
[in]
[in]
[in,

346

GetCollectionKeysByProperty(
CollectionType Direction,
long ObjectID,
optional] BSTR RelationshipGUID,

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
[in, optional] long RelationshipID,
[in, optional] BSTR Name,
[in, optional] IMetaFilterList *Filters,
[in, defaultvalue(0)] long ReturnClass,
[in, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[out, retval] IMetaInfoClassKeyList **InfoClassKeyList);

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string ("") is entered, the relationship identifier is
required.

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

Name

In

If not empty, only return the objects found in the collection


whose name matches the string pattern in this parameter. If
empty, return all objects found in the collection with any name.
In either case, the caller can still specify other filters in the Filters
parameter below.

Filters

In

Filter objects are contained in this collection object (which can be


empty), and are used in the "WHERE" clause of the SQL
statement used for the query.

ReturnClass

In

If the AllClasses parameter is true, this parameter is ignored, else


if
ReturnClass = 0 -- specifies to search in the origin/destination
class defined in the relationship; else if
ReturnClass = classID -- if the Relationship was inherited from a
super class, this class ID specifies one of the super- or sub-classes
from that relationship hierarchy. (If the class ID is not in the
inheritance hierarchy, an error will be returned.)

AllClasses

In

Set to VARIANT_TRUE to search all classes found in the


inheritance hierarchy or if there are no super classes, search the
appropriate origin or destination class.
Set to VARIANT_FALSE to use the value specified in the
ReturnClass parameter. (VB uses True and False for
VARIANT_TRUE and VARIANT_FALSE.)

Teradata Meta Data Services Programmer Guide

347

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

SkipValidation

In

VARIANT_TRUE to skip any object ID validation; set to


VARIANT_FALSE to request object ID validation based on
Direction and Relationship. (VB uses True and False for
VARIANT_TRUE and VARIANT_FALSE.)

InfoClassKeyList

Retval

The list of objects returned in a collection of IMetaInfoKey


interface objects that contain their object IDs and Names, and the
class ID and class name for each.

GetCollectionVersionKeysByProperty
Purpose:

This routine is used to search the repository for the origin or destination collection of the
relationship of the object.
Description:

Identical to the GetCollectionKeysByProperty routine except for the addition of the optional
LabelName parameter.
For repositories with versioning enabled, returns the collection keys for the object (given by
ObjectID and relationship identification) whose versions match the filter, unless a label is
supplied. If a label is specified by the LabelName parameter, it acts as an additional filter
returning only those object versions that also have the label attached to them.
Syntax:
HRESULT GetCollectionVersionKeysByProperty(
[in] CollectionType Direction,
[in] long ObjectID,
[in, optional] BSTR RelationshipGUID,
[in, optional] long RelationshipID,
[in, optional] BSTR Name,
[in, optional] BSTR LabelName,
[in, optional] IMetaFilterList *Filters,
[in, defaultvalue(0)] long ReturnClass,
[in, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[out, retval] IMetaVersionedInfoKeyList **keyList);

GetCollectionVersionRelKeys
Purpose:

Use this routine to search the repository for the origin or destination collection of the
relationship object if the Explanation property is attached to some or all of the relationship
pairs.
Description:

Identical to the GetCollectionVersionKeysByProperty method of the MetaActive class


interface, except that the key-list which returned is of type IMetaVersionedInfoRelKeyList.

348

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

This list contains MetaVersionedInfoRelKey objects. The objects are the same as
MetaVersionedInfoClassKey objects (which are returned in the list from the
GetCollectionVersionKeysbyProperty call), with the addition of the Explanation property.
If the associated relation pairs do not have an Explanation property attached (the usual case),
use the GetCollectionVersionKeysByProperty call.
Syntax:
HRESULT GetCollectionVersionRelKeys(
[in] CollectionType Direction,
[in] long ObjectID,
[in, optional] BSTR RelationshipGUID,
[in, optional] long RelationshipID,
[in, optional] BSTR Name,
[in, optional] BSTR LabelName,
[in, optional] IMetaFilterList *Filters,
[in, defaultvalue(0)] long ReturnClass,
[in, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[out, retval] IMetaVersionedInfoRelKeyList **keyList);

GetCollectionsByProperty2
Purpose:

This routine is used to search the repository for the origin or destination collection of the
relationship of the object.
Description:

This routine is effectively the same as GetCollectionsByProperty with parameters added to


indicate the need to return objects in inherited classes. These inheritance-related parameters
are ReturnClass, AllClasses and SkipValidation. They are listed in the table below and work
effectively the same as those in the GetCollectionKeysByProperty call described above.
If the Interface has the DIMInfoNeeded property set to True, the MetaInfo objects in the
returned collection will have their DIMInfo filled in, else they will not.
This routine ultimately calls CMetaDIMObject:: GetOrigCollection3 or CMetaDIMObject::
GetDestCollection3 if DIMInfoNeeded is true; or CMetaObject:: GetOrigCollection3 or
CMetaObject:: GetDestCollection3 if it is false.
Syntax:
HRESULT GetCollectionsByProperty2(
[in] CollectionType Direction,
[in] long ObjectID,
[in, optional] BSTR RelationshipGUID,
[in, optional] long RelationshipID,
[in, optional] BSTR NamePattern,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[in, defaultvalue(0)] long ReturnClass,
[in, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[out, retval] IMetaInfoList **InfoList);

Teradata Meta Data Services Programmer Guide

349

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Argument

In/Out

Description

Direction

In

An enumeration type that specifies the direction of the


relationship.
typedef enum {DESTINATION, ORIGIN} CollectionType;

ObjectID

In

The object identifier of the object.

RelationshipGUID

In

The string GUID of the relationship. The string format of the


GUID is
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
If the empty string ("") is entered, the relationship identifier is
required.

RelationshipID

In

The internal object identifier of the relationship. If the


relationship object identifier is 0, the string GUID of the
relationship is required.

NamePattern

In

If not empty, only return the objects found in the collection


whose name matches the string pattern in this parameter. If
empty, return all objects found in the collection with any name.
In either case, the caller can still specify other filters in the Filters
parameter below

Filters

In

Filter objects are contained in this collection object (which can be


empty), and are used in the "WHERE" clause of the SQL
statement used for the query.

SortKeys

In

A collection of IMetaInfoKey objects, which have a property ID or


Name on which to sort the returned collection.

ReturnClass

In

If the AllClasses parameter is true, this parameter is ignored, else


if
ReturnClass = 0 -- specifies to search in the origin/destination
class defined in the relationship; else if
ReturnClass = classID -- if the Relationship was inherited from a
super class, this class ID specifies one of the super- or sub-classes
from that relationship hierarchy. (If the class ID is not in the
inheritance hierarchy, an error will be returned.)

AllClasses

In

Set to VARIANT_TRUE to search all classes found in the


inheritance hierarchy or if there are no super classes, search the
appropriate origin or destination class.
Set to VARIANT_FALSE to use the value specified in the
ReturnClass parameter. (VB uses True and False for
VARIANT_TRUE and VARIANT_FALSE.)

350

SkipValidation

In

VARIANT_TRUE to skip any object ID validation; set to


VARIANT_FALSE to request object ID validation based on
Direction and Relationship. (VB uses True and False for
VARIANT_TRUE and VARIANT_FALSE.)

InfoKeyList

Retval

The list of objects returned in a collection of IMetaInfoKey


interface objects that contain their object IDs and Names.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

GetCollectionsByProperty3
Purpose:

This routine is used to search the repository for the origin or destination collection of the
relationship of the object.
Description:

This routine is effectively the same as GetCollectionsByProperty2 except that the


ColumnFilter parameter allows the caller to specify which properties are to be returned by the
implementation.
Refer to ColumnFilter on page 313 for additional information
Note: If there are subclasses in the collection, the PIDs specified in the ColumnFilter must
exist in all those classes. Effectively this means that the PIDs must be from the top-most class.
The engine will return a property-not-found error otherwise.
Syntax:
HRESULT GetCollectionsByProperty3(
[in] CollectionType Direction,
[in] long ObjectID,
[in, optional] BSTR RelationshipGUID,
[in, optional] long RelationshipID,
[in, optional] BSTR NamePattern,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[in, optional] IMetaInfoKeyList *ColumnFilter,
[in, defaultvalue(0)] long ReturnClass,
[in, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[out, retval] IMetaInfoList **InfoList);

GetDormantCollectionKeys
Purpose:

Use this method to search for objects with their publish state set to mdsDormant in the
specified class.
Description:

This routine is identical to GetCollectionKeysByProperty routine, except that the


InfoClassKeyList which is returned has only the dormant object-keys of the specified
collection for the object, limited by the filters and inheritance information parameters, if
present.
The calling object may be dormant or active.
This routine can only be called by an administrative user.
Syntax:
HRESULT
[in]
[in]
[in,

GetDormantCollectionKeys(
CollectionType Direction,
long ObjectID,
optional] BSTR RelationshipGUID,

Teradata Meta Data Services Programmer Guide

351

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
[in, optional, defaultvalue(0)] long RelationshipID,
[in, optional] BSTR Name,
[in, optional] IMetaFilterList *Filters,
[in, optional, defaultvalue(0)] long ReturnClass,
[in, optional, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, optional, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[out, retval] IMetaInfoClassKeyList **InfoClassKeyList);

GetDormantCollectionObjects
Purpose:

This routine is used to search the repository for dormant objects in the collection specified for
the object.
Description:

This routine is identical to the GetCollectionsByProperty2 routine, except that the InfoList
which is returned has only the dormant objects of the specified collection for the object,
limited by the filters and inheritance information parameters, if present.
If the Interface has the DIMInfoNeeded property set to True, the MetaInfo objects in the
returned collection will have their DIMInfo filled in, else they will not.
The calling object may be dormant or active.
This routine may only be called by an administrative user.
Syntax:
HRESULT GetDormantCollectionObjects(
[in] CollectionType Direction,
[in] long ObjectID,
[in, optional] BSTR RelationshipGUID,
[in, optional, defaultvalue(0)] long RelationshipID,
[in, optional] BSTR NamePattern,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[in, optional, defaultvalue(0)] long ReturnClass,
[in, optional, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, optional, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[out, retval] IMetaInfoList **InfoList);

GetCollectionVersionsByProperty2
Purpose:

This routine is used to search the repository for the origin or destination collection of the
relationship of the object.
Description:

Identical to the GetCollectionsByProperty2 routine except for the addition of the LabelName
parameter. In repositories with versioning enabled, it returns the collection class associated
with a version of this object (given by ObjectID) for the specified relationship, which match
the selection criteria, unless a label is specified. If a label is specified with the LabelName
parameter, then it acts as an additional filter.

352

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax:
GetCollectionVersionsByProperty2(
[in] CollectionType Direction,
[in] long ObjectID,
[in, optional] BSTR RelationshipGUID,
[in, optional] long RelationshipID,
[in, optional] BSTR NamePattern,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[in, optional, defaultvalue(0)] long ReturnClass,
[in, optional, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, optional, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[in, optional] BSTR Label,
[out, retval] IMetaInfoList **InfoList);

GetCollectionVersionsByProperty3
Purpose:

This routine is used to search the repository for the origin or destination collection of the
relationship of the object.
Description:

Identical to the GetCollectionVersionsByProperty2 routine except that the ColumnFilter


parameter allows the caller to specify which properties are to be returned by the
implementation.
Refer to ColumnFilter on page 313 for additional information
Note: If there are subclasses in the collection, the PIDs specified in the ColumnFilter must
exist in all those classes. Effectively this means that the PIDs must be from the top-most class.
The engine will return a property-not-found error otherwise.
Syntax:
GetCollectionVersionsByProperty3(
[in] CollectionType Direction,
[in] long ObjectID,
[in, optional] BSTR RelationshipGUID,
[in, optional] long RelationshipID,
[in, optional] BSTR NamePattern,
[in, optional] IMetaFilterList *Filters,
[in, optional] IMetaInfoKeyList *SortKeys,
[in, optional] IMetaInfoKeyList *ColumnFilter,
[in, optional, defaultvalue(0)] long ReturnClass,
[in, optional, defaultvalue(0)] VARIANT_BOOL AllClasses,
[in, optional, defaultvalue(0)] VARIANT_BOOL SkipValidation,
[in, optional] BSTR Label,
[out, retval] IMetaInfoList **InfoList);

GetRelationExplanation
Purpose:

Use this method to return the Explanation property for a particular pair of associated objects.

Teradata Meta Data Services Programmer Guide

353

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

The GetRelationExplanation call returns the Explanation for the object-association given by
the OrigID and DestID pair, for the indicated Relationship, identified by the Relationship
GUID or ID.
Requirements:

The object association must already exist. Therefore, the DestID object must already be in the
destination collection of the OrigID object for the relationship.
Syntax:
HRESULT GetRelationExplanation(
[in] long OrigID,
[in] long DestID,
[in] BSTR RelationshipGUID,
[in, optional] long RelationshipID,
[out, retval] BSTR *Explanation);

Argument

In/Out

Description

OrigID

In

The object ID of the origin object of the pair.

DestID

In

The object ID of the destination object of the pair

SetRelationExplanation
Purpose:

Use this method to set the Explanation property for a particular pair of associated objects.
Description:

The SetRelationExplanation call sets the Explanation for the object-association given by the
OrigID and DestID pair, for the indicated Relationship, identified by the Relationship GUID
or ID.
Requirements:

The object association must already exist. Therefore, the DestID object must already be in the
destination collection of the OrigID object for the relationship.
Syntax:
HRESULT
[in]
[in]
[in]
[in,
[in]

354

SetRelationExplanation(
long OrigID,
long DestID,
BSTR RelationshipGUID,
optional] long RelationshipID,
BSTR Explanation);

Argument

In/Out

Description

OrigID

In

The object ID of the origin object of the pair

DestID

In

The object ID of the destination object of the pair

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

BeginTransaction
Purpose:

Use this method to start an explicit MDS transaction.


Syntax:
HRESULT BeginTransaction();

RollbackTransaction
Purpose:

Use this method to rollback the explicit MDS transaction.


Syntax:
HRESULT RollbackTransaction();

CommitTransaction
Purpose:

Use this method to commit the explicit MDS transaction.


Syntax:
HRESULT CommitTransaction();

GetMDSUsers
Purpose:

Use this method to return a collection of all the users currently in the MDS repository, as
IMetaUserInfo objects.
Syntax:
HRESULT GetMDSUsers(
[out, retval] IMetaUserInfoList ** UserList);

put_MDSCaller
Purpose:

Use this method to set the MDSCaller for the MetaActive object.
Description

This can be used to specify a specific MDS user for the object which will then be used for all
subsequent calls from the object, including the SignOff call. This allows for MetaActive objects
to be used for repository access, which are different from the object where the original sign-on
occurred. Note that this is not needed for a single-user MDS application, since only one MDS
user is signed on the Repository, and the MDS engine is aware of who that user is (the one
specified at SignOn or Initialize).
This property is only useful for a multi-user (and possibly multi-threaded) MDS application.
Syntax:
HRESULT put_MDSCaller(

Teradata Meta Data Services Programmer Guide

355

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
[in] BSTR MDSCallerName);

get_MDSCaller
Purpose:

Use this method to get the MDSCaller for the MetaActive object.
Description

This can be used to specify a specific MDS user for the object which will then be used for all
subsequent calls from the object, including the SignOff call. This allows for MetaActive objects
to be used for repository access, which are different from the object where the original sign-on
occurred. Note that this is not needed for a single-user MDS application, since only one MDS
user is signed on the Repository, and the MDS engine is aware of who that user is (the one
specified at SignOn or Initialize).
This property is only useful for a multi-user (and possibly multi-threaded) MDS application.
Syntax:
HRESULT get_MDSCaller(
([out, retval] BSTR* MDSCallerName);

SuperUserLogon
Purpose:

Use this method to determine if the MDS user specified in the UserName parameter is an
MDS super-user.
Description

This method returns VARIANT_TRUE (true) if the user named in UserName is an MDS
super-user (administrator), else it returns VARIANT_FALSE (false).
Requirements:

The User identified in UserName must be currently logged in from the running process, else
the return will be VARIANT_FALSE in all cases.
Syntax:
HRESULT SuperUserLogon([in] BSTR UserName,
[out, retval] VARIANT_BOOL *pVal);

EnableRetainBIZInfo
Purpose:

Use this method to set the value of the retain-business-objects feature for the repository.
Description:

When this feature is enabled, objects in the appropriate DIM classes, which have business
information associated with them, are *not* removed from the repository when they are
deleted, they are instead marked with a publish state of "dormant".
These dormant objects can later be returned to the "active" state if the DIM objects they were
previously associated with are re-loaded back into the appropriate DIM class, with their
356

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

(previous) business information re-associated with them. With the feature enabled, this
behavior is automatically done by the MDS engine. These types of objects are not normally
accessible but can be managed by the various calls for dormant objects from this interface.
There is no effect if the method is called with Enable set to "true" and the feature is currently
enabled, or with Enabled set to "false" and the feature is currently disabled.
When called with Enabled set to "false", not only will the feature be disabled, but *all* objects
currently in the "dormant" state, if any, will finally be removed from the repository. This
amounts to a final clean-up from the previous delete of these objects.
Syntax:
HRESULT EnableRetainBIZInfo(
[in, defaultvalue(VARIANT_TRUE)] VARIANT_BOOL Enable);

UsingRetainBIZInfo
Purpose:

This routine returns the current repository setting for the support of the retain-businessobjects feature: VARIANT_TRUE (true) if the repository supports the feature, and
VARIANT_FALSE (false) if not.
Syntax:
HRESULT UsingRetainBIZInfo(
[out, retval] VARIANT_BOOL* value);

Common Properties
The following attributes and functions are supported by the MetaInfo, MetaLabelInfo, and
COM AIM classes. Additional versioning properties are supported by the IMetaInfo and
IMetaBIZInfo interfaces.
Property

Type

Description

ObjectID

Long

The object identifier ("internal" object ID).

Name

BSTR

The object name.

Description

BSTR

The object description.

CreateDate

DATE

The date and time when the object was created (read only).

UpdateDate

DATE

The data and time when the object was updated (read only).

Class

BSTR

The class name of the object.

Owner

BSTR

The name of the owner who owns this object.

OwnerID

Long

The ID of the owner for this object.

ClassGUID

BSTR

The string GUID of the class (global class ID).

ObjectGUID

BSTR

The string GUID of the object (global object ID).

Teradata Meta Data Services Programmer Guide

357

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Property

Type

Description

ClassID

Long

The class identifier (internal class ID).

SecurityProfileID

Long

The ID of the Security Profile for this object.

get_ObjectID
Purpose:

Gets the object ID.


Syntax:
HRESULT get_ObjectID(long *pVal)

put_ObjectID
Purpose:

Sets the object ID.


Syntax:
HRESULT put_ObjectID(long newVal);

get_Name
Purpose:

Gets the object name.


Syntax:
HRESULT get_Name(BSTR *pVal);

put_Name
Purpose:

Sets the object name.


Syntax:
HRESULT put_Name(BSTR newVal);

get_Description
Purpose:

Gets the object description.


Syntax:
HRESULT get_Description(BSTR *pVal);

put_Description
Purpose:

Sets the object description.

358

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax:
HRESULT put_Description(BSTR newVal);

get_CreateDate
Purpose:

Gets the object creation date.


Syntax:
HRESULT get_CreateDate(DATE *pVal);

get_UpdateDate
Purpose:

Gets the date of the last update to the object.


Syntax:
HRESULT get_UpdateDate(DATE *pVal);

get_Class
Purpose:

Gets the objects class name.


Syntax:
HRESULT get_Class(BSTR *pVal);

put_Class
Purpose:

Sets the objects class name.


Syntax:
HRESULT put_Class(BSTR newVal);

get_Owner
Purpose:

Gets the name of the owner of the object.


Syntax:
HRESULT get_Owner(BSTR *pVal);

put_Owner
Purpose:

Sets ownername.
Syntax:
HRESULT put_Owner(BSTR newVal);

Teradata Meta Data Services Programmer Guide

359

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

get_ClassGUID
Purpose:

Gets the object class GUID


Syntax:
HRESULT get_ClassGUID(BSTR *pVal);

put_ClassGUID
Purpose:

Sets the object class GUID


Syntax:
HRESULT put_ClassGUID(BSTR newVal);

get_ObjectGUID
Purpose:

Gets the object GUID


Syntax:
HRESULT get_ObjectGUID(BSTR *pVal);

put_ObjectGUID
Purpose:

Sets the object GUID


Syntax:
HRESULT put_ObjectGUID(BSTR *newVal);

get_ClassID
Purpose:

Gets the object class ID.


Syntax:
HRESULT get_ClassID(long *pVal);

put_ClassID
Purpose:

Gets the object class ID.


Syntax:
HRESULT put_ClassID(long newVal);

get_SecurityProfileID
Purpose:

Gets the object security profile ID.


360

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax:
HRESULT get_SecurityProfileID(LONG *pVal);

put_SecurityProfileID
Purpose:

Sets the object security profile ID.


Syntax:
HRESULT put_SecurityProfileID(LONG newVal);

MetaInfo Class
The IMetaInfo interface contains the basic functions of the CMetaObject and
CMetaRepository classes and additional enhanced properties.
Property

Type

Common
Properties

Description
See Common Properties.

PropertyItems

IMetaPropertyItemList

An interface to a list of property items of


the object.

DIMInfo

IMetaDIMInfo

An interface to the DIM information.

PublishState

MetaPublishState

The publish-state of the object


(mds_psCurrent, mds_psDeleted or
mds_psInactive) Read only.

VersionNumber

long

The version of the object. Read only.

get_PropertyItems
Purpose:

Gets or sets the object properties list.


Syntax:
HRESULT get_PropertyItems(
[out, retval] IMetaPropertyItemList **pVal);

put_PropertyItems
Purpose:

Sets the object properties list.


Syntax:
HRESULT put_PropertyItems(
[in] IMetaPropertyItemList* newVal);

Teradata Meta Data Services Programmer Guide

361

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

get_DIMInfo
Purpose:

Gets or sets a pointer to the DIMInfo object for this MetaInfo object.
Syntax:
HRESULT get_DIMInfo(
[out, retval] IMetaDIMInfo* *pVal);

put_DIMInfo
Purpose:

Sets the DIM attributes in the object.


Syntax:
HRESULT put_DIMInfo(
[in] IMetaDIMInfo* newVal);

get_PublishState
Purpose:

Returns the PublishState of the object. The MetaPublishState enumeration has four values:
mds_psCurrent (2), which means this is the currently active or published version -- it is the
latest version and may be modified; mds_psInactive (1), which means this version is frozen
and may not be modified (typically any version other than the published or current
version); and mds_psDeleted (0), which means this version has been deleted but not removed
from the repository; and mdsDormant (-1) which means the object is in the dormant state.
Syntax:
HRESULT get_PublishState(
[out, retval] MetaPublishState* state);

get_VersionNumber
Purpose:

Returns the version number of the object.


Syntax:
HRESULT get_VersionNumber(
[out, retval] long* version);

get_Frozen
Purpose:

This property returns the frozen state of the object. If an object is frozen it cannot be modified.
The current or active version of the object can also be frozen in some cases. An object version
that is inactive will always be frozen.
Syntax:
HRESULT get_Frozen(
[out, retval] VARIANT_BOOL* pVal);

362

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

GetObjectVersionKeys
Purpose:

Returns the versioned-key list for all versions of the object.


Syntax:
HRESULT GetObjectVersionKeys(
[out, retval] IMetaVersionedInfoKeyList** keyList);

GetObjectVersions
Purpose:

Returns all the versions of the object in the InfoList return parameter.
Description:

No DIM information will be returned with the objects so fields of the IMetaDIMInfo object
returned by the DIMInfo property will all be empty. It is not necessary to "Read" the object
before this call is made. You can use *any* object ID of the various versions of the object, as
they will all return the same list of objects namely, those of all the versions.
Syntax:
HRESULT GetObjectVersions(
[out, retval] IMetaInfoList** InfoList);

FindLabel
Purpose:

This routine returns the key for the version of the object that has the specified label. If none of
the versions of the object have the label, the status META_E_LABEL_NOT_USED will be
returned.
Syntax:
HRESULT FindLabel(
[in] BSTR LabelName,
[out, retval] IMetaVersionedInfoKey** key);

GetObjectPropertyKeys
Purpose:

Returns a list of versioned-object keys that match the value of the property named in the
IMetaPropertyItem interface object.
Description:

If the property value is a string, a substring search is performed; for all other types of property
values, an equality search is made. The LabelName, if provided, is used as a filter on the
keyList in that only those object versions that match the property value and have the label
applied will be returned.
Requirements:

The IMetaPropertyItem's Name and Value must be set.

Teradata Meta Data Services Programmer Guide

363

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax:
HRESULT GetObjectPropertyKeys(
[in] IMetaPropertyItem* propItem,
[in, optional] BSTR LabelName,
[out, retval] IMetaVersionedInfoKeyList** keyList);

GetObjectLabelKeys
Purpose:

Returns a list of the labels currently applied to the versions of the CMetaObject.
Description:

Each entry in the keyList vector is an IMetaLabeledInfoKey object, which will provide the
name of a label and a key for the object version having that label. Only versions of the object
that have a label applied will be in the key list.
Syntax:
HRESULT GetObjectLabelKeys(
[out, retval] IMetaLabelInfoKeyList** keyList);

MetaInfoKey Class
The IMetaInfoKey interface is returned from the MetaActive GetClassObjectKeys and
GetCollectionKeys functions. It is also used as input for some object ID collections (vectors),
e.g., for the IMetaSecProfInfo:SetAIMsProfile's AIMList parameter. This parameter is an
IMetaInfoKeyList where the key-list's MetaInfoKey interfaces contain the object IDs of the
AIM profiles to be changed.
Property

Type

Description

ObjectID

Long

The object identifier.

Name

BSTR

The object name.

get_ObjectID
Purpose:

Gets the object ID.


Syntax:
HRESULT get_ObjectID(Long *pVal);

put_ObjectID
Purpose:

Sets the object ID in the key.


Syntax:
HRESULT put_ObjectID(long newVal);

364

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

get_Name
Purpose:

Gets the object name.


Syntax:
HRESULT get_Name(BSTR *pVal);

put_Name
Purpose:

Sets the object name in the key.


Syntax:
HRESULT put_Name(BSTR newVal);

MetaVersionedInfoKey Class
The MetaVersionedInfoKey class inherits all the properties from the IMetaInfoKey interface
and adds versioning information.
get_ObjectID
Purpose:

Gets the object ID.


Syntax:
HRESULT get_ObjectID(Long *pVal);

get_Name
Purpose:

Gets the object name.


Syntax:
HRESULT get_Name(BSTR *pVal);

get_VersionNumber
Purpose:

Returns the Version number of the object.


Syntax:
HRESULT get_VersionNumber(
[out, retval] long* version);

get_PublishState
Purpose:

Returns the Publish state of the object. See the MetaInfo Class on page 361 for information
on the MetaPublishState enumeration.

Teradata Meta Data Services Programmer Guide

365

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax:
get_PublishState(
[out, retval] MetaPublishState* state);

get_Publish
Purpose:

Returns VARIANT_TRUE if this version of the object if published, else returns


VARIANT_FALSE
Syntax:
get_Published(
[out, retval] VARIANT_BOOL* published);

get_Dormant
Purpose:

Returns VARIANT_TRUE if the objects PublishState is mdsDormant.


Syntax:
get_Dormant(
[out, retval] VARIANT_BOOL* pVal);

get_Frozen
Purpose:

Returns VARIANT_TRUE if the object is frozen.


Syntax:
get_Frozen(
[out, retval] VARIANT_BOOL* published);

MetaPropertyItem Class
The IMetaPropertyItem interface contains the basic functionality of the CMetaPropertyDesc
class. The main difference is that instead of many, different "Set" functions for the many
different data types possible, this uses a "Value" property of type VARIANT to cover all
different types except string. The string type is covered by the ValueString and StringLiteral
properties.

366

Property

Type

Description

PropertyID

Long

The property ID.

Name

BSTR

The property name.

ValueString

BSTR

The value of a binary property is returned as a hex string.


(Read only.)

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

Property

Type

Description

StringLiteral

BSTR

The value of the property when it is a string and it is to be


sent to Teradata "as is", that is, not quoted in the SQL
statement. For example, the Teradata keyword "date"
should be set using this property. If you were to use the
Value property (using VT_BSTR), it would be quoted and
the string "date" will appear as the value, not an actual
date.

Value

VARIANT

The value of the property. Should be used for all property


types other than string. The MDS engine will figure out
the type based on the defined property type.

Variant Type

VariantType

Returns the VARIANT type of the property. (Read only.)

get_PropertyID
Purpose:

Gets the relative property ID.


Syntax:
HRESULT get_PropertyID(
[out, retval] long *pVal);

put_PropertyID
Purpose:

Sets the relative property ID.


Syntax:
HRESULT put_PropertyID(
[in] long newVal);

get_Name
Purpose:

Gets the property name.


Syntax:
HRESULT get_Name(
[out, retval] BSTR *pVal);

put_Name
Purpose:

Sets the property name.


Syntax:
HRESULT put_Name(
[in] BSTR newVal);

Teradata Meta Data Services Programmer Guide

367

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

get_ValueString
Purpose:

Returns a hex string representation of a binary property value. For example, a property of type
SQL_BYTE with a value of 0x1003ABDF would be returned by this call as the string
1003ABDF
Syntax:
HRESULT get_ValueString(
[out, retval] BSTR *pVal);

get_Value
Purpose:

Gets the property value.


Syntax:
HRESULT get_Value(
[out, retval] VARIANT *pVal);

put_Value
Purpose:

Sets the property value.


Syntax:
HRESULT put_Value(
[in] VARIANT newVal);

get_IsNull
Purpose:

Gets the IsNull property for the property item, which is a direct reflection of the NULL value
of the column in the database true if the property value is NULL, false if it is not. (Each
property of a class translates to a column for the table that represents that class.)
Syntax:
HRESULT get_IsNull(
[out, retval] VARIANT_BOOL *pVal);

put_IsNull
Purpose:

Sets the IsNull property for the property item, which is a direct reflection of the NULL value of
the column in the database true if the property value is NULL, false if it is not. (Each property
of a class translates to a column for the table that represents that class.)
Syntax:
HRESULT put_IsNull(
[in] VARIANT_BOOL newVal);

368

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

put_StringLiteral
Purpose:

Sets the value as a string "literal", indicating to the MDS engine not to quote this string when it
is sent to Teradata.
Syntax:
HRESULT put_StringLiteral(
[in] BSTR newVal);

get_VariantType
Purpose:

Returns the VARIANT type of the property. SeeAIM Classes on page 381 for VariantType
enumeration values.
Syntax:
HRESULT get_VariantType(
[out, retval] VariantType *pVal);

MetaDIMInfo Class
The IMetaDIMInfo interface contains the basic DIM properties of the CMetaDIMObject
class.
This class is not user-creatable. It can only be created by a call to the DIMInfo property of the
MetaInfo class.
Property

Type

Description

System

BSTR

The name of the system.

Database

BSTR

The name of the database.

Table

BSTR

The name of the table.

Owner

BSTR

The name of the owner.

SecurityProfileID

Long

The ID of the Security Profile for the object.

get_SecurityProfileID
Purpose:

Gets the objects security profile ID.


Syntax:
HRESULT get_ SecurityProfileID(
[out, retval] long *pVal);

Teradata Meta Data Services Programmer Guide

369

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

put_SecurityProfileD
Purpose:

Sets the objects security profile ID.


Syntax:
HRESULT put_ SecurityProfileID(
[in] long newVal);

get_Owner
Purpose:

Gets the Objects Owner name.


Syntax:
HRESULT get_Owner(
[out, retval] BSTR *pVal);

put_Owner
Purpose:

Sets the Objects Owner name.


Syntax:
HRESULT put_Owner([in] BSTR newVal);

get_Table
Purpose:

Gets the name of the Table to which this object belongs, if applicable.
Syntax:
HRESULT get_Table(
[out, retval] BSTR *pVal);

put_Table
Purpose:

Sets the name of the Table to which this object belongs.


Syntax:
HRESULT put_Table(
[in] BSTR newVal);

get_Database
Purpose:

Gets the name of the Database to which this object belongs, if applicable.
Syntax:
HRESULT get_Database(
[out, retval] BSTR *pVal);

370

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

put_Database
Purpose:

Sets the name of the Database to which this object belongs, if applicable.
Syntax:
HRESULT put_Database(
[in] BSTR newVal);

get_System
Purpose:

Gets the name of the System to which this object belongs.


Syntax:
HRESULT get_System(
[out, retval] BSTR *pVal);

put_System
Purpose:

Sets the name of the System to which this object belongs.


Syntax:
HRESULT put_System(
[in] BSTR newVal);

MetaFilter Class
The IMetaFilter interface contains the basic properties of the CMetaFilterInfo class. See
CMetaFilterInfo Class Functions for more detailed information.
Property

Type

Description

Operator

MetaComparisonOperator

The comparison operator used


by the search.

Logical

MetaLogicalOperator

The logical operator used if


multiple filters are used.

Filter

IMetaPropertyItem

The value of the filter.

OpenParenthesesCount

Short

Sets/gets the count of opened


parentheses to allow grouping
of filters. Used with
CloseParaenthesesCount.

CloseParenthesesCount

Short

Sets/gets the count of closed


parentheses to allow grouping
of filters. Used with
OpenParaenthesesCount.

Teradata Meta Data Services Programmer Guide

371

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

get_Filter
Purpose:

Gets the filter value.


Syntax:
HRESULT get_Filter(
[out, retval] IMetaPropertyItem* *pVal);

put_Filter
Purpose:

Sets the filter value.


Syntax:
HRESULT put_Filter(
[in] IMetaPropertyItem* newVal);

get_Logical
Purpose:

Gets the Logical Operator. This operator can be used between two or more property filter
items, to indicate how they are logically connected ("and" or "or"). If no logical operator is
specified between two filter items, "and" is assumed. The logical operator "and" has
precedence over "or", but the use of parentheses can be used to change this.
Syntax:
HRESULT get_Logical(
[out, retval] MetaLogicalOperator *pVal);

put_Logical
Purpose:

Sets the Logical Operator. This operator can be used between two or more property filter
items, to indicate how they are logically connected ("and" or "or"). If no logical operator is
specified between two filter items, "and" is assumed. The logical operator "and" has
precedence over "or", but the use of parentheses can be used to change this.
Syntax:
HRESULT put_Logical(
[in] MetaLogicalOperator newVal);

get_Operator
Purpose:

Gets the Comparison Operator. The operator is used to create a comparison between the
property and the value named in the filter. If no Operator value is set, EQUAL is assumed.
Syntax:
HRESULT get_Operator(
[out, retval] MetaComparisonOperator *pVal);

372

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

put_Operator
Purpose:

Sets the Comparison Operator. The operator is used to create a comparison between the
property and the value named in the filter. If no Operator value is set, EQUAL is assumed.
Syntax:
HRESULT put_Operator(
[in] MetaComparisonOperator newVal);

get_OpenParenthesesCount
Purpose:

Gets the current count of opened parentheses, effectively enclosing filters in groups. This can
be done to over-ride the usual precedence of AND over OR.
Syntax:
HRESULT get_OpenParenthesesCount(
[out, retval] short *pVal);

put_OpenParenthesesCount
Purpose:

Sets the current count of opened parentheses, effectively enclosing filters in groups. This can
be done to over-ride the usual precedence of AND over OR.
Syntax:
HRESULT put_OpenParenthesesCount(
[in] short newVal);

get_CloseParenthesesCount
Purpose:

Gets the current count of closed parentheses, effectively enclosing filters in groups. This can be
done to over-ride the usual precedence of AND over OR.
Syntax:
HRESULT get_CloseParenthesesCount (
[out, retval] short *pVal);

put_CloseParenthesesCount
Purpose:

Sets the current count of closed parentheses, effectively enclosing filters in groups. This can be
done to over-ride the usual precedence of AND over OR.
Syntax:
HRESULT put_CloseParenthesesCount (
[in] short newVal);

Teradata Meta Data Services Programmer Guide

373

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

MetaHelper Class
The MetaHelper class provides helper functions.
StringHexToBinary
Purpose:

This function translates a string representation of the hexadecimal number into the actual
hexadecimal number.
Syntax:
HRESULT StringHexToBinary (
[in] BSTR StringHex,
[out. Retval] VARIANT *BinaryVariant);

MetaBIZInfo Class
The MetaBIZInfo class is a non-creatable class that is returned only by the Item and Next calls
from a MetaBIZInfoList collection object. If the search criteria matched multiple fields, all
those that matched are returned.
get_ClassID
Purpose:

This is a read-only property that returns the class ID of the object.


Syntax:
HRESULT get_ClassID(
[out, retval] long *pVal);

get_ObjectID
Purpose:

This is a read-only property that returns the ID of the object.


Syntax:
HRESULT get_ObjectID(
[out, retval] long *pVal);

get_Name
Purpose:

This is a read-only property that returns the name of the object. The name of the object is
always returned even if it did not match the search criteria, that is, even if the object is in the
collection due to a match on the object's Description, Definition or Notes. (Note though, the
name itself may be blank.).
Syntax:
HRESULT get_Name(
[out, retval] BSTR *pVal);

374

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

get_NameMatch
Purpose:

This is a read-only property that returns VARIANT_TRUE if this object is in the collection
due to a match on its name. If the item is in the list due to a match on the Description,
Definition or Notes instead, this is VARIANT_FALSE. (VARIANT_TRUE and
VARIANT_FALSE are just True and False in Visual Basic.)
Syntax:
HRESULT get_NameMatch(
[out, retval] VARIANT_BOOL *pVal);

get_Description
Purpose:

This is a read-only property that returns the business description for this object.
Syntax:
HRESULT get_Description(
[out, retval] BSTR *pVal);

get_Definition
Purpose:

This is a read-only property that returns the business definition for this object.
Syntax:
HRESULT get_Definition(
[out, retval] BSTR *pVal);

get_Notes
Purpose:

This is a read-only property that returns the business notes for this object.
Syntax:
HRESULT get_Notes(
[out, retval] BSTR *pVal);

get_VersionNumber
Purpose:

This is a read-only property that returns the object's version number.


Syntax:
get_VersionNumber(
long *pVal);

Teradata Meta Data Services Programmer Guide

375

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

get_PublishState
Purpose:

This is a read-only property that returns the object version's publish state. The publish state is
an enumeration of mdsCurrent, mdsInactive, mdsDeleted (currently not used) and
mdsDormant.
Syntax:
HRESULT get_PublishState (
MetaPublishState *pVal);

get_Frozen
Purpose:

This is a read-only property that returns the object version's frozen property.
Syntax:
HRESULT get_Frozen (
VARIANT_BOOL *pVal);

MetaInfoClassKey Class
This class inherits from the MetaInfoKey class and adds the class name and id of each object
being returned.
get_ClassName
Purpose:

Returns the name of the class for this object.


Syntax:
HRESULT get_ClassName(
[out, retval] BSTR* Name);

put_ClassName
Purpose:

Sets the name of the class for this object.


Syntax:
HRESULT put_ClassName([in] BSTR Name);

get_ClassID
Purpose:

Returns the object id (LOID) of the class of this object.


Syntax:
HRESULT get_ClassID(
[out, retval] long* id);

376

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

put_ClassID
Purpose:

Sets the object id (LOID) of the class of this object.


Syntax:
HRESULT put_ClassID(
[in] long id);

MetaVersionedInfoClassKey Class
This class inherits all the properties of the IMetaVersionedInfoKey interface and adds
ClassName and ClassID properties to each object key.
get_ClassName
Purpose:

Returns the name of the class for this object.


Syntax:
HRESULT get_ClassName(
[out, retval] BSTR* Name);

get_ClassID
Purpose:

Returns the object id (LOID) of the class of this object.


Syntax:
HRESULT get_ClassID(
[out, retval] long* id);

MetaLabelInfo Class
This class manages labels in the repository via the usual Read, Write and Delete routines. It
also provides for the labeling of objects across entire metamodels, or just a class in a
metamodel or a specific list of objects.
Property

Type

Common Properties
CreatorName

Description
See Common Properties.

BSTR

The creator name for the label. If not


supplied, the owner name is used.

Read
Purpose:

Gets the label object identified, from the repository. The usual object identifiers must be set to
identify the label object.

Teradata Meta Data Services Programmer Guide

377

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Syntax
HRESULT Read();

Write
Purpose:

This routine Writes the in-memory label object (contained in this object) to the repository. If
the LOID = 0, a new label object is created, otherwise, the existing one (identified by the
MetaLabelInfo's identifier information) is located and updated.
Syntax
HRESULT Write();

Delete
Purpose:

This routine removes this label object from the repository.


Syntax
HRESULT Delete();

CreatorName
Purpose:

Sets or gets the CreatorName property for the object. If this property value is not provided by
the caller when the label is created, the name of the creating user is used.
Syntax:
HRESULT get_CreatorName(
[out, retval] BSTR* CreatorName);
HRESULT put_CreatorName(
[in] BSTR CreatorName);

ApplyToModel
Purpose:

Applies this label to all the objects in all the classes of the metamodel identified by the
ModelID.
Description:

The label is applied to only the currently published version of each object. Unlike the next two
calls (ApplyToClass and ApplyToObjects), the bPropagate parameter does not exist; it is
always assumed to be true, i.e. the label will be applied to all objects in all classes of the
metamodel and all the destination targets of all those objects.
Requirements:

The label object must have its LOID or GOID or Name set.
Syntax:
HRESULT ApplyToModel(
[in] long ModelID);

378

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Objects and Collections Classes

ApplyToClass
Purpose:

This routine applies this label to all objects in the specified class.
Description:

If bPropagate is VARIANT_TRUE (true), the label will also be applied recursively to all
destination objects reachable from the class's objects, else only the specific objects in the class
will receive the label. The label is only applied to the currently published version for each
object in a class.
Requirements:

The label object must have its LOID or GOID or Name set.
Syntax:
HRESULT ApplyToClass(
[in] long ClassID,
[in] VARIANT_BOOL bPropagate);

ApplyToObjects
Purpose:

This routine applies this label to all objects in the objectList.


Description:

The keys in the objectList parameter need only have their ObjectID property set; all other key
properties are ignored. If bPropagate is VARIANT_TRUE (true), the label will also be applied
recursively to all destination objects in the objectList, reachable from the objects, else only the
specific objects themselves will receive the label.
If bMoveLabel is VARIANT_TRUE (true), then any of the objects that have the label already
applied to an "inactive" version, will have the label removed from that version and applied to
the "current" version of the object.
If bMoveLabel is VARIANT_FALSE (the default), and an object in the list has the label already
applied to an "inactive" version, the engine will return an error. When there are no errors, the
label is applied to the currently published version of each object.
Requirements:

The label object must have its LOID or GOID or Name set.
Syntax:
HRESULT
[in]
[in]
[in]

ApplyToObjects(
IMetaInfoKeyList* objectList,
VARIANT_BOOL bPropagate)
VARIANT_BOOL bMoveLabel);

RemoveFromObjects
Purpose:

This routine removes the label from the objects in the objectList parameter.

Teradata Meta Data Services Programmer Guide

379

Chapter 14: MetaCOMExport Library


Objects and Collections Classes
Description:

If the bPropagate parameter is VARIANT_TRUE, the label will also be removed from all
objects reachable from the objects in the objectList.
To delete the label from the repository, and by default remove it from all the repository objects
to which it is applied, use the Delete routine for this interface.
Requirements:

The label object must have its LOID or GOID or Name set.
Syntax:
HRESULT RemoveFromObjects(
[in] IMetaInfoKeyList* objectList,
[in] VARIANT_BOOL bPropagate);

GetObjectKeys
Purpose:

This routine returns an IMetaVersionedInfoClassKey (in the "keyList"


IMetaVersionedInfoClassKeyList parameter) for each object version in the repository, in a
metamodel, or in a class that has the current label attached to it.
Description:

If all of the four parameters ModelGUID, ModelID, ClassGUID, and ClassID are null or not
specified, then all object versions in the repository with the current label are returned. If one
of ModelGUID or ModelID is not null, then all object versions in the metamodel with the
current label are returned. If both ModelGUID and ModelID are null and one of ClassGUID
or ClassID is not null, then all object versions in the class with the current label are returned.
Requirements:

The label object must have its LOID or GOID or Name set.
Syntax:
HRESULT GetObjectKeys(
[in, optional] long ModelID,
[in, optional] BSTR ModelGUID,
[in, optional] long ClassID,
[in, optional] BSTR ClassGUID,
[out, retval] IMetaVersionedInfoClassKeyList** objList);

MetaLabelInfoKey Class
This class inherits from IMetaVersionedInfoKey getting all its properties, and it adds the
LabelName property. It is the contained key for the associated MetaLabelInfoKeyList that is
returned by the IMetaInfo::GetObjectLabelKeys routine. All of the properties of this class are
read only since they are the result of a fetch of data from the repository.
get_LabelName
Purpose:

Returns the name of the label associated with this object version.
380

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes
Syntax:
HRESULT get_LabelName(
[out, retval] BSTR* LabelName);

AIM Classes
This section describes the MDS COM AIM classes. These classes are used to maintain
metamodel objectsAIMs, classes, properties, and relationships.

MetaPropertyInfo Class
This class is used to create, read, modify or delete a CMetaPropetyDesc object. However, after
the object has been created and its properties set to whatever values are appropriate, it is
actually added to the MDS repository via the IMetaClassInfo::AddProperty routine with this
object as that routine's parameter. This means that all the "put" properties below are only
setting in-memory values and as far as the MDS repository goes, they are useful only before
the call to IMetaClassInfo::AddProperty when creating the property, or Update when
modifying the property.
See CMetaPropertyDesc Class for more detailed information.
Property

Type

Common Properties

Description
See Common Properties.

NumDigit

Short

The number of decimal digits.

PropertyLength

Long

The length of the property.

SQL_Type

Enum

enum { sqlChar = 1,
sqlNumeric = 2,
sqlDecimal = 3,
sqlInteger = 4,
sqlSmallInt = 5,
sqlFloat = 6,
sqlReal = 7,
sqlDouble = 8,
sqlDate = 9,
sqlVarChar = 12,
sqlBinary = -2,
sqlVarBinary = -3,
sqlTinyInt = -6,

Teradata Meta Data Services Programmer Guide

381

Chapter 14: MetaCOMExport Library


AIM Classes

Property

Type

Description
sqlTime = 10,
sqlTimeStamp = 11
} ColumnType;

Identifier

Long

The property identifier. Must be greater


than 500.

VARIANT_Type

Enum

enum { vtEmpty = VT_EMPTY,


vtInteger = VT_I2,
vtLong = VT_I4,
vtDouble = VT_R8,
vtDate = VT_DATE,
vtString = VT_BSTR,
vtBool = VT_BOOL,
vbByte = VT_I1,
vtChar = VT_UI1,
vtBinary = VT_ARRAY
| VT_UI1
} VariantType;

CharacterSet

BSTR

The character set of the column.

ValueRequired

BOOL

When set to True (VARIANT_TRUE=1), indicates that this property value


must be non-NULL.

DefaultValue

String

Required if the ValueRequired is true,


otherwise, ignored. When the property
is created and the ValueRequired is set to
true, this is the value used for the
property for any objects currently in the
class (and in any sub-classes).
The value must be able to be converted
to the type specified for the property.

382

BasePropertyName

BSTR

Used for derived properties only. This is


the name of the Property from the
derived class.

DerivedRelationshipList

IMetaInfoKeyList

Used for derived properties only. This is


the list of Relationship object IDs, which
lead back to the BasePropertyName's
class.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes

Common Properties
See Common Properties.
get_Identifier
Purpose:

Gets the relative property ID for the property.


Syntax:
HRESULT get_Identifier(
[out, retval] long *pVal);

put_Identifier
Purpose:

Sets the relative property ID for the property.


Requirements:

This must be a number greater than 500 for user-defined properties.


Syntax:
HRESULT put_Identifier([in] long newVal);

get_CharacterSet
Purpose:

Gets the property CharacterSet name.


Syntax:
HRESULT get_CharacterSet(
[out, retval] BSTR *pVal);

put_CharacterSet
Purpose:

Sets the property CharacterSet


Syntax:
HRESULT put_CharacterSet(
[in] BSTR newVal);

get_VARIANT_Type
Purpose:

Gets the propertys Variant Type.


Syntax:
HRESULT get_VARIANT_Type(
[out, retval] VariantType *pVal);

Teradata Meta Data Services Programmer Guide

383

Chapter 14: MetaCOMExport Library


AIM Classes

put_VARIANT_Type
Purpose:

Sets the propertys Variant Type.


Syntax:
HRESULT put_VARIANT_Type(
[in] VariantType newVal);

get_SQL_Type
Purpose:

Gets the propertys SQL Type.


Syntax:
HRESULT get_SQL_Type(
[out, retval] ColumnType *pVal);

put_SQL_Type
Purpose:

Sets the propertys SQL Type.


Syntax:
HRESULT put_SQL_Type(
[in] ColumnType newVal);

get_PropertyLength
Purpose:

Gets the propertys size.


Syntax:
HRESULT get_PropertyLength(
[out, retval] long*pVal);

put_PropertyLength
Purpose:

Sets the propertys size


Syntax:
HRESULT put_PropertyLength(
[in] long newVal);

get_NumDigit
Purpose:

Gets the propertys number of decimal digits.


Syntax:
HRESULT get_NumDigit(

384

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes
[out, retval] short *pVal);

put_NumDigit
Purpose:

Sets the propertys number of decimal digits.


Syntax:
HRESULT put_NumDigit(
[in] short newVal);

get_ValueRequired
Purpose:

Gets the ValueRequired property value.


The Property attribute can only be set when the Property is created via an
IMetaClassInfo.AddProperty() call. When set to True, any object containing this property
must have a non-NULL value for it. The default when not set is False, meaning the property
value can be NULL.
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be
updated. Classes that inherit this property via a super class, will also inherit the ValueRequired
setting.
Syntax:
HRESULT get_ValueRequired([out, retval] VARIANT_BOOL *pVal);

put_ValueRequired
Purpose:

Sets the ValueRequired property value.


The Property attribute can only be set when the Property is created via an
IMetaClassInfo.AddProperty() call. When set to True, any object containing this property
must have a non-NULL value for it. The default when not set is False, meaning the property
value can be NULL.
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be
updated. Classes that inherit this property via a super class, will also inherit the ValueRequired
setting.
Syntax:
HRESULT put_ValueRequired([in] VARIANT_BOOL newVal);

get_DefaultValue
Purpose:

Gets the Defaultvalue for the property when it is required.


This is required when creating the property (using IMetaClassInfo::AddProperty), and
theValueRequired setting is "true"; all existing objects in the class (and in any sub-classes) will

Teradata Meta Data Services Programmer Guide

385

Chapter 14: MetaCOMExport Library


AIM Classes

get this as the value for the property. The string must be able to be converted to the type of the
property
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be
updated.
Syntax:
HRESULT get_DefaultValue([out, retval] BSTR *pVal);

put_DefaultValue
Purpose:

Sets the Defaultvalue for the property when it is required.


This is required when creating the property (using IMetaClassInfo::AddProperty), and
theValueRequired setting is "true"; all existing objects in the class (and in any sub-classes) will
get this as the value for the property. The string must be able to be converted to the type of the
property.
This MetaPropertyInfo attribute can only be "set" at the creation of the property, it cannot be
updated.
Syntax:
HRESULT put_Defaultvalue([in] BSTR newVal);

get_BasePropertyName
Purpose:

Used only when retrieving properties for derived classes.


Derived classes get all their properties from the classes from which they derive. These classes
are known as their "base" classes, and these properties, as their derived or "base" properties. A
derived class can have up to five base classes from which it can acquire its (base) properties.
The get_BasePropertyName is the name of a property in one of those classes, and the
get_DerivedRelationshipList (below), is used to identify which base class the property belongs
to. It is the list of relationships in the chain leading to the base class.
Syntax:
HRESULT get_BasePropertyName([out, retval] BSTR *pVal);

put_BasePropertyName
Purpose:

Used only when creating properties for derived classes.


Derived classes get all their properties from the classes from which they derive. These classes
are known as their "base" classes, and these properties, as their derived or "base" properties. A
derived class can have up to five base classes from which it can acquire its (base) properties.
The put_BasePropertyName is used to identify the name of a property in one of those classes,
and the put_DerivedRelationshipList (below), is used to define the way to identify that class by

386

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes

setting the list of relationships used to get to that (base) class, i.e., it is the list of relationships
in the chain leading to the base class.
The user would use these two functions to set up this derived property, before making the call
to add the property to the (derived) class, using the MetaClassInfo AddProperty function.
Syntax:
HRESULT put_BasePropertyName ([in] BSTR newVal);

get_DerivedRelationshipList
Purpose:

Gets the list of object IDs that lead to the derived-property class for this property. The
get_BasePropertyName function (above) will contain the actual name of the property in that
class. Used for derived properties only.
Syntax:
HRESULT get_DerivedRelationshipList([out, retval] IMetaInfoKeyList
*pVal);

put_ DerivedRelationshipList
Purpose:

Sets the list of object IDs that lead to the derived-property class for this property. The
put_BasePropertyName function (above) is used to identify the name of the property in the
base class. Used for derived properties only.
Syntax:
HRESULT put_ DerivedRelationshipList ([in] IMetaInfoKeyList newVal);

Delete
Purpose:

Use this method to delete the property description object from the MDS repository.
Requirements:

The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();

Read
Purpose:

Use this method to read the property description object from the MDS repository.
Requirements:

The object identifier must be set before calling the Read method.
Syntax:
HRESULT Read();

Teradata Meta Data Services Programmer Guide

387

Chapter 14: MetaCOMExport Library


AIM Classes

Update
Purpose:

Use this method to modify certain attributes of the MetaPropertyInfo object after it has been
created. See the Microsoft Visual C++ Programmers Guide for attributes that can be changed.
Syntax
HRESULT Update();

MetaClassInfo Class
The IMetaClassInfo interface is used to create, read, modify or delete a CMetaClassDesc
object. However, after the object has been created and its properties set to whatever values are
appropriate, it is actually added to the MDS repository through the
IMetaModelInfo::AddClass routine with this object as that routine's parameter. This means
that all the "put" properties below are only setting in-memory values and as far as the MDS
repository goes, they are useful only before a call to AddClass or to this classs Update routine.
See Chapter 12: AIM Classes for more detailed information.
Property

Type

Common
Properties

388

Description
See Common Properties on page 357.

PropertyList

IMetaPropertyInfoList

The list of all property descriptions for


this class (read only).

RelationshipList

IMetaRelationshipInfoList

The list of all relationship descriptions


associated with this class (read only).

UniqueNaming

Boolean

True or false to notify the engine to


enforce (or not) unique names for the
objects within this class.

RootClass

Boolean

The type of class description.

BaseClassID

Long

For derived classes, this is the object ID


of the base class. Setting this property
marks this class as a derived class.

ObjectDescReq

Boolean

Set to TRUE (VARIANT_TRUE=-1) to


have all objects created in this class to
have a non-NULL Description property.
The default is FALSE
(VARIANT_FALSE), which allows
objects in the class to have a NULL
value for the Description property.

AbstractClass

Boolean

This is a VARIANT_BOOL indicating


whether or not the class is an abstract
class.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes

Property

Type

Description

SuperClassList

IMetaInfoKeyList

This is a list of user-defined superclasses for this class. It can be empty if


there are none.

SubClassList

IMetaInfoKeyList

This is a read-only property that returns


the list of sub-classes of this class, i.e.,
those classes for which this class is a
super-class. It will be empty if there are
none.

Common Properties
See Common Properties.
get_PropertyList
Purpose:

Gets the list of MetaPropertyInfo objects for the class.


Requirements:

Must be proceeded by a "Read(VARIANT_TRUE);" or else the list will be empty.


Syntax:
HRESULT get_PropertyList(
[out, retval] IMetaPropertyInfoList **pVal);

get_RelationshipList
Purpose:

Gets the list of MetaRelationshipInfo objects for the class.


Requirements:

Must be proceeded by a "Read(VARIANT_TRUE);" or else the list will be empty.


Syntax:
HRESULT get_RelationshipList(
[out, retval] IMetaRelationshipInfoList **pVal);

get_ UniqueNaming
Purpose:

Returns the Unique Naming property for the class.


Syntax:
HRESULT get_ UniqueNaming (
[out, retval] VARIANT_BOOL *pVal);

Teradata Meta Data Services Programmer Guide

389

Chapter 14: MetaCOMExport Library


AIM Classes

put_ UniqueNaming
Purpose:

Sets the Unique Naming property for the class.


Syntax:
HRESULT put_ UniqueNaming (
[in] VARIANT_BOOL newVal);

get_RootClass
Purpose:

Returns true if the class is a root class for the model.


Syntax:
HRESULT get_RootClass(
[out, retval] VARIANT_BOOL *pVal);

put_RootClass
Purpose:

Sets the root class value. (True = root class)


Syntax:
HRESULT put_RootClass([in] VARIANT_BOOL newVal);

get_BaseClassID
Purpose:

Returns the base class's object ID if this is a derived class (0 if not).


Syntax:
HRESULT get_BaseClassID(
[out, retval] long *pVal);

put_ BaseClassID
Purpose:

Sets the object ID of the base class, making this class a derived class.
Syntax:
HRESULT put_BaseClassID([in] long newVal);

AddProperty
Purpose:

Use this method to add a property description to the class description.


Requirements:

The class description must be already created in the MDS repository.

390

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes
Syntax:
HRESULT AddProperty(
[in] IMetaPropertyInfo *lpPropertyInfo);

get_AbstractClass
Purpose:

This property returns the AbstractClass value. This value is VARIANT_TRUE if this is an
abstract class and VARIANT_FALSE if it is not. (Note that for Visual Basic, VARIANT_TRUE
and VARIANT_FALSE are just True and False.)
Syntax:
HRESULT get_AbstractClass(
[out, retval] VARIANT_BOOL *pVal);

put_AbstractClass
Purpose:

This property sets the AbstractClass value. The default value is VARIANT_FALSE, that is, this
is not an abstract class. Set this property to VARIANT_TRUE before this class is created in the
model, if you want this class to be an abstract class. (Note that for Visual Basic,
VARIANT_TRUE and VARIANT_FALSE are just True and False.)
Syntax:
HRESULT put_AbstractClass(
[in] VARIANT_BOOL newVal);

get_ObjectDescReq
Purpose:

This property allows the meta model designer to force all objects in a class to have a
Description rather than a NULL value.
Gets the ObjectDescReq value for the class. When set to True, the engine will check as any
object is added to the class (or updated in the class) that the Description property for the
object is not NULL. If it is, an error will be returned and the object add (or update) will fail.
An error will be returned if this property is used on class objects in MDS-owned meta models.
Syntax:
HRESULT get_ObjectDescReq(
[out, retval] VARIANT_BOOL *pVal);

put_ObjectDescReq
Purpose:

This property allows the meta model designer to force all objects in a class to have a
Description rather than a NULL value.
Sets the ObjectDescReq value for the class. When set to True, the engine will check as any
object is added to the class (or updated in the class) that the Description property for the
object is not NULL. If it is, an error will be returned and the object add (or update) will fail.

Teradata Meta Data Services Programmer Guide

391

Chapter 14: MetaCOMExport Library


AIM Classes
Syntax:
HRESULT put_ObjectDescReq(
[in] VARIANT_BOOL newVal);

get_SuperClassList
Purpose:

This property returns a IMetaInfoKeyList collection object, which contains the object IDs and
names of the super-classes of this class.
Syntax:
HRESULT get_SuperClassList(
[out, retval] IMetaInfoKeyList* *pVal);

put_SuperClassList
Purpose:

This property sets the list of super-classes for this object via the IMetaInfoKeyList parameter.
By default this list is empty, that is, there are no super classes for this class. If you wish to
inherit properties and relationships from other classes, add IMetaInfoKey objects to this
collection where the IMetaInfoKey objects have the class ID of the class you wish to inherit
from. (Any names you specify for the IMetaInfoKey objects will be ignored.)
Syntax:
HRESULT put_SuperClassList(
[in] IMetaInfoKeyList* newVal);

get_SubClassList
Purpose:

This read-only property is used to return the list of sub classes for this class, i.e. the list of
classes for which this class is a super class. The IMetaInfoKey items contained in the
IMetaInfoKeyList collection are the names and class IDs (loids) of the sub classes. It is not
necessary to do a Read before calling this routine, but in that case the ObjectID must be set.
Syntax:
HRESULT get_SubClassList(
[out, retval] IMetaInfoKeyList* *pVal);

Delete
Purpose:

Use this method to delete the class description object from the MDS repository.
Requirements:

The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();

392

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes

Read
Purpose:

Use this method to read the class description object from the MDS repository.
Description

The Detail argument indicates whether to read the list of the relationships and property
descriptions for this particular class. If the Detail is true, read the class description and its
relationships and property descriptions. If the Detail is false (0), read the class description
object only.
Requirements:

The object identifier must be set before calling the Read method.
Syntax:
HRESULT Read(
[in, optional] VARIANT_BOOL Detail);

Update
Purpose:

Use this method to modify certain attributes of the MetaPropertyInfo object after it has been
created. See the Microsoft Visual C++ Programmers Guide for attributes that can be changed.
Syntax
HRESULT Update();

GetVersionSupport
Purpose:

Returns the current setting for the VersioningSupport property of a MetaClassInfo object. For
an existing Class, this value is only meaningful after calling Read.
Description:

The VersioningSupport property has three possible values:

mdsNoVersioning - the class does not support data versioning

mdsHadVersioning - the class does not support data versioning and any new objects for
the class will not support versioning. However, some of the objects in the class currently
retain multiple versions that existed when data versioning was disabled for the class. Even
though multiple versions may exist for a data object, WriteObject will never create new
versions for existing data objects; only the latest version for an object will be modified.

mdsHasVersioning - the class supports data versioning.

Syntax:
HRESULT GetVersionSupport(
[out, retval] MetaVersionSupportLevel* level);

Teradata Meta Data Services Programmer Guide

393

Chapter 14: MetaCOMExport Library


AIM Classes

SetVersioning
Purpose:

Allows an application to dynamically enable or disable data versioning for a class.


Description:

Derived classes may not be used with this API. If bVersioningAllowed is false, data versioning
will be disabled for the class. If bVersioningAllowed is true and repository versioning is
enabled, then data versioning will be enabled for the class, else versioning will be left disabled
for the class. bDeleteVersions indicates if existing historical versions for objects in the class
should be deleted or retained, however, this parameter is ignored unless version is already off
for this class or is being turned off by this call.
Disabling versioning can affect the existing objects in the class. If bDeleteVersions is true, all
objects in the class will be modified so that all non-published versions are deleted and the
remaining versions will be renumbered to version one. This can be a very lengthy operation. If
bDeleteVersions is false, all existing versions of data objects in the class will be retained. Any
new objects added to the class will be created without support of versioning.
Changing the data versioning support for a class will also change the versioning support for
any derived classes that have the class as their base class. A derived class's data versioning
support is always the same as that of the base class.
A Read call does not need to be done before this call, but in that case, either the class ID or
class GUID must be set.
Syntax:
HRESULT SetVersioning(
[in] VARIANT_BOOL bVersioningAllowed,
[in, optional] VARIANT_BOOL bDeleteVersions);

MetaRelationshipInfo Class
The IMetaRelationshipInfo interface of this class is used to create, read, modify or delete
CMetaRelationshipDesc objects. However, after the MetaRelationshipInfo object has been
created and its properties set to whatever values are appropriate, it is actually added to the
MDS repository via the IMetaModelInfo::AddRelationship routine with this object as that
routine's parameter. This means that all the "put" properties below are only setting inmemory values and as far as the MDS repository goes, they are useful only before the call to
AddRelationship or this class's Update routine.
See Chapter 12: AIM Classes for more detailed information.
Property

Type

Common Properties

394

Description
See Common Properties.

OriginClassID

Long

The origin class identifier for this relationship.

DestinationClassID

Long

The destination class identifier for this


relationship.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes

Property

Type

Description

UniqueName

Short

The relationship contains unique names flag.

PropagateDelete

Short

Propagate the delete if the relationship is


deleted.

Common Properties
See Common Properties.
get_PropagateDelete
Purpose:

Gets the propagate delete flag.


Syntax:
HRESULT get_PropagateDelete(
[out, retval] short *pVal);

put_PropagateDelete
Purpose:

Gets the propagate delete flag.


Syntax:
HRESULT put_PropagateDelete(
[in] short newVal);

get_UniqueName
Purpose:

Gets the UniqueNaming flag.


Syntax:
HRESULT get_UniqueName(
[out, retval] short *pVal);

put_UniqueName
Purpose:

Gets the UniqueNaming flag.


Syntax:
HRESULT put_UniqueName(
[in] short newVal);

get_DestinationClassID
Purpose:

Gets the Destination Class ID of the relationship

Teradata Meta Data Services Programmer Guide

395

Chapter 14: MetaCOMExport Library


AIM Classes
Syntax:
HRESULT get_DestinationClassID(
[out, retval] long *pVal);

put_DestinationClassID
Purpose:

Sets the Destination Class ID of the relationship.


Syntax:
HRESULT put_DestinationClassID(
[in] long newVal);

get_OriginClassID
Purpose:

Gets the Origin Class ID of the relationship.


Syntax:
HRESULT get_OriginClassID(
[out, retval] long *pVal);

put_OriginClassID
Purpose:

Sets the Origin Class ID of the relationship.


Syntax:
HRESULT put_OriginClassID(
[in] long newVal);

Delete
Purpose:

Use this method to delete the relationship description object from the MDS repository.
Requirements:

The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();

Read
Purpose:

Use this method to read the relationship description object from the MDS repository.
Requirements:

The object identifier must be set before calling the Read method.

396

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes
Syntax:
HRESULT Read();

Update
Purpose:

Use this method to modify certain attributes of the MetaRelationshipInfo object after it has
been created. See the Microsoft Visual C++ Programmers Guide for attributes that can be
changed.
Syntax:
HRESULT Update();

MetaModelInfo Class
The IMetaModel interface is used to create, read, modify or delete a CMetaAIM class. See
CMetaAIM Class for more detailed information.
Property

Type

Common
Properties

Description
See Common Properties.

ClassList

IMetaClassInfoList

Return the MetaClassInfo objects for


this model (read only).

RelationshipList

IMetaRelationshipInfoList

The list of all relationship descriptions


associated with this class (read only).

Common Properties
See Common Properties.
get_RelationshipList
Purpose:

Gets the list of relationships in the model (read only).


Requirements:

Must be proceeded by a Read(VARIANT_TRUE) call for the class, else the list will be empty.
Syntax:
HRESULT get_RelationshipList(
[out, retval] IMetaRelationshipInfoList * *pVal);

get_ClassList
Purpose:

Gets the list of classes in the model (read only).

Teradata Meta Data Services Programmer Guide

397

Chapter 14: MetaCOMExport Library


AIM Classes
Requirements:

Must be proceeded by a Read(VARIANT_TRUE) call for the class, else the list will be empty.
Syntax:
HRESULT get_ClassList(
[out, retval] IMetaClassInfoList * *pVal);

Delete
Purpose:

Use this method to delete the model description object from the MDS repository.
Requirements:

The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();

Read
Purpose:

Use this method to read the model description object from the MDS repository.
Description:

The Detail argument indicates whether to read the list of the classes and relationships for this
particular model. If the Detail is "true", the model's classes and relationships are read and are
available via the get_ClassList and get_RelationshipList properties. Otherwise, if the Detail is
"false", the classes and relationships for the model are not read and the two lists will be empty.
If not specified, the value is taken as "false".
Requirements:

The object identifier must be set before calling the Read method.
Syntax:
HRESULT Read(
[in, optional] VARIANT_BOOL Detail);

Create
Purpose:

Use this method to write the model description object to the MDS repository.
Syntax:
HRESULT Create();

398

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


AIM Classes

Update
Purpose:

Use this method to modify certain attributes of the MetaRelationshipInfo object after it has
been created. See the Microsoft Visual C++ Programmers Guide for attributes that can be
changed.
Syntax:
HRESULT Update();

AddClass
Purpose:

Use this method to add a class description to the model. The model must have already been
created in the MDS repository.
Requirements:

The model must have already been created in the MDS repository.
Syntax:
HRESULT AddClass(
[in] IMetaClassInfo *lpClassInfo);

AddRelationship
Purpose:

Use this method to add a relationship description to the model. The model must have already
been created in the MDS repository.
Requirements:

The model must have already been created in the MDS repository.
Syntax:
HRESULT AddRelationship(
[in] IMetaRelationshipInfo *lpRelationshipInfo);

GetVersionSupport
Purpose:

Returns the current setting for the VersioningSupport property of a MetaModelInfo object.
For an existing AIM, this value is only meaningful after calling Read.
Description:

The VersioningSupport property has three possible values:

mdsNoVersioning - the AIM does not support data versioning, none of the existing classes
created by the AIM support versioning, and any new classes for the AIM will not support
versioning

mdsHadVersioning - the AIM does not support data versioning and any new classes for
the AIM will not support versioning. However, some of the classes in the AIM currently

Teradata Meta Data Services Programmer Guide

399

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes

retain multiple versions of data objects that existed when data versioning was disabled for
the AIM. Even though multiple versions may exist for a data object, WriteObject will never
create new versions for existing data objects; only the latest version for an object will be
modified.

mdsHasVersioning - the AIM supports data versioning and any new class for the AIM will,
by default, support versioning; existing classes may or may not support versioning.

Syntax:
HRESULT GetVersionSupport(
[out, retval] MetaVersionSupportLevel* level);

SetVersioning
Purpose:

Allows an application to dynamically enable or disable data versioning for a metamodel.


Description:

If bVersioningAllowed is false, versioning will be disabled for the metamodel. If


bVersioningAllowed is true and the repository allows versioning, then versioning will be
enabled for the metamodel, else versioning will be left disabled for the metamodel.
bDeleteVersions indicates whether existing historical versions for objects in the AIM's classes
should be deleted or retained; however, this parameter is ignored unless versioning is already
off for this AIM or is being turned off by this call.
A Read call does not does not need to be done before this call, but in that case, either the
model ID or model GUID must be set.
Syntax:
HRESULT SetVersioning(
[in] VARIANT_BOOL bVersioningAllowed,
[in, optional] VARIANT_BOOL bDeleteVersions);

User, Group, and Security Profile Classes


This section describes the MDS COM User, Group, and Security Profile classes. User, Group,
and Security Profile classes are used to maintain access to objects within the MDS repository.
They are not part of the metamodel or metadata.

MetaUserInfo Class
The IMetaUserInfo interface is used to create, update, read or delete a CMetaUser class. See
Chapter 13: Security Classes for more detailed information.
Property
Common Properties

400

Type

Description
See Common Properties.

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes

Common Properties
See Common Properties.
Delete
Purpose:

Use this method to delete the user object from the MDS repository.
Requirements:

The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();

Read
Purpose:

Use this method to read the user object from the MDS repository.
Requirements:

The object identifier must be set before calling the Read method.
Syntax:
HRESULT Read();

Write
Purpose:

Use this method to update or write the user object to the MDS repository.
Requirements:

The object identifier must be set before calling the Write method
Syntax:
HRESULT Write();

IsSuperUser
Purpose:

Returns VARIANT_TRUE of VARIANT_VALSE (true or false) depending on whether the


caller is an MDS "super user" or "MDS administrator").
Syntax:
HRESULT IsSuperUser(
[out, retval] VARIANT_BOOL *pVal);

CreateSuperUser
Purpose:

Use this method to create an MDS administrator, also known as a super user.

Teradata Meta Data Services Programmer Guide

401

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes
Description:

This method is identical in effect to Write except that the user created is a "super user" (or
"administrator") - and has all the same privileges as the "metasu" built-in super user. The
Description may be empty.
Syntax:
HRESULT
[in]
[in]
[in,

CreateSuperUser(
BSTR Name,
BSTR Password,
optional] BSTR Description);

ChangePassword
Purpose:

Use this method to change the user password.


Description:

If the logged-on user is an MDS Administrator, the OldPassword parameter value is not
required and can be NULL.
Syntax:
HRESULT ChangePassword(
[in] BSTR OldPassword,
[in] BSTR NewPassword);

MetaGroupInfo Class
The IMetaGroupInfo interface is used to create, update, read or delete a
CMetaApplicationGroup class. See Chapter 13: Security Classes for more detailed
information.
Property

Type

Common Properties
UserList

Description
See Common Properties.

IMetaUserInfoList

Returns the IMetaUserInfo objects (i.e., MDS


Users) for this group (read only).

Common Properties
See all attributes from Common Properties except SecurityProfileID and OwnerID.
get_UserList
Purpose:

Gets the list of users in the application group (read only).


Syntax:
HRESULT get_UserList(
[out, retval] IMetaUserInfoList * *pVal);

402

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes

Delete
Purpose:

Use this method to delete the application group object from the MDS repository.
Requirements:

The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();

Read
Purpose:

Use this method to read the application group object from the MDS repository.
Requirements:

The object identifier must be set before calling the Read method.
Syntax:
HRESULT Read();

Write
Purpose:

Use this method to update or write the application group object to the MDS repository.
Requirements:

The object identifier must be set before calling the Write method.
Syntax:
HRESULT Write();

AddUser
Purpose:

Use this method to add the specified user to the application group object.
Requirements:

The object identifier must be set before calling the AddUser method.
Syntax:
HRESULT AddUser(
[in] IMetaUserInfo *IpUser);

RemoveUser
Purpose:

Use this method to remove the specified user from the application group object.

Teradata Meta Data Services Programmer Guide

403

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes
Requirements:

The object identifier must be set before calling the RemoveUser method.
Syntax:
HRESULT RemoveUser(
[in] IMetaUserInfo *lpUser);

MetaSecProfInfo Class
The IMetaSecProfInfo interface is used to create, read, update, and delete a
CMetaSecurityProfile class, and the IMetaSecProfEntry and IMetaSecProfEntryList interfaces
are used to modify the permissions contained in a CMetaSecurityProfileEntry. Note that there
is no "Add" permission(s), only Update(s). The reason that there is no add function is that the
Update functions will add when the user(s) or group(s) identified are not already in the
Security Profile.
See Chapter 13: Security Classes for more detailed information.
Property

Type

Common Properties
Permissions

Description
See Common Properties.

IMetaSecProEntryList

The permission list for this Security


Profile

Common Properties
See all attributes from Common Properties except SecurityProfileID and OwnerID.
RemovePermission
Purpose:

Removes the single user or group identified by the ObjectID, from the Security Profiles
permission list.
Requirements:

Must be followed by a Write to make the change in the MDS repository.


Syntax:
HRESULT RemovePermission(
[in] long ObjectID);

RemoveManyPermissions
Purpose:

Removes the user and/or groups identified by the ObjectIDs in the key-list. The Name
property of the key-list elements is ignored, so it does not need to be set. Note that the MDS
engine currently ignores any ids that are not currently in the permission list.

404

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes
Requirements:

Must be followed by a Write to make the change in the MDS repository.


Syntax:
HRESULT RemoveManyPermissions(
[in] IMetaInfoKeyList* PermissionList);

UpdatePermission
Purpose:

Updates the access of the user or group identified by the Permissions ObjectID property.
Requirements:

Must be followed by a Write to make the change in the MDS repository.


Syntax:
HRESULT UpdatePermission(
[in] IMetaSecProfEntry* Permission);

UpdateManyPermissions
Purpose:

Updates the current Security Profile Entry (MetaSecProfEntry) list for this Security Profile
(MetaSecProfInfo) object, with that in the input parameter. If the User/Group of an entry is
found in the current list for this Security Profile, it is updated with the entry's permission. If
the User/Group of an entry is not found, it is added to the list.
Requirements:

A Read for the MetaSecProfInfo object must be done before this call to get the current
MetaSecProfEntry list.
Must be followed by a Write to make the change in the MDS repository.
Syntax:
HRESULT UpdateManyPermissions(
[in] IMetaSecProfEntryList* PermissionList);

get_Permissions
Purpose:

Returns the permission list for the Security Profile in the form of the IMetaSecProfEntryList
collection object.
Syntax:
HRESULT get_Permissions(
[out, retval] IMetaSecProfEntryList* *PermissionList);

Teradata Meta Data Services Programmer Guide

405

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes

put_Permissions
Purpose:

Sets the permission list for the Security Profile using the IMetaSecProEntryList collection
object. The existing permission list, if any, is completely replaced by this new list.
Syntax:
HRESULT put_Permissions(
[in] IMetaSecProfEntryList *PermissionList);

Read
Purpose:

Reads the indicated Security Profile in from the MDS repository to this COM object,
including the Security Profile's permission list.
Requirements:

This call must be made before any calls that will be modifying the permission list for this
Security Profile object.
Syntax:
HRESULT Read();

Write
Purpose:

Write the Security Profile out to the MDS repository. This effectively commits the action of
any Remove/Update/Put permission calls that have been made for this object, to the MDS
repository.
Syntax:
HRESULT Write();

SetAIMsProfile
Purpose:

Sets all the AIM object IDs found in the ObjectID property of the key-list, to this Security
Profile. If Propagate is set to true, the Security Profile ID in all class, property and relationship
objects in the AIM will also be updated.
This call only needs the Security Profile object identified (ObjectID or ObjectGUID set, etc.)
to work, neither Read nor Write are needed.
Requirements:

You must be initialized as an MDS Administrator (super user) to use this function.
Syntax:
HRESULT SetAIMsProfile(
[in] IMetaInfoKeyList* AIMList,
[in] VARIANT_BOOL Propagate);

406

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes

SetClassesProfile
Purpose:

This call only needs the Security Profile object identified (ObjectID or ObjectGUID set, etc.)
to work, neither Read nor Write are needed.
Syntax:
HRESULT SetClassesProfile(
[in] IMetaInfoKeyList *ClassesList,
[in] VARIANT_BOOL Propagate);

SetObjectsProfile
Purpose:

Sets all the Object object IDs found in the ObjectID property of each key in the key-list, to this
Security Profile. If Propagate is set to true, the Security Profile ID in all related objects will also
be updated.
This call only needs the Security Profile object identified (ObjectID or ObjectGUID set, etc.)
to work, neither Read nor Write are needed.
Requirements:

You must be initialized as an MDS super user to use this function.


All objects in the list must be in the same class.
Syntax:
HRESULT SetObjectsProfile(
[in] IMetaInfoKeyList* ObjectList,
[in] VARIANT_BOOL Propagate);

MetaSecProfEntry Class
The IMetaSecProfEntry interface is used to read, write, modify, and delete the properties of a
CMetaSecurityProfileEntry C++ class object. This interface is used only by the
IMetaSecProfInfo interface.
Property

Type

Description

IsUser

Boolean

True is the entry is for a user (the default setting),


else false for a group

ObjectID

Long

The object of the user or group

Access

AccessType

The access permission for the user or group. Default


is accFull.
enum AccessType {
accRead = MD_READ,
accCollection = MD_COLLECTION,

Teradata Meta Data Services Programmer Guide

407

Chapter 14: MetaCOMExport Library


User, Group, and Security Profile Classes

Property

Type

Description
accUpdate = MD_UPDATE,
accFull = MD_FULL
} AccessType;

SetEntryValues
Purpose:

Sets all the indicated values in one call. Can be used instead of the individual property calls.
Syntax:
HRESULT
[in]
[in]
[in]

SetEntryValues(
VARIANT_BOOL IsUser,
long ObjectID,
AccessType Access);

GetEntryValues
Purpose:

This call gets all the indicated values in one call. Can be used instead of the individual
property calls unless you are using a scripting language, e.g., VBScript. VBScript can accept
only one return value for a function, so you must use the property calls below for it.
Syntax:
HRESULT GetEntryValues(
[out] VARIANT_BOOL* IsUser,
[out] long* ObjectID,
[out] AccessType* Access);

get_IsUser
Purpose:

Sets the IsUser property -- "true" if the ObjectID property is that of a MDS user, "false" if it is
that if an MDS group.
Syntax:
HRESULT get_IsUser(
[out, retval] VARIANT_BOOL *pVal);

put_IsUser
Purpose:

Returns the value of the IsUser property.


Syntax:
HRESULT put_IsUser(
[in] VARIANT_BOOL newVal);

408

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


COM Collection Classes

get_ObjectID
Purpose:

Returns the ObjectID property for the Security Profile Entry, Can be an MDS User id or an
MDS Group ID.
Syntax:
HRESULT get_ObjectID(
[out, retval] long *pVal);

put_ObjectID
Purpose:

Sets the ObjectID property for the Security Profile Entry.


Syntax:
HRESULT put_ObjectID(
[in] long newVal);

get_Access
Purpose:

Sets the access (permission) for the indicated MDS User/Group for this SP entry. See
Chapter 13: Security Classes for more detailed information.
Syntax:
HRESULT get_Access(
[out, retval] AccessType *pVal);

put_Access
Purpose:

Returns the access (permission) for the indicated MDS User/Group.


Syntax:
HRESULT put_Access(
[in] AccessType newVal);

COM Collection Classes


This section describes the MDS COM collection classes. These classes are used to manage
collection lists.
The collection objects do not actually act on the repository itself. The Add, Remove, and Clear
functions are effectively aids to the programmer in managing interface collections in memory
only. Any deviation to this is noted in the individual sections for the classes.
All MDS COM collection classes follow the same convention as the Visual Basic collection
signatures. The MDS COM collection signatures are:

Teradata Meta Data Services Programmer Guide

409

Chapter 14: MetaCOMExport Library


COM Collection Classes

MDS COM Collection Classes

Contained Interface

MetaInfoList

IMetaInfo

MetaInfoKeyList

IMetaInfoKey

MetaPropertyItemList

IMetaPropertyItem

MetaInfoClassKeyList

IMetaInfoClassKey

MetaBIZInfoList

IMetaBIZInfo

MetaFilterList

IMetaFilter

MetaPropertyInfoList

IMetaPropertyInfo

MetaClassInfoList

IMetaClassInfo

MetaRelationshipInfoList

IMetaRelationshipInfo

MetaModelInfoList

IMetaModelInfo

MetaSecProfInfoList

IMetaSecProfInfo

MetaSecProfEntryList

IMetaSecProfEntry

MetaGroupInfoList

IMetaGroupInfo

MetaUserInfoList

IMetaUserInfo

MetaVersionedInfoKeyList

IMetaVersionedInfoKey

MetaVersionedInfoClassKeyList

IMetaVersionedInfoClassKey

MetaLabelInfoKeyList

IMetaLabelInfoKey

MetaRelationInfoKeyList

IMetaRelationInfoKey

MetaRelationVersionedInfoKeyList

IMetaRelationversionedInfoKey

Several of these classes can be created only by specific calls to other COM class interface
methods or properties. These classes are:

410

MetaBIZInfoList, which is created by the return to the call to


IMetaActive::GetBIZObjectsByRange method

MetaPropertyInfoList, which is created by the IMetaClassInfo::PropertyList property

MetaClassInfoList, which is created by the IMetaModelInfo::ClassList property

MetaRelationshipInfoList, which is created by both the IMetaClassInfo::RelationshipList


and IMetaModelInfo::RelationshipList properties

MetaVersionedInfoKeyList

MetaVersionedInfoClassKeyList

MetaLabelInfoKeyList which is returned by IMetaInfo::GetObjectLabelKeys

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


COM Collection Classes

Collection Properties
Count property
Purpose:

This method returns the number of items in the collection.


Syntax:
RESULT get_Count(
[out, retval] long *pVal);

Item property
Purpose:

Given the index, this method returns an item in the collection. However, if the Index is of type
BSTR indicating the name of the object, this method returns an item in the collection with the
first matching name. The object name match is case-insensitive.
Syntax:
HRESULT get_Item(
[in] VARIANT Index,
[out, retval] IDispatch **pVal);

Collection Methods
Add
Purpose:

This method adds the pNewVal item to the end of the collection. The VARIANT should be of
IDispatch type and be the contained collection's interface.
Syntax:
HRESULT Add(
[in] VARIANT *pNewVal);

Remove
Purpose:

This method removes the indicated item from the collection


Syntax:
HRESULT Remove(
[in] long Index);

Sort
Purpose:

This method is implemented on the MetaInfoKeyList, IMetaInfoCLassKeyList and


MetaInfoList objects only.

Teradata Meta Data Services Programmer Guide

411

Chapter 14: MetaCOMExport Library


Example Code
Description:

The list is sorted by the Name property in ascending order (the default) if Asc is true, and is
case-insensitive (the default) if CaseIns is true. Note that the sort is not done by Teradata, but
in memory on the Windows platform where the COM component is installed.
Syntax:
HRESULT Sort(
[in, optional] VARIANT_BOOL Asc,
[in, optional] VARIANT_BOOL CaseIns)

Example Code
This section provides information on developing Visual Basic and C++ programs to work
with MDS COM objects.

Differences in Visual Basic and C++ Calling Conventions


Visual Basic (VB) does several things for the user of COM components. First, for object
property calls, the "get_" and "put_" are dropped off the C++ raw interface names. The result
is that the object property has the one name, and its use determines whether it is being set or
retrieved. And second, as shown in the body of this API document, all COM calls return an
HRESULT. However for VB, the call returns the [out, retval] parameter when the HRESULT is
S_OK., that is, when no error has occurred. If the underlying call had a problem, such that
some COM error needs to be returned, VB sets up an Err object based on the HRESULT and
then "throws" the Err object. The user is expected to use "ON ERROR" to catch any possible
errors, and then take appropriate action.

Example VB Code
The following code assumes you have used the References dialog from the Program menu
item to select the "MetaCOM 2.1 Type Library" for your VB project. You could then use
something similar to the following to set up a definition to your initial repository MetaActive
class object:
Public Repos As METACOMEXPORT21Lib.MetaActive

Alternatively, you could use the following if you were assured of no name-space collisions:
Public Repos As MetaActive

In either case, you would follow this up with the creation of the object by
Set Repos = new MetaActive

There are still other alternatives to this, such as using the "CreateObject" call with the ProgID.
See the Visual Basic documentation (or scripting reference if you are using VBScript of
JScript) for complete information.
Also, see the sample\vb directory installed with the MDS SDK for more example code.

412

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Example Code

Initialization
This section shows example code to connect an application to the MDS repository.
'/////////////////////////////////////////////////////////////////////
'
'
Initialize Repository
'
'
Sets up the connection to the repository using the global object
'
Repository
'
'/////////////////////////////////////////////////////////////////////
Function InitializeRepository () As Boolean
Set Repos = New MetaActive
Repos.Initialize userName, password
InitializeRepository = True
Exit Function
End Function

Writing MDS Objects


This section shows example code to write an object.
'///////////////////////////////////////////////////////////////////
'
'
WriteObject creates an object
'
'///////////////////////////////////////////////////////////////////
Function WriteObject(classID As Long, objectName As String) As Long
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Add the object of objectName to the class classID -- we have
' hard-coded the following 9 properties to match those created
' above for Class1 as an example.
' (All values are completely arbitrary.)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
On Error GoTo errWrite
Dim value As New MetaPropertyItem
Dim info As New MetaInfo
value.PropertyID = 501 ' vtString/sqlVarchar
value.value = "This is a string value sent to the database"
info.PropertyItems.Add value
value.PropertyID = 502 ' vtLong/sqlInteger (4 bytes)
value.value = 12345678
info.PropertyItems.Add value
value.PropertyID = 503 ' vtInteger/sqlSmallInt (2 bytes)
value.value = 32000
info.PropertyItems.Add value
Dim helper As MetaHelper
Set helper = New MetaHelper
value.PropertyID = 504 ' vtBinary/sqlBinary (4 hex bytes)
value.value = helper.StringHexToBinary("CD1F9A2B")
info.PropertyItems.Add value

Teradata Meta Data Services Programmer Guide

413

Chapter 14: MetaCOMExport Library


Example Code
Set helper = Nothing
value.PropertyID = 5 ' vtString/sqlChar
value.StringLiteral = "date" ' sending the Teradata "date" keyword
info.PropertyItems.Add value
value.PropertyID = 506 ' vtDouble/sqlDecimal (4 size; 1 digit)
'value.value = -36.59 ' displays as -36.6
'value.value = -36.8 ' displays as -36.8
value.value = 36.8 ' displays 36.8
'value.value = 3666.8 ' gets META_E_DB_ACCESS_ERROR
'value.value = 366.58 ' displays 366.6
info.PropertyItems.Add value
value.PropertyID = 507 ' vtByte/sqlTinyInt (1 byte)
value.value = 127
info.PropertyItems.Add value
value.PropertyID = 508 ' vtString/sqlDate (Teradata Date)
value.value = "2001-07-20"
info.PropertyItems.Add value
value.PropertyID = 509 ' vtDate/sqlDouble (Variant Date)
value.value = Date ' The Date is a double value.
info.PropertyItems.Add value
info.classID = classID
info.Description = objectName
info.objectName = objectName & " Description"
'
' Finally, write this object out to the Reposiroty
'
Repos.WriteObject info
exitWrite:
WriteObject = info.ObjectID
Set value = Nothing
Set info = Nothing
Exit Function
errWrite:
MsgBox "COM call FAILED: " & Err.Description & _
" [0x" & Hex(Err.Number) & "]"
GoTo exitWrite
End Function

Adding Many Objects to a Collection


This section shows example code of adding multiple objects to a collection.
'///////////////////////////////////////////////////////////////////
'
'
AddManyToCollection
'
'///////////////////////////////////////////////////////////////////
Sub AddManyToCollection()

414

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Example Code

Dim
Dim
Dim
Dim

keyList As New MetaInfoKeyList


testList As New MetaInfoKeyList
key As New MetaInfoKey
testKey As MetaInfoKey

DisplayHeadingLine "MetaActive::AddManyToCollection"
'add to relationship using relationship GUID
key.ObjectID = Class1Obj1
keyList.Add key
key.ObjectID = Class1Obj2
keyList.Add key
Repos.AddManyToCollection DESTINATION, Class0Obj1, _
RelGUID_Class0Class1, 0, keyList
'add to relationship using relationshipID
keyList.Clear
Set testList = Nothing
key.ObjectID = Class1Obj3
keyList.Add key
key.ObjectID = Class1Obj4
keyList.Add key
Repos.AddManyToCollection DESTINATION, Class0Obj2, "", _
RelID_Class0Class1, keyList
' add to origin relationship
keyList.Clear
Set testList = Nothing
key.ObjectID = Class0Obj3
keyList.Add key
Repos.AddManyToCollection ORIGIN, Class1Obj5, RelGUID_Class0Class1, _
0, keyList
End Sub

Getting Objects in a Collection


This section shows example code of reading objects in a collection.
'//////////////////////////////////////////////////////////////////
'
'
GetCollections
'
'//////////////////////////////////////////////////////////////////
Sub GetCollections()
On Error GoTo errCollections
Dim infoList As MetaInfoList
'get destination objects using the relationshipID
Set infoList = Repos.GetCollections(DESTINATION, Class0Obj1, _
"", RelID_Class0Class1)
Set infoList = Nothing
' get destination objects via relationship GUID

Teradata Meta Data Services Programmer Guide

415

Chapter 14: MetaCOMExport Library


Example Code
Set infoList = Repos.GetCollections(DESTINATION, Class0Obj1, _
"", RelGUID_Class0Class1, 0)
Set infoList = Nothing
'get destination object(s) via name
Set testList = Repos.GetCollections(DESTINATION, Class0Obj1, _
"", RelID_Class0Class1, "Entry Six")
Set infoList = Nothing
Set testList = Repos.GetCollections(DESTINATION, Class0Obj2, _
"", RelID_Class0Class1, "Entry%")
exitCollection:
Set infoList = Nothing
Exit Sub
errCollections:
MsgBox "COM call FAILED: " & Err.Description & _
" [0x" & Hex(Err.Number) & "]"
GoTo exitCollection
End Sub
'///////////////////////////////////////////////////////////////////
'
'
GetCollectionsByProperty
'
'///////////////////////////////////////////////////////////////////
Function GetCollectionsByProperty (name As String, _
value As Variant, _
ObjectID As Long, _
relID As Long, _
relGUID As String) As Boolean
Dim
Dim
Dim
Dim
Dim
Dim
Dim

keyList As New MetaInfoKeyList


key As New MetaInfoKey
testList As MetaInfoList
filterList As New MetaFilterList
sortList As New MetaInfoKeyList
filter As New MetaFilter
val As Boolean

filter.filter.name = name
filter.filter.value = value
filter.Logical = META_AND
filter.operator = EQUAL
filterList.Add filter
Set testList = Repos.GetCollectionsByProperty(DESTINATION, ObjectID, _
relGUID, relID, "", filterList, sortList)
Set filterList = Nothing
filter.operator = LESS_THAN
filterList.Add filter
Set testList = Repos.GetCollectionsByProperty(DESTINATION, ObjectID, _
relGUID, relID, "", filterList, sortList)

416

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Example Code

Set filterList = Nothing


filter.operator = GREATER_THAN_OR_EQUAL
filterList.Add filter
Set testList = Repos.GetCollectionsByProperty(DESTINATION, ObjectID, _
relGUID, relID, "", filterList, sortList)
' now do two values separated by OR
Set filterList = Nothing
Set testList = Nothing
filter.operator = LESS_THAN
filter.Logical = META_OR
filterList.Add filter
filter.operator = GREATER_THAN
filterList.Add filter
Set testList = Repos.GetCollectionsByProperty(DESTINATION, ObjectID, _
relGUID, relID, "", filterList, sortList)
GetCollectionsByProperty = True
Exit Function
End Function

Getting Objects of a Class


This section shows example code of reading objects of a class.
'///////////////////////////////////////////////////////////////////
'
'
GetClassObjects
'
'///////////////////////////////////////////////////////////////////
Sub GetClassObjects()
Dim testList As MetaInfoList
Dim info As MetaInfo
Dim class1info As New MetaClassInfo
Dim class2info As New MetaClassInfo
'get the definitions of the classes
class1info.name = CANNED_CLASS_NAME1
class1info.ObjectID = ScriptingClass1
class1info.Read
class2info.name = CANNED_CLASS_NAME2
class2info.ObjectID = ScriptingClass2
class2info.Read
'get the class objects via GUID
Set testList = Repos.GetClassObjects(class1info.ObjectGUID, 0)
Set testList = Nothing
'get class objects via classID
Set testList = Repos.GetClassObjects("", ScriptingClass1)
Set testList = Nothing
'get class objects via object name

Teradata Meta Data Services Programmer Guide

417

Chapter 14: MetaCOMExport Library


Example Code
Dim names(6) As String
Dim i As Integer
names(0) = "Entry One"
names(1) = "Entry Two"
names(2) = "Entry Three"
names(3) = "Entry Four"
names(4) = "Entry Five"
For i = 0 To 4
Set testList = Repos.GetClassObjects("", class1info.ObjectID, names(i))
Next
Set testList = Nothing
Exit Sub
End Sub
'///////////////////////////////////////////////////////////////////
'
'
GetClassObjectsByProperty
'
'///////////////////////////////////////////////////////////////////
Sub GetClassObjectsByProperty()
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

i As Integer
goodCount As Integer
lastdate As Date
info As MetaInfo
class2info As New MetaClassInfo
errorExpected As Boolean
testList As MetaInfoList
filterList As New MetaFilterList
sortList As New MetaInfoKeyList
filter As New MetaFilter
sortKey As New MetaInfoKey

'get the definitions of the class


class2info.name = CANNED_CLASS_NAME1
class2info.ObjectID = ScriptingClass1
class2info.Read
' check multiple properties
' the condition used is: long >= 100 AND integer >= 100 AND date >= Jan 1, 1986
filter.filter.name = LONG_PROPERTY_NAME
filter.filter.value = 100
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
filter.filter.name = INTEGER_PROPERTY_NAME
filterList.Add filter
filter.filter.name = DATE_PROPERTY_NAME
filter.filter.value = CDate(#1/1/1986#)
filterList.Add filter
Set testList = Repos.GetClassObjectsByProperty("", ScriptingClass1, _
"", filterList, sortList)
filter.filter.name = LONG_PROPERTY_NAME
filter.filter.value = 100

418

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Example Code
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
Set testList = Repos.GetClassObjectsByProperty("", ScriptingClass1, _
"E%e%", filterList, sortList)
' request sorted results
filterList.Clear
filter.filter.name = LONG_PROPERTY_NAME
filter.filter.value = 100
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
sortKey.name = STRING_PROPERTY_NAME
sortList.Add sortKey
Set testList = Repos.GetClassObjectsByProperty("", ScriptingClass1, _
"", filterList, sortList)
' test fetching DIM objects
filterList.Clear
filter.filter.name = "SynchronizationLevel"
filter.filter.value = 1
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
sortList.Clear
Set testList = Repos.GetClassObjectsByProperty("", TableClassID, _
"", filterList, sortList)
Exit Sub
End Sub

Replacing/Removing Objects from a Collection


This section shows example code of replacing and removing objects from a collection.
'///////////////////////////////////////////////////////////////////
'
'
TestReplaceCollection
'
'///////////////////////////////////////////////////////////////////
Sub TestReplaceCollection()
Dim
Dim
Dim
Dim
Dim

errorExpected As Boolean
keyList As New MetaInfoKeyList
testList As MetaInfoKeyList
key As New MetaInfoKey
info As MetaInfoKey

key.ObjectID = Class1Obj1
keyList.Add key
key.ObjectID = Class1Obj2
keyList.Add key
key.ObjectID = Class1Obj3

Teradata Meta Data Services Programmer Guide

419

Chapter 14: MetaCOMExport Library


Example Code
keyList.Add key
key.ObjectID = Class1Obj4
keyList.Add key
Repos.ReplaceCollection DESTINATION, Class0Obj5, "", RelID_Class0Class1, _
keyList
Exit Sub
End Sub
'///////////////////////////////////////////////////////////////////
'
' RemoveManyFromCollection
'
'///////////////////////////////////////////////////////////////////
Sub RemoveManyFromCollection()
Dim
Dim
Dim
Dim

keyList As New MetaInfoKeyList


testList As New MetaInfoKeyList
info As MetaInfoKey
key As New MetaInfoKey

key.ObjectID = Class2Obj7
keyList.Add key
key.ObjectID = Class2Obj8
keyList.Add key
Repos.RemoveManyFromCollection DESTINATION, Class1Obj5, _
"", RelID_Class1Class2, keyList, 0
Exit Sub
End Sub

Reading an Object
This section shows example code of reading an object.
'////////////////////////////////////////////////////////////////////////
'
'
ReadObject
'
'////////////////////////////////////////////////////////////////////////
Public Sub ReadObject (ObjectID As Long)
Dim info As New MetaInfo
info.ObjectID = ObjectID
Repos.ReadObject info
End Sub

Example C++ Code


The following examples assume you have used the "import" MS complier directive to read the
MetaCOMExport21 type library, and add any import settings you desire for your own
situation. For example, if you have installed MDS in the usual place on the C drive, and wish

420

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Example Code

to use a namespace of "tdmds" rather than "METACOMEXPORT21Lib", you would add the
following statement to your code:
#import "C:\Program Files\Teradata\Meta Data Services\bin\metacomexport21.dll" \
rename_namespace("tdmds")

From the TLI and TLH files that are generated, you can use the appropriate interface-class
smart pointers to declare interface classes, and make the property and method calls on those
interfaces.
Initialization
The following code declares and creates an IMetaActive interface pointer from the MetaActive
coclass object. It then makes a call to the Initialize and DeInitialize routines of the IMetaActive
interface.
// If you use "using namespace tdmds;" you could drop the scope-resolution
// qualifier "tdmds::" from the code below.
// The IMetaActivePtr "smart pointer" below is defined in the TLH file created
// as a result of the "import" statement.
tdmds::IMetaActivePtr ipRepos;
try {
HRESULT hr = ipRepos.CreateInstance(__uuidof(tdmds::MetaActive));
if ( FAILED(hr) ) _com_issue_error(hr);
ipRepos->Initialize(_bstr_t("metasu"), _bstr_t("metasu"));
// Other repository actions...
ipRepos->DeInitialize();
}
catch(_com_error& e)
{
// Handle the COM error...
}

Read Model Classes and Class Properties


The following routine demonstrates a way to enumerate through a Model's Classes and the
Properties for each Class. We assume that the "import" statement shown above appears before
this routine and that this is an MFC application. Note that the two "while" loops are effectively
the equivalent of the Visual Basic "for-each" loop. The Initialize/DeInitialize calls would
probably be done at the application level.
using namespace tdmds;
HRESULT ClassesAndProperties(LPCTSTR strModelName) {
// All the IMeta*Ptr variables below are smart pointers created by the
// #import statement (in the *.tli or *.tlh files).
IMetaActivePtr ipMetaAct;
IMetaModelInfoPtr ipModel;
// MDS COM Collections next:
IMetaClassInfoListPtr ipClassList;

Teradata Meta Data Services Programmer Guide

421

Chapter 14: MetaCOMExport Library


Example Code
IMetaPropertyInfoPtr ipPropInfo;
HRESULT hr = S_OK;
try
{
CString msg;
hr = ipMetaAct.CreateInstance(__uuidof(MetaActive));
if ( FAILED(hr) ) throw(hr);
hr = ipModel.CreateInstance(__uuidof(MetaModelInfo));
if ( FAILED(hr) ) throw(hr);
// Initialize first
ipMetaAct->Initialize(_T("metasu"), _T("metasu"));
// If this were an IMetaInfo object, we would need more than just the name,
// but since this is an IMetaModelInfo, the Name is enough.
ipModel->PutName(strModelName);
// The VARIANT_TRUE parameter requests
// that the Relationships and Classes be read also.
ipModel->Read(VARIANT_TRUE);
// Get the Classes for this model in our Class-list (interface) variable.
ipClassList = ipModel->GetClassList();
if ( ipClassList->GetCount() )
{
_variant_t var;
IEnumVARIANT* ipClsEnum = NULL;
IUnknownPtr ipClsUnk;
ipClsUnk = ipClassList->Get_NewEnum();
CString msgCls;
msg.Format("Classes for meta-model <%s>:\n",
(LPCTSTR)ipModel->GetName());
hr = ipClsUnk->QueryInterface(&ipClsEnum);
while ( ipClsEnum->Next(1, &var, NULL) != S_FALSE )
{
IMetaClassInfoPtr ipClsInfo;
ipClsInfo = var;
var.Clear();
CString classMsg;
// Get the class info and Property list for this class
ipClsInfo->Read(VARIANT_TRUE);
_bstr_t aimClass = ipClsInfo->GetName();
long clsID = ipClsInfo->GetObjectID();
classMsg.Format("%s [%d]\n", (LPCTSTR)aimClass, clsID);
IMetaPropertyInfoListPtr ipPropertyList;
ipPropertyList = ipClsInfo->GetPropertyList();

422

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Example Code
long cntProp;
cntProp = ipPropertyList->GetCount();
if ( cntProp )
{
// Can iterate thru via GetItem() or VB-style NewEnum()
_variant_t var;
IEnumVARIANT* ipEnum = NULL;
IUnknownPtr ipPropUnk;
classMsg += " Properties :\n";
ipPropUnk = ipPropertyList->Get_NewEnum();
hr = ipPropUnk->QueryInterface(&ipEnum);
while ( ipEnum->Next(1, &var, NULL) != S_FALSE )
{
ipPropInfo = var;
var.Clear();
CString propMsg;
_bstr_t propName(ipPropInfo->GetName());
long id = ipPropInfo->GetIdentifier();
propMsg.Format(" %s [%d]\n",
(LPCTSTR)propName, id);
classMsg += propMsg;
}
ipEnum->Release();
}
::AfxMessageBox(classMsg);
}
ipClsEnum->Release();
}
// Can DeInit now if desired
ipMetaAct->DeInitialize();
}
catch(HRESULT hr)
{
// Handle HRESULT error...
}
catch(const _com_error& e)
{
// Display _com_error...
CString errMsg;
errMsg.Format(_T("COM call FAILED: %s [0x%X]\n"), (LPCTSTR)e.Description(),
e.Error());
::AfxMessageBox(errMsg);
hr = e.Error();
}
return hr;
}

Teradata Meta Data Services Programmer Guide

423

Chapter 14: MetaCOMExport Library


Example Code

Add a User or Group to a Security Profile


The following routine updates a user or group access type for a Security Profile. If the user/
group is not already in the permission list, it will be added. Note that the GetObjectID call
does NOT throw an error if the object id requested is not found, it simply returns 0. As usual,
we assume the "import" statement appears somewhere before this code. The Initialize/
DeInitialize calls would probably be done at the application level.
using namespace tdmds;
HRESULT UpdateSecProfileAccessType (
LPCTSTR ugName, // Name of the User/Group to update
AccessType access, // (New) Access type of the user/group
bool bUser, // true for user, false for group
LPCTSTR spName // Name of the SecProfile to update
{
HRESULT hr = S_OK;
VARIANT_BOOL IsUser = bUser == true ? VARIANT_TRUE : VARIANT_FALSE;
long idUG;
long idSP;
try {
IMetaActivePtr ipRepos(__uuidof(MetaActive));
// Initialize with the Repository.
ipRepos->Initialize(L"metasu", L"metasu");
// Get the Class ID for the user / group -- these are in metaglobals.h
long idCls = bUser ? CLSLOID_UserClass : CLSLOID_ApplicationGroupClass;
// Get User / Group Object ID
idUG = ipRepos->GetObjectID(L"", L"", idCls, ugName);
if ( idUG == 0 ) {
::AfxMessageBox("User/Group not in the Repository");
return;
}
// Get the SecProfile Object ID -- the SecProf CLSLOID is in metaglobals.h
idSP = ipRepos->GetObjectID(L"", L"",
CLSLOID_SecurityProfileClass, spName);
if ( idSP == 0 ) {
::AfxMessageBox("Security Profile not in the Repository");
return;
}
// Create the Security Profile and SP Entry objects
IMetaSecProfEntryPtr ipSPE(__uuidof(MetaSecProfEntry));
IMetaSecProfInfoPtr ipSP(__uuidof(MetaSecProfInfo));
// Set the values for the entry will we will be updating below.
ipSPE->SetEntryValues(IsUser, idUG, access);
// Read in our Sec Prof., update the entry in its permission list,
// and Write it back out to the Repository.
ipSP->PutObjectID(idSP);
ipSP->Read();
ipSP->UpdatePermission(ipSPE);
ipSP->Write();

424

Teradata Meta Data Services Programmer Guide

Chapter 14: MetaCOMExport Library


Example Code
// Can DeInit now if desired
ipRepos->DeInitialize();
}
catch(const _com_error& e)
{
// Display _com_error...
CString errMsg;
errMsg.Format(_T("COM call FAILED: %s [0x%X]\n"), (LPCTSTR)e.Description(),
e.Error());
::AfxMessageBox(errMsg);
}
}

Teradata Meta Data Services Programmer Guide

425

Chapter 14: MetaCOMExport Library


Example Code

426

Teradata Meta Data Services Programmer Guide

CHAPTER 15

MetaXML Scripting Interface

This chapter describes the MetaXML scripting interface. The scripting interface provides a
non-programmatic means for importing and updating meta data in the MDS repository.
The scripting interface uses the Extensible Markup Language (XML) as the method for
putting structured data in a text file. The World Wide Web Consortium (W3C) considers
XML to be the universal format for structured documents and data on the Web. The Meta
Data Coalition has defined XML as the standard format for the interchange of meta data for
the Meta Data Coalition Open Information Model.
This chapter contains the following information:

XML Overview

XML Example Files

Since release 13.00, this MetaXML utility supports the export of metamodels or meta data
objects out of the repository.
To export repository objects (using -ocoll or -mcoll parameters), a supported version of the
Java JRE must be installed and have its JVM DLL path added to the user's PATH environment
variable through the Control Panel.
Supported Java Runtime Environments (JREs) are from Sun Microsystems: 1.5.0 update 6 or
later and 1.6.0 update 3 or later, and from IBM (WebSphere/Eclipse): 1.5.0.
The Sun Microsystems JVM DLL is located in JRE_HOME\bin\client and the IBM JVM DLL
is in JRE_HOME\bin\j9vm. Any one of these three JREs can be used but the JVM DLL should
come from the selected JRE_HOME of whichever one is being used.
The export results in an XML file that is valid against the schema and DTD that the "import"
uses. See Scripting Interface Steps on page 429 for more information.
This utility uses the MSXML 4.0 SP2 or 6.0 parser. These parsers support Unicode and all the
accompanying encodings. If you do not have this installed on your system, you will get an
error trying to run metaxml. Download the MSXML 4.0 or 6.0 parser from the Microsoft
download web site. It is not necessary to also install the SDK that comes with the download.

XML Overview
XML lets the designer define tags, used to mark up data to indicate what the data means. Tags
come in pairs a begin tag and an end tag. Each tag is enclosed by angle brackets. End tags are
named the same as their corresponding begin tags except that the end tags name is prefixed by

Teradata Meta Data Services Programmer Guide

427

Chapter 15: MetaXML Scripting Interface


XML Overview

a slash. The content between a matching begin and end tag is called an element. For example,
an XML designer could define an address element to have a structure like
<address>
<name>Teradata Corporation</name>
<street>17095 Via Del Campo</street>
<city>San Diego</city>
<state>CA</state>
<zip>92127</zip>
</address>

The designer defines the names of the tags, what each tag contains (other tags, raw character
data, or a mixture), what order they appear in, whether they are required or optional, how
many occurrences of each are allowed, etc. This is basically the task of defining a grammar.
XML grammars are defined using a special syntax in a file called a document type definition
(DTD) that can be used by an XML parser to ensure that an XML input document conforms
to the grammar.
The XML governing bodies have recently defined a "schema definition", also known as an
XSD for XML Schema Definition. A schema definition is in XML format (the DTD has its
own unique format), and allows for more precise data definitions and specifications. As of the
6.1 release, MDS provides for a schema definition which is the equivalent of the DTD (which
is still provided). The DTD and schema files are installed in the %METAHOME%\bin
directory. The DTD is named metaxml21.dtd, and the schema is contained in two files:
metaxml21.xsd and its included file types21.xsd. The use may use either, but the schema file is
recommended due to its ability to more precisely describe the syntax. See the XML sample
files (or any XML documentation) for examples on how to include DTD or XSD definitions in
your XML file.
Like HTML tags, XML tags may have attributes. The DTD or XSD allows the designer to
specify attribute names, broad data types, default values, and whether or not individual
attributes are required or optional. XML attributes appear inside the tag to which they apply.
An example of an XML representation of a geometric shape that uses attributes is
<circle color=red,
xcoord=200,
ycoord=150,
radius=25>
</circle>

The first attribute is color, and it has the value red. The circle representation shown is an
example of an empty element, meaning there is no content between the begin and end circle
tags. For convenience, XML allows the abbreviation of empty elements with the syntax
<circle color=red,
xcoord=200,
ycoord=150,
radius=25/>

(slash at the end, no separate end tag).


All tag and attribute names are case-sensitive.
The specification for XML can be found on the web at http://www.w3.org/TR/1998/REC-xml19980210.

428

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview

Scripting Interface Steps


To import objects into the repository with the MDS XML scripting interface:
1

Create an XML script to import AIMs, MDS users, and application groups and import,
update or delete user-defined objects and collections.

Run the metaxml utility and specify the name of the XML script to import the data from
the script. The syntax is:
metaxml import mdsUser mdsPassword xml_filename

The usual MDS permissions apply to being able to import data into the MDS repository.
See the Teradata Meta Data Services Administrator Guide for more information on running
the metaxml utility.

To export objects from the repository with the MDS XML scripting interface:
Run the metaxml utility and identify the MDS metamodel name(s) or meta data objects

on the command-line as one of the parameters to the metaxml utility as part of the
"export" request.
metaxml export mdsUser mdsPassword {-ocoll <objectID> | -mcoll <AIM_name> | -model <name>}ofile <XML output file> [-v] [-l <label>]
Table 48: metaxml Export Input Parameters

Parameter

Description

export

The export command indicates that metaxml is to be used to export a


metamodel definition (not meta data) from the repository into an
XML file.

mdsPassword

Password of the MDS user

mdsUser

Name of a valid Meta Data Services repository user.

-ocoll objectID

Identifies the Object ID of the repository object from which to start


the export. This object, and all its destination collection objects, will
be included in the resulting XML file.

-mcoll AIM_Name

Identifies the name of the AIM (metamodel) whose objects will be


exported. Every object from each class in the AIM will be exported
into the resulting XML file, and all object associations will be
identified.
Note: Object associations to/from classes within other metamodels
are ignored and a warning is displayed to that effect.

-model name

Teradata Meta Data Services Programmer Guide

Identifies the name of the meta model to export. All classes, class
properties and relationships of the named meta model will be
included in the resulting XML file

429

Chapter 15: MetaXML Scripting Interface


XML Overview
Table 48: metaxml Export Input Parameters (continued)

Parameter

Description

-ofile XML output


file

Identifies the XML file name into which the objects will be exported.
If the filename is not fully qualified, the file will be created in the
current directory.
If the file exists, it will be over-written without warning

-v

(Optional) Requests that the utility output more verbose information


to the console. The utility shows only a minimal amount of progress
information if not used.
Note: Parameter is ignored when exporting metamodels with the
-model parameter.

-l label

(Optional) Specifies the name of the label to use in finding the object
versions to export. When used, only the particular version of each
object in the destination collection which has the label applied, if any,
will be exported to the output file.
In a versioned repository, if the source object itself does not have the
label applied to any of its versions, no objects will be exported, and a
warning message will indicate this. When no label is specified, the
latest (or published) version of each object is exported.
Note: Parameter is ignored when exporting metamodels with the
-model parameter.

If only one metamodel is listed for the export, the resulting XML file has the same name as the
metamodel name adding an XML extension; if more than one metamodel is listed, the
resulting XML file is named mdsexport.xml. In either case, the file is placed in the same
directory from where the request is run. Also, the XSD file is added and assumed to be in the
standard location; this can be changed as necessary or desired, of course.
The usual MDS permissions apply to being able to export data out of the MDS repository.
See the Teradata Meta Data Services Administrator Guide for more information on running
the metaxml utility.

Structure of XML Files


The DTD/XSD files that define the grammar for MDS are named metaxml21.dtd and
metaxml21xsd, respectively, they reside in the <MDS Installation Directory>\bin folder. The
DTD file also defines aliases for ODBC data types (SQL_VARCHAR, etc.), and variant types
(VT_I2, etc.) needed to create/define repository AIM components.
XML scripts must be in separate files. These scripts will specify the MDS DTD or XSD as the
grammar for the document and optionally will import user-defined aliases from another file
and/or create user-defined aliases in-line.
A sample XML file structure that specifies the DTD as the file metaxml21.dtd in the current
folder is shown below. The body of the XML script would be placed between the start and end
<METAXML> tags and can consist of any mixture of XML and aliased references conforming
to the MDS XML grammar.

430

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE METAXML SYSTEM "metaxml21.dtd">
<METAXML version= "6.1">
<!-- Body of XML script: -->
</METAXML>

A sample XML file structure that specifies the XSD as the file metaxml21.xsd in the current
folder is shown below. The body of the XML script would be placed between the start and end
<METAXML> tags and can consist of any mixture of XML and aliased references conforming
to the MDS XML grammar.
<?xml version="1.0" encoding="UTF-8"?>
<METAXML version="6.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="metaxml21.xsd">
<!-- Body of XML script: -->
</METAXML>

MDS DTD/Schema Elements


The METAXML element is the XML root element as defined in the XML 1.0 Specification.
From the METAXML element, there are several elements that describe the MDS repository,
and one that is used to set file preferences.

MODELDESCS - Enables importing an AIM into the MDS repository.

MODELDATA - Enables creating, updating and deleting user-defined objects and


collections in the MDS repository.

METAUSERS - Enables creating one or more MDS users in the MDS repository.

METAGROUPS - Enables creating one or more MDS application groups in the MDS
repository.

SECURITYPROFILES Enables creating, removing and modifying MDS Security Profiles.

METALABELS - Enables creating, removing and modifying Labels.

PREFERENCES Enables the user to specify default settings for several attributes.

These elements are described in the following sections.


Object Identifiers
The XML import interface allows the use of MDS object GUIDs as object identifiers in
addition to using the internal integer object IDs. The use of GUIDs to identify repository
objects can be more convenient to the user for two reasons:
1

GUIDs are user-assignable and thus easily referenced across different XML scripts, and

GUIDs are unique across MDS repository instances and thus compatible with a future
implementation of XML export in MDS.

XML allows definition of aliases (called entities) for any string of text, enabling users to define
symbolic name aliases for GUIDs. In addition, the XML import interface processing of GUIDs
allows both upper- and lower-case hexadecimal digits (0-9, A-F, a-f) as well as embedded
hyphens and white space to make the GUIDs themselves more readable.

Teradata Meta Data Services Programmer Guide

431

Chapter 15: MetaXML Scripting Interface


XML Overview

An example of a defining GUID alias is


<!ENTITY CLSGUID_MetaAIMClass "{C3AD1324-472C-11D1-9E85-0000C071AADA}">

Entities can be referred by name anywhere in an XML file by prefixing the symbolic alias name
with an ampersand and suffixing it with a semicolon. Thus, the above GUID alias can be used
in the XML file via the syntax
&CLSGUID_MetaAIMClass;

PREFERENCES Element for Setting File Defaults


The PREFERENCES element is used to toggle settings for the "action" and "transaction"
attributes. It can also be used to set the default behavior of the "update" action.
Example XML script:
<PREFERENCES DefaultAction="traverse" UpdateBehavior="strict" DefaultTxn="yes"/>
<!-- or in another case... --!>
<PREFERENCES DefaultAction="add" UpdateBehavior="upsert" DefaultTxn="no"/>

DTD:
<!ELEMENT PREFERENCES EMPTY>
<!ATTLIST PREFERENCES
DefaultAction (traverse | add | remove | update) #IMPLIED
UpdateBehavior (upsert | strict | upsertVersion | strictVersion) #IMPLIED
DefaultTxn (no | yes) #IMPLIED
>

Elements and Attributes

Description

PREFERENCES

Used to set user defaults.

DefaultAction

If present, sets the "action" for all elements from now to


the end of the file, or the next preferences setting. The
allowed values are the same as those for the "action"
attribute itself. See Action Attribute Settings below for
details on the settings of the "action" attribute itself.

UpdateBehavior

If present, sets the current default behavior for the


"update" action. There are four settings "upsert" (the
initial default), "strict", "upsertVersion" and
"strictVersion". See "update" in the Action Attribute
Settings below for more information on this attribute.
This is the only place where the behavior of the
"update" action can be specified.

DefaultTxn

If present, sets the "transaction" default setting. See


Transactions on page 456 for more details on the
"transaction" attribute itself.

Action Attribute Settings


Nearly all elements of the metaxml script accept the "action" attribute. This attribute and its
setting direct metaxml what to do with the element with respect to the MDS repository. There
are four settings allowed: "add," "remove," "update," and "traverse".

432

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview

The following action attribute values are allowed:


Action Attribute
Values

Description

Traverse

This is the initial default for the file. It is intended to be used on alreadycreated objects for which no repository action is to be taken at this time.
The metaxml engine merely identifies that they exist, and continues on.
This is especially convenient for files that are re-used many times.
Existing objects can be left untouched while new ones are added, others
deleted and others updated. Objects that are not found will generate an
error message.

Add

This action will cause a new object to be added to the MDS repository.
For meta-model elements (MODELDESC, CLASSDESC, etc.) if an
object of the same name already exists in the class, this is an error.
However, for the meta-data element (OBJECT), addition of a new object
of the same name depends on whether or not the class or (for
relationships) collection class allows duplicate names. (This is different
from the 2.0 release where an action of "add" would also update an
existing object if found. As of the 2.1 release, this is a specific action of the
"update" setting.)

Update

To allow the user the more flexibility, this action comes in four behaviors
two of which are: "upsert" and "strict". The default behavior is "upsert"
which means that for object updates, the object will be looked for first,
and if found, updated. But if the object is not found, a new one will be
created. (This was the "add" action for the 2.0 release.) On the other
hand, if the behavior is set to "strict" and the action is "update", the object
must be found or an error will be generated. (The behavior can be set
only by the PREFERENCES DefaultBehavior attribute, q.v.) In a
repository with versioning enabled, "update" causes a new version of an
existing object to be created.
As of MDS 6.1, there is a variation to each of these two behaviors, that
applies to repositories with versioning enabled, and they are
"upsertVersion" and "strictVersion".
In a repository with versioning enabled, if an existing object is to be
updated, but the user wishes the current version be re-written rather than
a new version created, they must use one of these behaviors in place of
the two described above. This action effectively overrides the default
behavior of object updates for a versioned repository, which is to create a
new version of an object (with a new object id) anytime an object is
updated.
Note: The only objects in the repository that are versioned are meta data
objects, not metamodel objects (AIMs, classes, properties, relationships,
users, groups or security profiles).

Remove

This action setting will cause metaxml to attempt to remove the object
from the MDS repository. If it is not found, it will generate an error
message.
For repositories with versioning enabled, this means deleting all versions
of the object from the repository

Teradata Meta Data Services Programmer Guide

433

Chapter 15: MetaXML Scripting Interface


XML Overview

An element's action attribute, if present, will always override the current default setting. In
this way, a DefaultAction can be set for a file that deals with most of the elements in the file,
while those elements that are to be dealt with differently can have their action set to whatever
is appropriate, and presumably, different from the default.
Elements for Importing AIMS
MODELDESC

The MODELDESC element enables importing an AIM into the MDS repository. This element
is a child of the MODELDESCS element. There can be more than one MODELDESC
contained within the MODELDESCS element.
Example XML script:
<MODELDESC>
<NAME>AutoWorld</NAME>
<DESCRIPTION>The World of Auto and AutoMakers</DESCRIPTION>
<CLASSDESC linkid="AM">
<NAME>AutoMaker</NAME>
<!- More elements -->
</CLASSDESC>
<CLASSDESC linkid="AU">
<NAME>Auto</NAME>
<!- More elements -->
</CLASSDESC>
<RELATIONSHIPDESC>
<NAME>ManufOfAutos</NAME>
<!- More elements -->
</RELATIONSHIPDESC>
<DERIVEDCLASSDESC>
<NAME>AutoEx</NAME>
<!- More elements -->
</DERIVEDCLASSDESC>
</MODELDESC>

DTD:
<!ELEMENT MODELDESCS (PREFERENCES*, MODELDESC)+>
<!ELEMENT MODELDESC (NAME, DESCRIPTION, OBJECTGUID?, OWNER?, VERSIONING?,
(SECURITYPROFILENAME |
SECURITYPROFILEREF)?, PREFERENCES*, CLASSDESC*, PREFERENCES*, RELATIONSHIPDESC*,
PREFERENCES*,DERIVEDCLASSDESC*)>
<!ATTLIST MODELDESC
linkid ID #IMPLIED
action (traverse | add | remove | update) #IMPLIED
transaction (no | yes) #IMPLIED
aimversion CDATA #IMPLIED
>
<!ELEMENT VERSIONING EMPTY>
<!ATTLIST VERSIONING
set (on | off) #REQUIRED
deleteObjects (no | yes) "no"
>

434

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

MODELDESC

Used to create, update, or delete a model

NAME, DESCRIPTION,
OBJECTGUID, OWNER,
(SECURITYPROFILENAME |
SECURITYPROFLEREF)

Specifies the values for the Model common properties.


Name and description are required. The owner will
default to the MDS user running the script. The
OBJECTGUID will be supplied by the MDS engine by
default. The default Security Profile is
MDSDefaultSecurityProfile.

linkid

If defined, maps the linkid string to the model identifier


for later reference.

action

Is used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.) When set to update, only the Name,
Owner, Description and Security Profile can be
modified. Any other modified values will be ignored.
Note that if the name is to be changed, the GUID must
be present.

transaction

Is used to override the current default setting. (See


Transactions on page 456 for more details.)

aimversion

The integer value of the version of the metamodel.


Setting this value is optional, and is NULL in the
repository until set by the user. When importing, if a
value is present and the current action is add or
update, the value is set for the metamodel repository
object. If the current action is traverse or remove,
the value is ignored.
The meaning of the value is solely determined by the
user, but the intended use is to track the version of the
user-defined metamodel (AIM), when such tracking is
necessary.
This value maps directly to the AIMVersion property of
the MetaAIMClass in the MDSMetamodel.
Note: Do not modify the aimversion value of any
MDS-defined metamodel.

Teradata Meta Data Services Programmer Guide

435

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

VERSIONING

For repositories with versioning enabled, this is used to


set versioning for the metamodel. The element has no
value, but two attributes: "set" and "deleteObject". The
values of "set" are 'on' or 'off ' to indicate that versioning
should be set on or off for the metamodel. The
"deleteObjects" attribute can be set to 'yes' to indicate
that when versioning is 'off ', or being set 'off ', all noncurrent versions of every object in the metamodel will be
deleted. This will leave only the most recent version of
each object, and they will each have their version set to
"1". Otherwise, no versions of any object will be
removed and all will retain their version number.
For a repository with versioning enabled, when a
metamodel has versioning set "on" (the default), all
classes will also have versioning "on" by default. This
means that all objects in the classes will be versioned.
When a metamodel has versioning set "off ", all its classes
will have their versioning set "off " also. This means that
all objects created in those classes will not be versioned.
(Note: A class can have its versioning "off " for a
metamodel that has versioning "on", but when a
metamodel has versioning "off ", a class in that
metamodel cannot turn versioning "on" for itself,
versioning must be "on" for the metamodel also.)
Using this element makes sense only for a repository
with versioning enabled. Any attempt to set versioning
"on" for a repository that is not version enabled, will get
an error returned by the MDS engine.
This element is ignored unless the action for the
metamodel is "add" or "update"

CLASSDESC

For each CLASSDESC element tag, identifies a class. See


the CLASSDESC element below.

RELATIONSHIPDESC

For each RELATIONSHIPDESC element tag, identifies a


relationship.
See the RELATIONSHIPDESC element below.

CLASSDESC

The CLASSDESC element enables creating, modifying, or deleting a class description in an


AIMs. This element is a child of the MODELDESC element.
Example XML script:
<CLASSDESC linkid="AM">
<NAME>AutoMaker</NAME>
<DESCRIPTION>Class contains Auto Makers</DESCRIPTION>
<UNIQUENAMING enable="yes"/>
<ROOTCLASS type="yes"/>
<!-- No unique properties -->
</CLASSDESC>
<CLASSDESC linkid="AU">

436

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview
<NAME>Auto</NAME>
<DESCRIPTION>Class contains Autos</DESCRIPTION>
<UNIQUENAMING enable="no"/>
<PROPERTYDESC>
<!-- More elements -->
</PROPERTYDESC>
</CLASSDESC>

DTD:
<<!ELEMENT CLASSDESC (NAME, DESCRIPTION, OBJECTGUID?, UNIQUENAMING?, OWNER?, VERSIONING?,
(SECURITYPROFILENAME | SECURITYPROFILEREF)?, ROOTCLASS?, ABSTRACTCLASS?, SUPERCLASSES?,
PROPERTYDESC*)>
<!ATTLIST CLASSDESC
linkid ID #IMPLIED
action (traverse | add | remove | update) #IMPLIED
transaction (no | yes) #IMPLIED
>
<!ELEMENT ROOTCLASS EMPTY>
<!ATTLIST ROOTCLASS
type (no | yes) #REQUIRED
>
<!ELEMENT ABSTRACTCLASS EMPTY>
<!ATTLIST ABSTRACTCLASS
type (no | yes) #REQUIRED
>
<!ELEMENT OBJECTDESCS EMPTY>
<!ATTLIST OBJECTDESCS
required (no | yes) #REQUIRED
>
<!ELEMENT SUPERCLASSES (SUPERCLASS+)>
<!ELEMENT SUPERCLASS EMPTY>
<!ATTLIST SUPERCLASS
linkref IDREFS #IMPLIED
objid CDATA #IMPLIED
>

Elements and Attributes

Description

CLASSDESC

Used to create, update or delete a class description.

NAME, DESCRIPTION,
OBJECTGUID, OWNER,
(SECURITYPROFILENAME |
SECURITYPROFLEREF)

Specifies the values for the Class common properties.


Name and description are required. The owner will
default to the MDS user running the script. The
OBJECTGUID will be supplied by the MDS engine by
default. The default Security Profile is
MDSDefaultSecurityProfile.

UNIQUENAMING

Set <UNIQUENAMING enable="yes"/> to require


unique object names in the class. Omit or set
<UNIQUENAMING enable="no"/> to disable unique
naming checks.

ROOTCLASS

Set <ROOTCLASS type="yes"/> to set this class


description as a root class. Omit or set <ROOTCLASS
type="no"/> if this is not a Root Class.

Teradata Meta Data Services Programmer Guide

437

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

linkid

If defined, maps the linkid string to the class identifier for


later reference.

ABSTRACTCLASS

Set <ABSTRACTCLASS type="yes"/> to set this class


description as an abstract class. An abstract class cannot
contain any objects; it is meant to be a super class of other
classes, which inherit its properties.
Omit or set < ABSTRACTCLASS type="no"/> if this is
not an abstract class.

OBJECTDESCS

Use this element with the required attribute set to "yes", to


indicate that *all* objects in this class must have nonNULL Descriptions. This can be set both at class creation
and when updating the class.
The default value (i.e. when the element is not used), is
that object Descriptions are not required. When the
element is specified, the required attribute must also be
specified.
Note that if this is used when updating a class to change it
from not required to required, and there are objects in the
class that currently do *not* have a non-NULL
Description, the update will fail with an engine error
indicating that there are objects which do not have their
Description set non-NULL.

438

SUPERCLASSES

Use the SUPERCLASSES element to list the super classes


for this class, by specifying each super class as a
SUPERCLASS child element. The class will inherit both
the properties and relationships of each super class.

action

Is used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.) When set to update, only the Name,
Owner, Description, Superclass and Security Profile can
be modified. Any other modified values will be ignored.
Note that if the name is to be changed, the GUID must be
present.

transaction

Is used to override the current default setting. (See


Transactions on page 456 for more details.)

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

VERSIONING

For repositories with versioning enabled, this is used to


set versioning for the class. The element has no value, but
two attributes: "set" and "deleteObject". The values of
"set" are 'on' or 'off ' to indicate that versioning should be
set on or off for the class. The "deleteObjects" attribute
can be set to 'yes' to indicate that when versioning is 'off ',
or being set 'off ', all non-current versions of every object
in the class will be deleted. This will leave only the most
recent version of each object, and they will each have their
version set to "1". Otherwise, no versions of any object
will be removed and all will retain their version number.
For a repository with versioning enabled, when a class has
versioning set "on" (the default), all objects in the class
will be versioned. When a class has versioning set "off ",
the objects in the class will not be versioned. (Note: A
class can have its versioning "off " for a metamodel that
has versioning "on", but when a metamodel has
versioning "off ", a class in that metamodel cannot turn
versioning "on" for itself, versioning must be "on" for the
metamodel also.)
Using this element makes sense only for a repository with
versioning enabled. Any attempt to set versioning "on" for
a repository that is not version enabled, we get an error
returned by the MDS engine.
This element is ignored unless the action for the
metamodel is "add" or "update."

PROPERTYDESC

For each PROPERTYDESC element tag, identifies a


property description in the class. (See the
PROPERTYDESC element).

PROPERTYDESC

The PROPERTYDESC element enables creating, modifying or deleting a property of a class in


an AIM. This element is a child element of the CLASSDESC element. One PROPERTYDESC
element would be needed for each unique property for the class.
Example XML script:
<PROPERTYDESC>
<NAME>CarId</NAME>
<PROPERTYID>501</PROPERTYID>
<DESCRIPTION>CarId description</DESCRIPTION>
<SQLTYPE type="SQL_BINARY"/>
<VARIANTTYPE type="VT_BINARY"/>
<PROPSIZE/>
</PROPERTYDESC>
<!-- Other properties... -->
<PROPERTYDESC>
<NAME>Review</NAME>
<PROPERTYID>508</PROPERTYID>
<DESCRIPTION>Review Description</DESCRIPTION>
<SQLTYPE type="SQL_CHAR"/>

Teradata Meta Data Services Programmer Guide

439

Chapter 15: MetaXML Scripting Interface


XML Overview
<VARIANTTYPE type="VT_STRING"/>
<PROPSIZE>20000</PROPSIZE>
<CHARACTERSET>Latin</CHARACTERSET>
</PROPERTYDESC>

DTD:
<!ELEMENT PROPERTYDESC (NAME, PROPERTYID, DESCRIPTION, SQLTYPE, VARIANTTYPE, OBJECTGUID?,
OWNER, (SECURITYPROFILENAME | SECURITYPROFILEREF)?, PROPSIZE?, DECIMALDIGIT?,
CHARACTERSET?)>
<!ATTLIST PROPERTYDESC
linkid ID #IMPLIED
action (traverse | add | remove | update) #IMPLIED
transaction (no | yes) #IMPLIED
>
<!ELEMENT DECIMALDIGIT (#PCDATA)>
<!ELEMENT PROPSIZE (#PCDATA)>
<!ELEMENT NAME (#PCDATA)>
<!ELEMENT SQLTYPE EMPTY>
<!ATTLIST SQLTYPE
type (SQL_CHAR | SQL_NUMERIC | SQL_DECIMAL | SQL_INTEGER | SQL_SMALLINT |
SQL_FLOAT | SQL_REAL | SQL_DOUBLE | SQL_DATE | SQL_VARCHAR | SQL_BINARY |
SQL_VARBINARY | SQL_TINYINT | SQL_TIME | SQL_TIMESTAMP) #REQUIRED
>
<!ELEMENT VARIANTTYPE EMPTY>
<!ATTLIST VARIANTTYPE
type (VT_SHORT | VT_INTEGER | VT_DOUBLE | VT_STRING | VT_BOOL | VT_UCHAR |
VT_BINARY | VT_DATE | VT_BYTE) #REQUIRED
>
<!ELEMENT CHARACTERSET (#PCDATA)>
<!ELEMENT VALUEREQUIRED (#PCDATA)>

440

Elements and Attributes

Description

PROPERTYDESC

Used to create, update or delete a property description.

NAME, DESCRIPTION,
OBJECTGUID, OWNER,
(SECURITYPROFILENAME |
SECURITYPROFLEREF)

Specifies the values for the Property common properties.


Name and description are required. The owner will
default to the MDS user running the script. The
OBJECTGUID will be supplied by the MDS engine by
default. The default Security Profile is
MDSDefaultSecurityProfile.

PROPERTYID, SQLTYPE,
VARIANTTYPE, PROPSIZE,
DECIMALDIGIT,
CHARACTERSET

Specifies the values for the property description unique


properties. PropertyID, SQLType and VariantType are
required. See the section on the CMetaClassDesc
CreateMDSPropertyDesc on page 270 for more
information on setting the property description values.

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

VALUEREQUIRED

This element, when present, indicates that a non-NULL


value for this property must be specified. When this
element is not specified, the property value may be
NULL (this is the default).
The text of this element (#PCDATA) identifies the
"PropertyDefaultValue" attribute for the property, and
will be used as the default value for the property for any
existing objects in the class (and any sub-classes) when
this property is added to the class. It must contain a value
and be of the same the type as the property. If the default
value is not specified, the engine will return a
META_E_CREATEPROPERTY_NOT_ALLOWED error.
This attribute cannot be modified after the property has
been created.
Note: This property attribute is inherited by any subclasses of this class.

linkid

If defined, maps the linkid string to the property


identifier for later reference.

action

Is used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.) When set to update, only the Description,
Owner, and Security Profile can be modified. It is not
allowed to change a Property Name.

transaction

Is used to override the current default setting. (See


Transactions on page 456 for more details.)

DERIVEDCLASSDESC

The DERIVEDCLASSDESC element is used to reference derived-classes within an AIM, and is


a child of the MODELDESC element. A derived class inherits directly from a particular class,
called its base class, and so has all the unique properties of that class. It adds "derived"
properties by identifying properties from classes in the base class's relationship chain. These
properties are created using the DERIVEDPROPERTYDESC element.
Note that a derived class cannot be part of a relationship as an origin or destination class, nor
can you add objects to it. Its use is to extend existing classes property lists by adding properties
from their parent classes and it automatically "contains" all the objects of its base class.
Example XML script:
<DERIVEDCLASSDESC>
<!-The AutoEx (derived) class derives from the Auto class
(assumed to be already defined as a class of the AutoWorld model),
so it has all the same properties that Auto has,
and will add two more from the AutoMaker class.
--!>
<NAME>AutoEx</NAME>
<DESCRIPTION>Derived from Autoworld.Auto class</DESCRIPTION>

Teradata Meta Data Services Programmer Guide

441

Chapter 15: MetaXML Scripting Interface


XML Overview
<BASECLASSNAME>Auto</BASECLASSNAME>
<!-- Derived Property Description elements -->
</DERIVEDCLASSDESC>

DTD:
<!ELEMENT DERIVEDCLASSDESC (NAME, DESCRIPTION, BASECLASSNAME, OBJECTGUID?, OWNER?,
(SECURITYPROFILENAME | SECURITYPROFILEREF)?, DERIVEDPROPERTYDESC*)>
<!ATTLIST DERIVEDCLASSDESC
action (traverse | add | remove | update) #IMPLIED
transaction (no | yes) #IMPLIED
>
<!ELEMENT BASECLASSNAME (#PCDATA)>
<!ATTLIST BASECLASSNAME
linkref IDREF #IMPLIED
>

Elements and Attributes

Description

DERIVEDCLASSDESC

Used to reference a derived class description.

NAME, DESCRIPTION,
OBJECTGUID, OWNER,
(SECURITYPROFILENAME |
SECURITYPROFLEREF)

Specifies the values for the Derived Class common


properties. Name and description are required. The
owner will default to the MDS user running the script.
The OBJECTGUID will be supplied by the MDS engine
by default. The default Security Profile is
MDSDefaultSecurityProfile.

BASECLASSNAME

Required child element used to name the base class for


this class.

DERIVEDPROPERTYDESC

Elements referencing the derived properties for this


derived class.

action

Is used to override the current default setting. The value


can be add, remove, update or traverse. (See
Action Attribute Settings on page 432 for more
information.) When set to update, only the Name,
Owner, Description and Security Profile can be
modified. Any other modified values will be ignored.
Note that if the name is to be changed, the GUID must
be present.

transaction

Is used to override the current default setting. (See


Transactions on page 456 for more details.)

DERIVEDPROPERTYDESC

The DERIVEDPROPERTYDESC element is used to reference a (derived) property within a


derived class. This is a child of the DERIVEDCLASSDESC element. In the example below two
"common" properties are derived from of the AutoMaker class.
Example XML script:
<DERIVEDCLASSDESC>
<NAME>AutoEx</NAME>
<DESCRIPTION>Derived from Autoworld.Auto class</DESCRIPTION>

442

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview
<BASECLASSNAME>Auto</BASECLASSNAME>
<DERIVEDPROPERTYDESC>
<!-- Add the "AutoMakerName" property to this derived class -- it is
derived
from the "Name" property of the AutoMaker class of AutoWorld, as
identified
by the "ManufOfAutos" relationship. The Auto class already has 9
properties,
so we add this one as id 510(one after 509).
--!>
<NAME>AutoMakerName</NAME>
<PROPERTYID>510</PROPERTYID>
<DESCRIPTION> The Maunfacture's name for this Auto.</DESCRIPTION>
<BASEPROPERTYNAME>Name</BASEPROPERTYNAME>
<BASERELATIONSHIPNAME>ManufOfAutos</BASERELATIONSHIPNAME>
<!-If there were more relationships needed to get to our base
property's
class, they would be included here in order.
-->
</DERIVEDPROPERTYDESC>
<DERIVEDPROPERTYDESC>
<!-- Add the " AutoMakerDescription " property to this derived class - it is
derived
from the "Description" property of the AutoMaker class of AutoWorld, as
identified by the "ManufOfAutos" relationship.
--!>
<NAME>AutoMakerDescription</NAME>
<PROPERTYID>511</PROPERTYID>
<DESCRIPTION> The Manufacture's description for this auto.</DESCRIPTION>
<BASEPROPERTYNAME>Description</BASEPROPERTYNAME>
<BASERELATIONSHIPNAME>ManufOfAutos</BASERELATIONSHIPNAME>
</DERIVEDPROPERTYDESC>
</DERIVEDCLASSDESC>

DTD
<!ELEMENT DERIVEDPROPERTYDESC (NAME, PROPERTYID, DESCRIPTION, OWNER?, OBJECTGUID?,
(SECURITYPROFILENAME | SECURITYPROFILEREF)?, BASEPROPERTYNAME, BASERELATIONSHIPNAME+)>
<!ATTLIST DERIVEDPROPERTYDESC
action (traverse | add | remove | update) #IMPLIED
>
<!ELEMENT BASEPROPERTYNAME (#PCDATA)>
<!ELEMENT BASERELATIONSHIPNAME (#PCDATA)>
<!ATTLIST BASERELATIONSHIPNAME
linkref IDREF #IMPLIED
>

Elements and Attributes

Description

DERIVEDPROPERTYDESC

Used to reference a derived property description.

Teradata Meta Data Services Programmer Guide

443

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

NAME, DESCRIPTION,
OBJECTGUID, OWNER,
(SECURITYPROFILENAME |
SECURITYPROFLEREF)

Specifies the values for the Derived Property common


properties. Name and description are required. The
owner will default to the MDS user running the script.
The OBJECTGUID will be supplied by the MDS engine
by default. The default Security Profile is
MDSDefaultSecurityProfile.

PROPERTYID

Required child element used to identify this property's


relative ID. Must be an integer number greater than 500
and not currently used within the derived class.

BASEPROPERTYNAME

Required child element that is the name of an existing


property in one of the base class's parent classes. Which
parent class will be identified by the list of
BASERELATIONSHIPNAME elements that follow.

BASERELATIONSHIPNAME

Required element(s) used to list the relationships needed


to identify the property named in the
BASEPROPERTYNAME element. The order is
significant in that it starts from the base class and works
its way back up to the relationship that has as its origin
class, the one that contains the base property.

action

Is used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.) When set to update, only the Description,
Owner, and Security Profile can be modified. It is not
allowed to change a Property Name.

RELATIONSHIPDESC

The RELATIONSHIPDESC element enables creating a relationship in an AIM. This element is


a child of the MODELDESC element. It appears once for each Relationship in the Model
(AIM).
Example XML script:
<RELATIONSHIPDESC>
<NAME>ManufOfAutos</NAME>
<DESCRIPTION>Maps the objects in the AutoMaker class to the objects in the Auto
class.
</DESCRIPTION>
<ORIGINREF linkref="AM"/>
<DESTINATIONREF linkref="AU"/>
<UNIQUENAMING enable="yes"/>
<PROPAGATEDELETE enable="yes"/>
</RELATIONSHIPDESC>

DTD:
<!ELEMENT RELATIONSHIPDESC (NAME, DESCRIPTION, ORIGINREF, DESTINATIONREF, OBJECTGUID?,
UNIQUENAMING?, PROPAGATEDELETE?, OWNER?, (SECURITYPROFILENAME | SECURITYPROFILEREF)?)>
<!ATTLIST RELATIONSHIPDESC
linkid ID #IMPLIED

444

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview
action (traverse | add | remove | update) #IMPLIED
transaction (no | yes) #IMPLIED
>
<!ELEMENT PROPAGATEDELETE EMPTY>
<!ATTLIST PROPAGATEDELETE
enable (no | yes) #REQUIRED
>
<!ELEMENT UNIQUENAMING EMPTY>
<!ATTLIST UNIQUENAMING
enable (no | yes) #REQUIRED
>
<!ELEMENT ORIGINREF EMPTY>
<!ATTLIST ORIGINREF
linkmodel CDATA #IMPLIED
linkclass CDATA #IMPLIED
linkref IDREF #IMPLIED
>
<!ELEMENT DESTINATIONREF EMPTY>
<!ATTLIST DESTINATIONREF
linkmodel CDATA #IMPLIED
linkclass CDATA #IMPLIED
linkref IDREF #IMPLIED
>

Elements and Attributes

Description

RELATIONSHIPDESC

Used to create, update or delete a relationship


description.

NAME, DESCRIPTION,
OBJECTGUID, OWNER,
(SECURITYPROFILENAME |
SECURITYPROFLEREF)

Specifies the values for the Relationship common


properties. Name and description are required. The
owner will default to the MDS user running the script.
The OBJECTGUID will be supplied by the MDS engine
by default. The default Security Profile is
MDSDefaultSecurityProfile.

ORIGINREF

Identifies the origin class of the relationship description.

DESTINATIONREF

Identifies the destination class of the relationship


description.

linkmodel, linkclass

Identifies the origin or destination class by specifying the


model name and class description name of the class

linkref

Identifies the origin or destination class using a


CLASSDESCs linkid.

UNIQUENAMING

Set <UNIQUENAMING enable="yes"/> to require


unique object names in the destination collections of this
relationship. Omit or set <UNIQUENAMING
enable="no"/> to disable unique naming checks.

PROPAGATEDELETE

Set <PROPAGATEDELETE enable="yes"/> to enable


delete propagation for objects in the collections of this
relationship description. Omit or set
<PROPAGATEDELETE enable="no"/> to disable delete
propagation.

Teradata Meta Data Services Programmer Guide

445

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

linkid

If defined, maps the linkid string to the relationship


identifier for later reference.

action

Is used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.) When set to update, only the Name,
Owner, Description, Security Profile and Unique Naming
Values can be modified. Any other modified values will
be ignored. Note that if the Name is to be changed, the
GUID must be present.

transaction

Is used to override the current default setting. If the


transaction attribute is yes begins an explicit
transaction. (See Transactions on page 456 for more
details.)

Elements for Importing User-Defined Objects and Relationships


MODEL

The MODEL element identifies the AIM, which will be used to import the repository. If a
linkref is supplied for the model (referencing a MODELDESC linkid in this file), the
NAME element, while still required for the file to parse correctly, is ignored.
If any APPLYLABEL elements are present, the label(s) indicated will be applied after all CLASS
child elements have completed their actions, whatever they might be. You may look at the
labels as being applied at the time of the close of the MODEL element in the script. The result
of the APPLYLABEL is that the label identified in each APPLYLABEL element is applied to
every object of every class of the metamodel, regardless of whether a class (or any of its
objects) explicitly appears a child of the MODEL element. Also, propagate=yes is always the
default for the MODEL element, and will be ignored by the MDS engine even if set to no.
The label must already exist in the repository or an error will occur.
Example XML script:
<MODEL>
<NAME>AutoWorld</NAME>
<CLASS>
<NAME>AutoMaker</NAME>
<!- More elements identifying AutoMaker objects -->
</CLASS>
</MODEL>

DTD:
<!ELEMENT MODEL (NAME?, APPLYLABEL*, (PREFERENCES*, CLASS+)>
<!ATTLIST MODEL
linkref IDREF #IMPLIED
>

446

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview
CLASS

The CLASS element identifies the class of the data objects to be imported, updated or deleted.
If a linkref is supplied for the class (referencing a CLASSDESC linkid in this file), the
NAME element, while still required for the file to parse correctly, is ignored.
If any APPLYLABEL elements are present, the label(s) indicated will be applied after all
OBJECTLIST OBJECT elements have completed their actions, whatever they might be. You
may look at the labels as being applied at the time of the close of the CLASS element in the
script. The result of the APPLYLABEL is that the label identified in each APPLYLABEL
element is applied to every object in the class, regardless of whether an object explicitly
appears a child of the OBJECTLIST element. Also, the "propagate=yes" attribute value may be
used to propagate the label to all destination objects of the class's objects. The label must
already exist in the repository or an error will occur.
Example XML script:
<CLASS linkref="AU">
<!-The Name is provided, but the "AU" linkid is used to get the Auto class
object ID,saving the lookup of this object in the engine.
(This assumes the Auto class is already identified with a linkid of "AU"
set.)
-->
<NAME>Auto</NAME>
<OBJECTLIST>
<OBJECT>
<! More elements -->
</OBJECT>
<OBJECT>
<!- More elements -->
</OBJECT>
</OBJECTLIST>
</CLASS>

DTD:
<!ELEMENT CLASS (NAME, APPLYLABEL*, OBJECTLIST?)>
<!ATTLIST CLASS
linkref IDREF #IMPLIED
>

OBJECTLIST

The OBJECTLIST element is principally used to group lists of objects via the OBJECT
elements contained in it. For repositories which have versioning enabled, the optional
APPLYLABEL allows the user to apply the indicated label(s) to the list of child OBJECT
elements.
There are two thing to note about the APPLYLABEL element:

All labels indicated will be applied to the list of child elements after the object(s) are acted
on by metaxml. This means that if an object is being updated by the OBJECT element, it is
the updated version that will be labeled.

The label(s) are applied only to the immediate OBJECT child elements of the
OBJECTLIST element.

Teradata Meta Data Services Programmer Guide

447

Chapter 15: MetaXML Scripting Interface


XML Overview

This means is that if some of the OBJECT elements, further identify objects via the
RELATIONSHIP/OBJECT set of elements, the objects of the RELATIONSHIP OBJECT child
elements will not be labeled. However, as with all cases where the APPLYLABEL element
occurs, the user may specify the "propagate=yes" attribute setting to achieve the same effect,
without having to include all those objects in RELATIONSHIP-OBJECT sublists.
DTD:
<!ELEMENT OBJECTLIST (PREFERENCES*, OBJECT*)+>
<!ELEMENT APPLYLABEL (#PCDATA)>
<!ATTLIST APPLYLABEL
propagate (no | yes) "no
>

OBJECT

The OBJECT element identifies the data objects to be imported, updated or deleted. This
element is a child element of the OBJECTLIST element. An OBJECT element will be needed
for each meta data object you want in the class.
The OBJECT element is the only one where the UpdateBehavior settings of "upsertVersion"
and "strictVersion" will be used. This should only be for exceptional cases. See the discussion
in Action Attribute Settings on page 432.
Since objects are typically mapped to or from other objects in other classes, it is natural to
expect that this OBJECT element would be the parent or child of a RELATIONSHIP element
to indicate this mapping.
An exception to this occurs if the relationship is inherited from a super class. In this case, the
proper class for the object cannot be determined (it may have come form any number of subclasses). The result is that, to add objects to relationships that are inherited, two steps need to
be performed:
1

The object needs to be created/identified the usual way in its class using the usual CLASS/
OBJECTLIST/OBJECT elements.

The object also needs to be tagged with a linkid.


This linkid is then used in the second step, which is to now use the OBJECT/
RELATIONSHIP/OBJECTREF elements to place the object into the proper relationship.
See the AutoWord_IAObjects.xml sample script in the samples directory for an
example of how to do this.

Example XML script:


<OBJECT linkid="AA.Colt">
<!-- Later, a 'linkref' of 'AA.Colt' could be used to identify this object -->
<NAME>Colt</NAME>
<DESCRIPTION>American Autos Colt</DESCRIPTION>
<PROPERTIES>
<!-- More elements -->
</PROPERTIES>
<RELATIONSHIP>
<!-- More elements -->
</RELATIONSHIP>
</OBJECT>

448

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview

DTD:
<!ELEMENT OBJECTLIST (PREFERENCES*, OBJECT*)+>
<!ELEMENT OBJECT (NAME?, OBJECTGUID?, DESCRIPTION?, OWNER?, (SECURITYPROFILENAME |
SECURITYPROFILEREF)?, PROPERTIES?, RELATIONSHIP*)>
<!ATTLIST OBJECT
linkid ID #IMPLIED
action (traverse | add | remove | update) #IMPLIED
class CDATA #IMPLIED
transaction (no | yes) #IMPLIED
>

Elements and Attributes

Description

OBJECT

Used to create, update or delete an object in the MDS


repository

NAME, DESCRIPTION,
OBJECTGUID, OWNER,
(SECURITYPROFILENAME |
SECURITYPROFLEREF)

Specifies the values for the Model common properties.


Name and description are required. The owner will
default to the MDS user running the script. The
OBJECTGUID will be supplied by the MDS engine by
default. The default Security Profile is
MDSDefaultSecurityProfile.

PROPERTIES

For each PROPERTY element tag, sets the property value


in the object. See the PROPERTY element.

RELATIONSHIP

For each RELATIONSHIP element tag adds or removes


an object from a collection of this object. See the
RELATIONSHIP element.

linkid

If defined, maps the linkid string to the object identifier


for later reference.

action

Is used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.)

class

Used to identify the name of the Class this object is in.


Necessary only for objects in an OBJECTSLIST of a
RELATIONSHIP that have inherited relationships where the destination class is not the Relationship
destination class. As an example, export one of the
"AutoMaker" class objects from the "AutoWorld_IA"
metamodel, and compare the XML generated to the
AutoWorld_IA Objects.xml file found in the samples\xml
directory.

transaction

Is used to override the current default setting. If the


transaction attribute is yes begins an explicit
transaction. (See Transactions on page 456 for more
details.)

Teradata Meta Data Services Programmer Guide

449

Chapter 15: MetaXML Scripting Interface


XML Overview
PROPERTY

The PROPERTY element sets the value of an object property. This is a child of the OBJECT
element.
Example XML script:
<PROPERTY>
<NAME>Some New Property 1</NAME>
<VALUE type="VT_STRING">abcdef</VALUE>
</PROPERTY>
<PROPERTY>
<PROPERTYID>502</PROPERTYID>
<VALUE type="VT_INTEGER">100</VALUE>
</PROPERTY>
<!-- Running MetaXML to update an existing object... -->
<!-- Set the "StringProperty" value to NULL. (Without the null=yes
attribute, this would change the value to the empty string.)
Note that to "set" to a NULL value at object-create time,
simply do not include the PROPERTY element.
-->
<PROPERTY>
<NAME>StringProperty</NAME>
<VALUE type="VT_STRING" null="yes"/>
</PROPERTY>
<!-- Set the "BinaryProperty" value to NULL; null attribute not necessary.
Note that to "set" to a NULL value at object-create time,
simply do not include the PROPERTY element.
-->
<PROPERTY>
<NAME>BinaryProperty</NAME>
<VALUE type="VT_BINARY"/>
</PROPERTY>

DTD:
<!ELEMENT
<!ELEMENT
<!ELEMENT
<!ATTLIST

PROPERTY ((NAME | PROPERTYID), VALUE)>


PROPERTYID (#PCDATA)>
VALUE (#PCDATA)>
VALUE
StringLiteral (no | yes) #IMPLIED
type (VT_SHORT | VT_INTEGER | VT_DOUBLE | VT_STRING | VT_BOOL | VT_UCHAR |
VT_BINARY | VT_DATE | VT_BYTE) #REQUIRED
null (no | yes) #IMPLIED

>

450

Elements and Attributes

Description

NAME
PROPERTYID

Identifies the property by name or property ID.

StringLiteral

This attribute, when set to "yes", tells the MDS engine to send
the string to Teradata without adding enclosing quotes. It
implies the character data has some special meaning, such as
'date' or 'time'. The default is "no". It is silently ignored for noncharacter properties.

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview

Elements and Attributes

Description

null

This attribute, when set to yes changes the property value to


NULL. Needed when the type is VT_STRING. For all other
types an empty VALUE element results in setting a NULL value.
For a property type of VT_STRING, an empty VALUE element
without the null attribute will set the string length to empty. Can
be used for any "action", but really needed only for updates since
when action=add, merely not specifying the property will result
in the object being created with a property value of null.

VALUE

Sets the property value. Specifying the property type is required.


For example: <VALUE type="VT_STRING">abcdef</VALUE>

RELATIONSHIP

The RELATIONSHIP element adds or removes an object from a collection. This is a child of
the OBJECT element, and OBJECT elements can also be its children. In this way, one can
uniquely identify a repository object within a Class by using the Relationships for that Model.
There are two things to note about the "action" attribute for the Relationship element. First, to
provide compatibility with earlier releases, it is required -- its setting will always over-ride any
default set by the PREFERENCES element. And second, its behavior is slightly different than
other action attributes in that its MDS action is to add/remove the objects in the associated
OBJECTLIST to/from one of its collections. That is, it does not add/remove MDS objects
(though the objects in the list may be added/removed themselves), but works instead on its
indicated collection.
Limitations: While objects can be added or removed in the object list, it is not recommended
to do both at the same time. The issue is that the relationship action can only be one thing
(add/remove/traverse), so if child objects are BOTH added and others removed, no action
setting for the relationship is going to come out right.
Example XML script:
<OBJECT>
<NAME>American Autos</NAME
<RELATIONSHIP action="add">
<NAME>ManufOfAutos</NAME>
<OBJECT>
<NAME>Colt</NAME>
</OBJECT>
</RELATIONSHIP>
</OBJECT>

DTD:
<!ELEMENT RELATIONSHIP (NAME,(OBJECTREF|OBJECT)*)>
<!ATTLIST RELATIONSHIP
action (traverse | add | remove) #REQUIRED
type (origin | destination) #IMPLIED
linkref IDREF #IMPLIED
transaction (no | yes) #IMPLIED
>
<!ELEMENT OBJECTREF EMPTY>

Teradata Meta Data Services Programmer Guide

451

Chapter 15: MetaXML Scripting Interface


XML Overview
<!ATTLIST OBJECTREF
linkref IDREFS #REQUIRED
>

Elements and Attributes

Description

RELATIONSHIP

Used to reference object(s) from a collection via the list


of OBJECT and OBJECTREF elements child elements.

NAME

Identifies the relationship description of the collection.


(Ignored of linkref is set.)

OBJECT

Identifies an object reference in the collection. See the


OBJECT element.

OBJECTREF

Identifies an object in the collection by its linkid.

action

If the action attribute is remove, removes the object(s)


from the collection If the action attribute is add, adds
the object(s) to the collection. The "traverse" action
merely identifies (existing) objects in the collection.

type

The type attribute (origin or destination) indicates if the


object to be added or removed is in the origin or
destination class of the relationship. The type attribute
can be omitted unless the origin and destination classes
of the relationship are the same class.

linkref

Identifies the Relationship by the linkid set in a


RELATIONSHIPDESC element.
The NAME is ignored if this attribute is set.

transaction

Is used to override the current default setting. If the


transaction attribute is yes begins an explicit
transaction. (See Transactions on page 456 for more
details.)

Elements for Importing MDS Users, Application Groups, Security


Profiles, and Labels
METAUSER

The METAUSER element enables creating and deleting MDS Users and changing MDS User
passwords.
Example XML script:
<METAUSER linkid="User1">
<NAME>User 1</NAME>
<PASSWORD>0xxxxxxxxxxxxxxx</PASSWORD>
<DESCRIPTION>This is the first user</DESCRIPTION>
</METAUSER>

DTD:
<!ELEMENT METAUSER (NAME,PASSWORD,DESCRIPTION?)>
<!ATTLIST METAUSER

452

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview
linkid ID #IMPLIED
action (traverse | add | remove | update) #IMPLIED
superuser (no | yes) "no"
>
<!ELEMENT PASSWORD (#PCDATA)>
<!ATTLIST PASSWORD
encrypt (yes | no) #IMPLIED
>

Elements and Attributes

Description

METAUSER

Used to add or remove a MDS user

NAME

Sets the name of the user

PASSWORD

Sets the users password

DESCRIPTION

Sets a description. Optional.

linkid

If defined, maps the linkid string to the user identifier for


later reference.

action

Used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.)

superuser

When "yes", this indicates that this user is to be a super


user (a.k.a "administrator"). The MDS user running the
script must be a super user else this will produce an error.

encrypt

encrypt=yes indicates that the specified password is


encrypted. The metaxml program provides the means to
encrypt a password. Omit or set encrypt=no if the
password is not encrypted.

METAGROUP

The METAGROUP element enables creating and deleting MDS Application Groups and
adding and removing users from the groups.
Example XML script:
<METAGROUP>
<NAME>Group 1</NAME>
<METAUSERREF linkref="User1" action="add"/>
</METAGROUP>
<METAGROUP>
<NAME>Group 2</NAME>
<METAUSERREF linkref="User1" action="add"/>
<METAUSERREF linkref="John.Doe" action="remove"/>
</METAGROUP>

DTD:
<!ELEMENT METAGROUP (NAME, DESCRIPTION?, METAUSERREF*)>
<!ATTLIST METAGROUP
action (traverse | add | remove | update) #IMPLIED

Teradata Meta Data Services Programmer Guide

453

Chapter 15: MetaXML Scripting Interface


XML Overview
>
<!ELEMENT METAUSERREF EMPTY>
<!ATTLIST METAUSERREF
linkname CDATA #IMPLIED
linkref IDREFS #IMPLIED
action (traverse | add | remove) #REQUIRED
>

Elements and Attributes

Description

METAGROUP

Used to add or remove a MDS application group.

NAME

Sets the name of the application group.

DESCRIPTION

Sets a description. Optional.

action

Used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.)

transaction

If the transaction attribute is yes, begins an explicit


transaction.

METAUSERREF

Identifies users to add or remove from the application


group.

linkname

Identifies users to add or remove by the users name.

linkref

Identifies users to add or remove by an XML linkid.

SECURITYPROFILE

The SECURITYPROFILE element enables creating, updating and deleting MDS Security
Profiles. This element is a child element of the SECURITYPROFILES element. Security
Profiles are used by all other repository objects to identify who is allowed what type of access
to those objects. This element replaces the PERMISSION and APPLICATIONGROUP
elements from the 2.0 release.
Example XML script:
<SECURITYPROFILES>
<SECURITYPROFILE linkid="AMSecProf">
<NAME>AutoMaker Security Profile</NAME>
<DESCRIPTION>Desc</DESCRIPTION>
<SPENTRY access="SP_FULL">
<MDSUSER>user1</MDSUSER>
</SPENTRY>
<SPENTRY access="SP_READ">
<MDSGROUP>AutoWorld Group</MDSGROUP>
</SPENTRY>
</SECURITYPROFILE>
</SECURITYPROFILES>

DTD
<!ELEMENT SECURITYPROFILE (NAME, DESCRIPTION?, OBJECTGUID?, OWNER?, SPENTRY*)>

454

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Overview
<!ATTLIST SECURITYPROFILE
linkid ID #IMPLIED
action (traverse | add | remove | update) #IMPLIED
>
<!ELEMENT SPENTRY (MDSUSER | MDSGROUP)>
<!ATTLIST SPENTRY
action (traverse | add | remove | update) #IMPLIED
access (SP_READ | SP_COLLECTION | SP_UPDATE | SP_FULL) #REQUIRED
>
<!ELEMENT MDSUSER (#PCDATA)>
<!ELEMENT MDSGROUP (#PCDATA)>
<!ELEMENT SECURITYPROFILEREF EMPTY>

Elements and Attributes

Description

SECURITYPROFILE

Used to add or remove an MDS Security Profile.

NAME, DESCRIPTION,
OBJECTGUID, OWNER

Specifies the values for the Security Profile common


properties. Only the Name is required for this element.
The owner will default to the MDS user running the
script. The OBJECTGUID will be supplied by the MDS
engine by default.

linkid

If set, can be used by other elements to reference this


one.

action

Is used to override the current default setting. The value


can be add, remove, traverse or "update". (See
Action Attribute Settings on page 432 for more
information.)

SPENTRY

Identifies an MDS user or group that is associated with


this Security Profile.

MDSUSER

Identifies the MDS user for this entry.

MDSGROUP

Identifies the MDS group for this entry.

access

Required attribute of SPENTRY that specifies what


access the user/group will have for this Security Profile
Entry element. The values SP_READ,
SP_COLLECTION, SP_UPDATE, SP_FULL map
directly to the MDS engine values of MD_READ,
MD_COLLECTION, MD_UPDATE and MD_FULL.

METALABEL

The METALABEL element is used to create, update or remove labels in the MDS repository.
This element is the only child element of the METALABELS element.
DTD:
<!-Labels are part of versioning; new as of 6.1
-->
<!ELEMENT METALABELS (METALABEL)+>
<!ATTLIST METALABELS

Teradata Meta Data Services Programmer Guide

455

Chapter 15: MetaXML Scripting Interface


XML Overview
transaction (no | yes) #IMPLIED
>
<!ELEMENT METALABEL (NAME, DESCRIPTION?, CREATORNAME?, OBJECTGUID?, OWNER?,
(SECURITYPROFILENAME | SECURITYPROFILEREF)?)>
<!ATTLIST METALABEL
action (traverse | add | remove | update) #IMPLIED
>
<!ELEMENT CREATORNAME (#PCDATA)>

Elements and Attributes

Description

METALABEL

Used to add, update or remove an MDS Label.

NAME, OBJECTGUID,
DESCRIPTION, OWNER,

Specifies the values for the Label common properties.


Only the Name is required for this element. The owner
will default to the MDS user running the script. The
OBJECTGUID will be supplied by the MDS engine by
default. The default Security Profile is
MDSDefaultSecurityProfile.

(SECURITYPROFILENAME |
SECURITYPROFILEREF)

action

Is used to override the current default setting. The value


can be "add", "remove", "update" or "traverse". (See
Action Attribute Settings on page 432 for more
information.

CREATORNAME

Used to identify the creator of this label, and can be


different than the creating MDS user. Any string up to
255 character is valid. This is optional and if not
specified, it will be set the same as the creating MDS
user name.

Transactions
Ideally, the metaxml program would perform all actions in an XML file as one transaction.
With one transaction per XML file, either the entire content of the XML file would be applied
to the MDS repository or every action will be rolled back. Depending on the content and size
of the XML file, using one transaction can cause the following problems:
1

MDS objects can potentially be locked for a long period of time preventing other
applications from accessing the MDS repository.

Because the metaxml program is performing multiple MDS API calls, metaxml or other
MDS applications can potentially deadlock waiting for an object locked by metaxml.

By default, the metaxml program uses MDS implicit transactions, which commits changes
after each call to a MDS API. In the MDS DTD, the following element tags have a transaction
attribute: METAUSERS, METAGROUPS, SECURITYPROFILES, MODELDESC,
CLASSDESC, RELATIONSHIPDESC, PROPERTYDESC, DERIVEDCLASSDESC,
RELATION and OBJECT. If the element tag has a transaction attribute value to yes, then
metaxml will begin a MDS explicit transaction and end the transaction when the element
ends. For example:
<MODEL>
<NAME>Model 1</NAME>
<CLASS>Class 1

456

Teradata Meta Data Services Programmer Guide

Chapter 15: MetaXML Scripting Interface


XML Example Files
<NAME>Class 1</NAME>
<OBJECT transaction=yes> fl Start a transaction (Tx1)
...
<RELATIONSHIP>
<OBJECT>
fl Under transaction (Tx1)
<RELATIONSHIP>
<OBJECT transaction=yes>fl Start a transaction (Tx2).
nested transaction is not allowed.
Under transaction Tx1.
</OBJECT>
</RELATIONSHIP>
</OBJECT>
</RELATIONSHIP>
</OBJECT>
fl End transaction (Tx1)
<OBJECT>
fl by default, implicit transaction
</OBJECT>
</CLASS>

However,

XML Example Files


The following XML examples are provided. They can also be found in the MDS samples
installation folder.

XML Example File AutoWorldDesc.xml

XML Sample File AutoWorldObjects.xml

There are several other sample XML scripting files in the sample\xml directory. They build on
the AutoWorld meta-model by using inheritance. Their names are AutoWorld_I Desc.xml and
AutoWorld_I Objects.xml, which illustrate simple examples of inheritance; and AutoWorld_IA
Desc.xml and AutoWorld_IA Objects.xml, which illustrate inheritance from an abstract class.

XML Example File AutoWorldDesc.xml


The first time this file is run, the DefaultAction would be set to add; afterwards, the
PREFERENCES element could be removed (or its DefaultAction set to traverse), and any
updates to elements would have their specific action attribute set to whatever is appropriate
(that is, add or remove or (possibly) update). The action on the METAUSERREF elements
should be set to traverse after the first run also.
Remember that the PREFERENCES tag can be used in many different places. See the DTD file
for details.
Finally, note that the DTD file here is located on a WEB server (on the local host). Set the file
path for this file to whatever is appropriate for your environment (the DTD file is installed in
the %METAHOME%\bin folder).

XML Sample File AutoWorldObjects.xml


The first time this file is run, the DefaultAction is set to add; afterwards, the PREFERENCES
element could be removed (or its DefaultAction set to traverse) and any updates to elements
would have their specific action attribute set to whatever is appropriate (that is, add, remove or

Teradata Meta Data Services Programmer Guide

457

Chapter 15: MetaXML Scripting Interface


XML Example Files

update). The action on the RELATIONSHIP elements should be set to traverse after the first
run also.
Remember that the PREFERENCES tag can be used in many different places. See the DTD file
for details.
Finally, note that the DTD file here is located on a WEB server (on the local host). Set the file
path for this file to whatever is appropriate for your environment (the DTD file is installed in
the %METAHOME%\bin folder).

458

Teradata Meta Data Services Programmer Guide

CHAPTER 16

Error Messages

This chapter contains tables that list MDS Error Messages that can appear in the MDS Log.
The tables contain the probable cause, examples and suggested remedies.

MDS Error Messages

Transaction Errors

Gateway Socket Error Codes

XML Scripting Error Codes

Gateway Communications Error Codes

Note: Beginning with MDS 6.0, the RelativePropID for a new class property must be greater
than 500. Property IDs from 1 to 500 are reserved for internal MDS use.

MDS Error Messages


The following table lists MDS error messages.
Table 49: MDS Error Messages

Message

Code

Probable Cause

META_SUCCESS

0x80000000

API Successful: The API completed successfully.

META_FAILURE

0x80007000

General API Error: General API error. See the MDS error log
for more details.

Teradata Meta Data Services Programmer Guide

459

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_INVALID_PARAMETER

0x80007001

Invalid Parameter: One of the parameters passed in the API is


invalid or a required parameter is not set.
WriteObject: Requires the attributes which uniquely identify
the object be set (the ObjectID or the ObjectGUID) or to write
a new object the ClassID or ClassGUID must be set in the
object.
ReadObject: If the ObjectID or the ObjectGUID is not set,
then the ClassID or ClassGUID AND the ObjectName must
be set.
GetClassObjects, GetClassObjectKeys: the ClassID or
ClassGUID: Must be set.
GetPropertyValue: The Variant pointer passed in is NULL
GetOrig/DestCollection, GetOrig/DestCollectionKeys,
AddToOrig/DestCollection, AddManyToOrig/
DestCollection, RemoveFromOrig/DestCollection - Internal
Object ID: must be set.

META_E_CLASS_NAME_
ALREADY_EXISTS_IN_AIM

0x80007002

Name of Class Already Exists: Call to


CMetaAIM::CreateClassDesc to create a class with the name of
a class which already exists in the model. The names of classes
within a model must be unique.

META_E_OBJECT_NOT_FOUND

0x80007003

Object Not Found: The object identified by Object ID, Object


GUID or ClassID/Name was not found in the repository.

META_E_INSUFFICIENT_ MEMORY

0x80007004

Cannot Allocate Enough Memory: MDS could not allocate


enough memory to perform the action.
On Linux, the data space available to the program can be
increased by the ulimit command.

META_E_SERVER_NOT_ AVAILABLE

0x80007005

This status is obsolete.

META_E_NO_ACCESS_RIGHTS

0x80007006

No Access Permissions: The logged in user does not have


permissions to access the object as requested.
For example:
ReadObject: Does not have read permissions to perform a
ReadObject.
WriteObject: Does not have write permissions to perform a
WriteObject.
AddToDestCollection/RemoveFromDestCollection: Does
not have collection permissions to perform a
AddToDestCollection/RemoveFromDestCollection.

META_E_PROPERTY_NOT_ FOUND

460

0x80007008

Invalid Relative Property ID: The Relative Property ID passed


in is invalid or a ReadObject was not performed before the call
to GetPropertyValue

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_FATAL_ERROR

0x8000700A

Internal MDS processing has failed due to an unexpected


error.

META_E_REPOSITORY_NOT_
INITIALIZED

0x8000700B

Call Made to APIs before Initializing: A call was made to any


MDS API before calling CMetaRepository::Initialize.

META_E_AIM_NAME_
ALREADY_EXISTS

0x8000700C

Model Name Already Exists: The call to


CMetaAIM::CreateModel to create a model was made with the
name of a model which already exists in the MDS repository.
Names of metamodels in the MDS repository must be unique.

META_E_MULTIPLE_OBJECTS_
FOUND

0x8000700D

Corrupt MDS Table: Multiple rows with the same MDS


Internal ID were found in a repository table or an object with a
specific name exists twice in a repository table. This indicates a
corrupt MDS Repository table.

META_E_MISSING_REQUIRED_
PARAMETER

0x8000700E

Attribute Not Set: One of the attributes which is required to


perform the requested API is not set.

META_E_DATATYPE_MISMATCH

0x80007011

Invalid Variant Type: The VariantType defined for a


CMetaPropertyDesc is not a valid VariantType for the
PropertyType defined for the CMetaPropertyDesc.

META_E_OBJ_NOT_IN_
CORRECT_RELATION_CLASS

0x80007012

GetDestCollection, AddToDestCollection,
AddManyToDestCollection: the object ID of the calling
object is not in the origin class of the specified relationship.
GetOrigCollection AddToOrigCollection,
AddManyToOrigCollection: the object ID of the calling
object is not in the destination class of the specified
relationship.
AddToDestCollection, AddManyToDestCollection: the
object IDs to add to the collection are not in the destination
class of the relationship.
AddToOrigCollection, AddManyToOrigCollection: the
object IDs to add to the collection are not in the origin class of
the relationship.

META_E_EXCEPTION

0x80007013

MDS Exception: An operating system call made by MDS has


caused an exception.

META_E_CLASS_NOT_FOUND

0x80007014

Invalid MDS ClassID: The ClassID or ClassGUID set in the


object or API parameter is not a valid MDS Class ID.

META_E_RELATIONSHIP_
NOT_FOUND

0x80007015

Invalid CMetaRelationshipDesc: The RelID or RelGUID


specified for the relationship was not found to be a valid
CMetaRelationshipDesc defined in the MDS repository.

META_E_PROP_NAME_
ALREADY_EXISTS_IN_CLASS

0x80007016

Property Already Exists: The call to


CMetaClassDesc::CreatePropertyDesc to create a property was
made with the name of a property which already exists in the
class. Names of properties within a class must be unique.

Teradata Meta Data Services Programmer Guide

461

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_CLASS_OBJ_MISMATCH

0x80007017

Object Contains Undefined Property: WriteObject was


requested on an object which contains a property which is not
defined for the class.
Example:
The application performed a SetPropertyValue(99, PropObj)
and then a WriteObject().
If the class of the object being written does not have a property
(CMetaPropertyDesc) with a Relative Property ID of 99, this
error will occur.

META_E_NO_UNUSED_LOIDS

0x80007018

Out of Object IDs: MDS has run out of new objects IDs to
assign to new objects.

META_E_UNSUPPORTED_
VARIANT_TYPE

0x80007019

WriteObject: WriteObject was requested on an object which


has a property set with a Variant type that is not supported by
MDS.
If the CMetaProperty functions are used to set properties this
will not occur. MDS also provides a SetPropertyValue API in
which the Variant record can be passed in.
The Variant record must be set to the Variant Type defined for
the property in the CMetaPropertyDesc object.

META_E_UNSUPPORTED_ SQL_TYPE

0x8000701A

Invalid Database Column Type: The database column type of


a MDS repository table is not a type supported by MDS. This
could only happen if the column type was altered outside of
MDS through a database utility such as BTEQ.

META_E_DBACCESS_ERROR

0x8000701B

SQL Request Failed: The SQL request to the MDS repository


database which MDS issued to perform the API or utility
failed. Look in the MDS Error Log for the explanation of the
cause of the error.

META_E_OBJNAME_ INCORRECTLEN 0x8000701C

Object Name Too Long: The ObjectName was set to a name


which is greater than 255 characters. Object Names are limited
to 255 characters in length.

META_E_REGISTRY_LOOKUP_
FAILED

0x8000701D

Lookup Failed: Lookup of one of the MDS Windows Registry


entries failed. MDS stores in the registry the Database ODBC
DataSourceName, Logon Name and Password. These entries
are defined and saved in the MDS setup and using the MDS
metaconfig.exe program.

META_E_DATABASE_CONNECT_FAIL
ED

0x8000701E

MDS Engine Could Not Connect to the Database: The MDS


engine could not connect to the database. One probable cause
is the MDS database configuration is incorrect (Invalid DSN,
User name or password). The MDS Error log will contain
detail which describes the actual cause of the error.

462

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_NO_TERADATA_TYPE

0x8000701F

SQL Type is Not Supported: In the


CMetaClassDesc::CreatePropertyDesc() function, the SQL
Type specified for the PropType parameter is not a type
supported by MDS.

META_E_INVALID_DATATYPE_
MODIFIER

0x80007021

Invalid Property Length/Total Digits In the


CMetaClassDesc::CreatePropertyDesc() function, the
Property Length or Total Digits specified is invalid.
For Property Types in which the length must be defined
(SQL_CHAR, SQL_VARCHAR, SQL_VARBINARY, etc.), the
length must be greater than 0 (zero).
For types which use the Total Digits (SQL_NUMERIC,
SQL_DOUBLE, etc.), Total Digits must be 0 (zero) or greater.

META_E_MODEL_NOT_CREATED

0x80007022

ObjectID of Existing Model: When the functions in the


CMetaAIM API class (except the CreateModel API) are called,
the CMetaAIM object must contain the ObjectID of an
existing model in the repository.

META_E_CLASS_NOT_CREATED

0x80007023

ObjectID of Existing Class Description: When the functions


in the CMetaClassDesc API class (except the
CreatePropertyDesc API) are called, the CMetaClassDesc
object must contain the ObjectID of an existing class
description in the repository.

META_E_REL_NAME_ALREADY_EXIS
TS_IN_AIM

0x80007024

Relationship Name Already Exits: A call to


CMetaAIM::CreateRelationshipDesc was made with the name
of a relationship which already exists in the model. Names of
relationships within a model must be unique.

META_E_COLUMN_MISSING

0x80007025

Class Description contains more properties than


corresponding MDS database table: An object read from the
repository was missing an expected (common or unique)
property (that is, the data retrieved does not have all the
properties that the object's class definition in the repository
says it should) or the result of a non-object table read did not
contain an expected column.

META_E_INVALID_VARIANT_ TYPE

0x80007026

Invalid Variant Type: In the


CMetaClassDesc::CreatePropertyDesc() function, the Variant
Type specified is invalid.

META_E_PROPERTY_TEMPLATE_MIS
SING

0x80007027

Corresponding MDS database table contains more properties


than defined for the Class Description: An object read from
the repository contained a unique property that was not
expected. That unique property is not part of the object's class
definition in the repository.

Teradata Meta Data Services Programmer Guide

463

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_COLNAME_EXCEEDS_
THIRTY_CHAR

0x80007028

Column Names Limited to 30 Characters:


CMetaPropertyDesc names are used as the name of a Teradata
Database column and therefore must follow the guidelines for
Teradata column names.
Teradata column names are limited to 30 characters. Provide a
shorter name to the CMetaClassDesc::CreatePropertyDesc
call.

META_E_NULL_OBJECT_ID

0x80007029

ObjectID of Zero: The list of object ids to passed to


AddManyToDestCollection, AddManyToOrigCollection,
RemoveManyFromDestCollection or
RemoveManyFromOrigCollection contains an object ID of 0
(zero).

META_E_VARIANT_ T_EXCEPTION

0x8000702B

MDS is Unable to Access the SafeArray in the VARIANT


Structure: MDS uses the SafeArray field of the VARIANT
structure to pass BINARY data. If MDS is unable to access the
SafeArray in the VARIANT structure, this error is set.

META_E_LOAD_IN_PROGRESS

0x8000702C

Concurrent Loads of the Same System Not Permitted: MDS


is currently loading the database schema information for the
specified system. Concurrent loads of the same system are not
permitted.

META_E_LOAD_INVALID_
PARMNUM

0x8000702D

Number of Parameters Incorrect: The number of parameters


specified when running the command line tools
(metaload.exe, metaaim.exe or metacreate.exe) is not
correct.

META_E_OPENFILE_ERRROR

0x8000702E

metacreate.dat File Missing: Returned by metacreate.exe if


the metacreate.dat file is missing.

META_E_NO_AIM_UPDATES

0x8000702F

Update of AIM Objects: A call has been made to add a


property to the PropertyDescClass class.

META_E_REPOSITORY_
ALREADY_INITIALIZED

0x80007030

Multiple Initialize Calls: Call to CMetaRepository::Initialize


for the second time in the process.
Recommended Action: To Initialize with a different user, call
CMetaRepository::Deinitialize before calling
CMetaRepository::Initialize

464

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_INVOKE_FAILED

0x80007031

Invoke Fails: In the CMetaCOM ReadObject, WriteObject and


WriteObjects functions, MDS performs an hr =
pIMetaPersist->QueryInterface(IID_IDispatch,
(void**)&pDispatch); using the IMetaPersist pointer passed
into the function.
Using the Dispatch pointer returned from QueryInterface,
MDS calls the Invoke function to get or set the properties in
the COM object. This error is returned if the Invoke fails. The
result code returned by Invoke is logged in the MDS error log.
See COM Documentation for a description of the errors
returned by Invoke. Make sure the Dispatch ID matches the
Relative Property ID in the CMetaPropertyDesc and that the
Variant Type matches the VariantType in the
CMetaPropertyDesc.

META_E_QUERY_INTERFACE_
FAILED

0x80007032

Query Interface Fails: In the CMetaCOM ReadObject,


WriteObject and WriteObjects functions, MDS performs an hr
= pIMetaPersist->QueryInterface (IID_IDispatch,
(void**)&pDispatch); using the IMetaPersist pointer passed
into the function.
This error is returned if the QueryInterface fails. The result
code returned by QueryInterface is logged in the MDS error
log. See COM Documentation for a description of the errors
returned by QueryInterface.

META_E_COCREATEINSTANCE_
FAILED

0x80007033

CoCreateInstance Call Fails: The CMetaCOM


GetDestCollection GetOrigCollection,
GetDestCollectionKeys, GetOrigCollectionKeys,
GetClassObjects, and GetClassObjectKeys functions perform
a call to CoCreateInstance to create the vector in which to
return the objects.
This error is returned if CoCreateInstance fails. The result
code returned by CoCreateInstance is logged in the MDS error
log.
See COM Documentation for a description of the errors
returned by CoCreateInstance.

META_E_VARIANTTYPE_ MISMATCH

0x80007034

Current Variant Type of The Property Does Not Match the


Type Requested: A call to a GetXXX function in the
CMetaProperty API class returns this error when the current
variant type of the property does not match the type
requested.
Example:
GetString(): will return this error if the property variant type
is an Integer.
GetInt(): will return the error is the variant type is a float.

Teradata Meta Data Services Programmer Guide

465

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_REQUIRES_
UNIQUE_NAMES

0x80007035

Multiple Objects with the Same Name: This error is returned


from WriteObject() if the object being written has the same
name as an object which already exists in the class and the class
has the unique naming flag on. This error is also returned
from WriteObject() if the call is an update of an existing object
that changes the object's name and the new name conflicts
with that of another object in a uniquely named collection
both objects are members of. The object will not be written.
AddToDest(Orig)Collection(): The error is returned from
AddToDest(Orig)Collection() when the object being added to
the collection has the same name as an object which already
exists in the collection and the relationship description
defining the collection has the unique naming flag on. The add
to collection operation will not be performed.

META_E_UNIQUE_NAMES_
ARE_VIOLATED

0x80007036

Duplicate Names Found: This error code indicates a data


inconsistency in the repository, as a class or collection that is
marked as uniquely named actually contains objects with
duplicate names.
Multiple Objects with the Same Name: This error is returned
from WriteObject() if it detects that a unique naming
constraint is already violated in the repository before writing
the object. This can be either a class violation (the object's
class has the unique naming flag on, and there already exist
multiple objects of that class that have the same name as each
other) or a collection violation (an existing object's name is
being updated, and multiple objects in a uniquely named
collection it is a member of already have the same name as
each other). The object will not be written
AddToDest(Orig)Collection(): The error is returned from
AddToDest(Orig)Collection() if it detects that the collection
the object is being added to already violates a collection
unique naming constraint. That is, the collection contains
multiple objects with the same name as each other and the
relationship description defining the collection has the unique
naming flag on. The add to collection operation will not be
performed.

META_E_REMOVE_FROM_
COLLECTION_FAILED

0x80007037

Objects Not in Correct Class: One or more of the objects were


not in the correct class or were not in the collection calling
object not in appropriate (origin or destination) class object to
remove not in appropriate (origin or destination) class object
to remove not in collection

META_E_REQUIRES_UNIQUE_
PROPERTY_IDS

0x80007038

Existing Relative Property ID: The call to


CMetaClassDesc::CreatePropertyDesc specifies the same
Relative Property as an existing property in the class. Relative
Property IDs must be unique for all properties of a class.

466

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_UNIQUE_PROPERTY_
IDS_ARE_VIOLATED

0x80007039

Relative Property ID: MDS has detected that two properties


of a class have the same Relative Property ID.

META_E_BUFFER_TOO_SMALL

0x8000703A

Buffer Not Large Enough: The buffer passed to


CMetaProperty::GetBinary() is not large enough to return the
binary field.

META_E_UNKNOWN_USER

0x8000703B

Name is Not User Defined: The name passed to


CMetaRepository::Intialize() is not User defined in MDS.

META_E_INVALID_PASSWORD

0x8000703C

Password Incorrect: The password passed to


CMetaRepository::Intialize() does not match the current
password for the specified user.

META_E_INVALID_ACCESS_ RIGHTS

0x8000703D

Access Permissions Value Invalid: The value specified for


access permissions on an object is not a valid value.
It is recommended that you use the predefined constants
(meta.h). The constants are defined as hex values. In the
example, 666 decimal translates to 0x29A hex, which is not
valid.
You want to pass 0x666 or META_OWNER_
READWRITE|META_APPGRP_READWRITE| META_
ALL_READWRITE

META_E_INVALID_FOREIGN_
KEY_VALUE

0x8000703E

Objectid Is Not In The Specified Classid: The ObjectID is not


in the specified ClassID or is not a valid object identifier at all

META_E_APPLICATION_
GROUP_NOT_CREATED

0x8000703F

Application Group is Not Valid: The Application Group ID


set in an object is not a valid Application Group.

META_E_OWNER_INVALID

0x80007040

OwnerID is Not a Valid User: The Owner ID set in an object


is not a valid User.

META_E_OBJECT_IN_USE

0x80007041

Cannot Delete User Object: Cannot delete a User object


which is the owner of objects.
Cannot Delete Application Group Object: Cannot delete an
Application Group object if this is the Application Group of
any object.

META_E_OBJECT_ALREADY_ EXISTS

0x80007042

User or Application Group Already Exists: Attempt to create


a User or an Application Group which already exists. Names of
Users and Application Groups must be unique.

META_E_CREATEPROPERTY_
NOT_ALLOWED

0x80007043

CMetaClassDesc::CreatePropertyDesc: MDS could not


create a column with the information defined for the property
in CMetaClassDesc::CreatePropertyDesc. This could be
caused by using a Teradata keyword for the property name.

META_E_DATABASE_
TABLES_NOT_INITIALIZED

0x80007044

Repository Not Created: The MDS database repository has


not been created.

META_E_PASSWORD_TOO_
SHORT_OR_TOO_LONG

0x80007045

Password Incorrect: The password is less than 5 characters or


greater than 14 characters.

Teradata Meta Data Services Programmer Guide

467

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_MUST_BE_METASU_USER

0x80007046

This status has been superseded by


META_E_MUST_BE_A_SUPERUSER

META_E_DATABASE_TABLES_
ALREADY_INITIALIZED

0x80007047

Existing MDS Tables: metacreate.exe is being run to create


and load the initial MDS database tables and there is already
an existing set of MDS tables.

META_E_NO_CHANGES_TO_
MDSMETAMODEL_OBJECTS_
ALLOWED

0x80007049

Object ID Less than 10,000: Modification or delete of MDS


internal objects (objects with ids < 10,000) is not permitted

META_E_UNIQUENESS_
VIOLATION_OR_OBJECT_
NOT_FOUND

0x8000704A

Failed Uniqueness Check: A WriteObject failed because one


of the properties violated a uniqueness check.

META_E_INVALID_DATABASE_
USER_NAME

0x8000704B

User Name Invalid: Teradata user name is not valid.

META_E_INVALID_DATABASE_
PASSWORD

0x8000704C

Password Invalid: Teradata password is not valid.

META_E_INVALID_DATA_
SOURCE_NAME

0x8000704D

DSN Invalid: ODBC data source name (DSN) is missing,


invalid, or too long.

META_E_DUPLICATE_ OBJECT_GUID 0x8000704E

GUID Not Unique: The application attempted to write an


object whose GUID is the same as that of another object. Can
occur when inserting a new object or when updating an
existing object.

META_E_INSUFFICIENT_
DATABASE_ACCESS_ PERMISSIONS

Insufficient Access Permissions: The Teradata user MDS is


logged in as does not have sufficient access permissions to
perform the operation that was attempted.

0x8000704F

In general the MDS Teradata user needs at least SELECT,


INSERT, UPDATE, DELETE, CREATE TABLE, and DROP
TABLE access to its database, which are granted to the MDS
Teradata user with the SQL GRANT statement by a user
who is sufficiently privileged.
META_E_INVALID_DATABASE_ SIZE

0x80007050

This status is obsolete.

META_E_DATABASE_OR_USER_
ALREADY_EXISTS

0x80007051

This status is obsolete.

META_E_CLASS_OR_
RELATIONSHIP_NOT_FOUND

0x80007052

Table Not Found: The table for the specified class or


relationship description was not found in the MDS repository
database.

META_E_TRANSACTION_
ABORTED_DUE_TO_DEADLOCK

0x80007053

Deadlock Detected: A deadlock detected by the Teradata


Database caused the transaction to be aborted.

468

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_LOCK_HINT_CONFLICT

0x80007054

Internal Database Locking: An internal database locking hint


indicated that additional MDS internal server APIs were
expected to be called within the previous transaction. This
should never occur. If it does, it means MDS internal locking
hints are out of synchrony with MDS internal server APIs.
This is not under the users control.

META_E_LOCK_HINT_
WRONG_API_SEQUENCE

0x80007055

Internal Database Locking: An internal database locking hint


indicated that a different MDS internal server API was called
than was expected as the next call within the current
transaction. This should never occur. If it does, it means MDS
internal locking hints are out of synchrony with MDS internal
server APIs. This is not under the users control.

META_E_NO_DELETE_
PROPAGATION_TO_AIM_
COMPONENTS

0x80007056

Attempt to create a relationship description with delete


propagation turned on whose destination class was one of the
following AIM component classes defined in the header file
metaglobals.h:
class description (CLSLOID_ClassDescClass)
property description (CLSLOID_PropertyDescClass)
relationship description
(CLSLOID_RelationshipDescClass)
AIM (CLSLOID_MetaAIMClass)
repository root (CLSLOID_RootClass)
Deletion is not allowed to propagate to these classes.

META_E_OBJECT_ALREADY_
IN_COLLECTION

0x80007057

Attempt to add an object to a collection of which the object


was already a member. An object cannot be a member of the
same collection multiple times.

META_E_DUPLICATE_UNIQUE_
PRIMARY_KEY

0x80007058

Internal error code indicating a database error occurred due to


an attempt to insert a row: Internal error code indicating a
database error occurred due to an attempt to insert a row
whose primary key matched that of an existing row in the
table. This code will normally be converted to the more
specific META_E_OBJECT_ALREADY_IN_COLLECTION
error code before being returned to the user.

META_E_CONNECTION_NOT_ OPEN 0x80007059

MDS server attempted to close a connection that was not


currently open: Internal code indicating that during cleanup
of ODBC connections, the MDS server attempted to close a
connection that was not currently open. This is normally not
an error and this code will not normally be returned to the
user.

META_E_TOOL_TERMINATED_
ABNORMALLY

Command line was aborted or terminated before completion:


The command line program (metacreate, metadelete,
metaaim or metaload) called by MetaConfigurator was
aborted or terminated before completion.

Teradata Meta Data Services Programmer Guide

0x8000705A

469

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_TOO_MANY_DIGITS_
AFTER_DECIMAL_POINT

0x8000705B

More than 15 digits to the right of the decimal point: Attempt


to create a fixed-point property description that specified
more than 15 digits to the right of the decimal point
(CMetaClassDesc::CreatePropertyDesc argument sPropType
== SQL_DECIMAL or SQL_NUMERIC and sTotalDigits >
15).

META_E_MIGRATION_REQUIRED

0x8000705C

The MDS Repository is a previous version. Run the


metamigrate utility to upgrade the MDS repository to the
current version before completing this operation.

META_E_LOAD_VIEWCOL_
DATATYPE_FAILED

0x8000705D

Teradata User does not have permissions: The MDS


metaload utility uses the Teradata "HELP Column" command
to get information on View Columns from Teradata. This
error indicates that either:
The Teradata user used by metaload to connect to Teradata
to perform the load does not have the permissions to issue
the "HELP Column" command, or
The views reference columns in tables that no longer exist
or have been altered.
Look in the MDS Error log for the explanation of the actual
cause of the error.

META_E_DATABASE_FULL

0x8000705E

No more perm space in Teradata: Indicates there is no more


perm space in the MDS Teradata Database. Use a Teradata
utility such as BTEQ or WINDDI to increase the perm space
for the MDS database.

META_E_NAME_NOT_FOUND

0x8000705F

Database name not found: Database name given to metaload


to load was not found in the Teradata Database System

META_E_INVALID_OR_
MISSING_DB_TAG

0x80007060

Database name incorrect: The file containing database names


given to metaload contains an invalid tag or is missing a
closing tag.

META_E_DSN_DOES_NOT_
MATCH_CONFIGURED_DSN

0x80007061

DSN does not match: The DSN specified as a parameter to


metacreate to use to create a new Teradata User does not
match the DSN in the MDS configuration for the MDS
repository database. The DSNs must match to ensure that the
MDS repository is created in the correct Teradata Database
Systems.

META_E_WARNING_ONLY_
BASE_TABLES_DROPPED

0x80007062

MDS Repository partially corrupted: metadelete detected


that the MDS repository was partially corrupted and could
only drop the base MDS database tables.

META_E_REPOSITORY_
0x80007063
CORRUPTED_NO_TABLES_ DROPPED

470

MDS Repository corrupted: metadelete detected that the


MDS repository was corrupted and was unable to drop any of
the MDS database tables.

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_SECONDARY_INDEX_
UNIQUENESS_VIOLATION

0x80007064

Internal error used by MDS: It is mapped to other MDS error


codes before returning the API call. An error was detected by
the MDS engine in checking for unique names or GUIDs. The
engine returns the error as
META_E_OBJECT_ALREADY_IN_COLLECTION or
META_E_DUPLICATE_OBJECT_GUID.

META_E_QUEUE_NOT_ATTACHED

0x800070A0

Failure to access message queue: A read or write to the MDS


message queue occurred when the queue is not currently
attached to the process. At startup there is an attempt to detect
orphaned queues by a failed attach/detach. This is not under
the user's control.

META_E_QUEUE_ALREADY_ATTACH
ED

0x800070A1

Failure to access MDS queue: An attempt to attach the MDS


queue to the process was made and it is already attached. This
is not under user control.

META_E_QUEUE_DOES_NOT_EXIST

0x800070A2

Failure to access MDS queue: An attempt to attach to the


MDS queue was made and it does not exist. Not necessarily an
error. At startup there is an attempt to detect orphaned queues
by a failed attach. This is not under user control.

META_E_QUEUE_ALREADY_EXIST

0x800070A3

MDS queue already exists: Attempt to create the MDS queue


and it already exists. This is not under user control.

META_E_QUEUE_NO_MSG

0x800070A4

No messages in queue: A read of the message queue was made


with the option to not wait for a message set to true and there
are no messages. Not necessarily an error. This is not under
user control.

META_E_MDS_RESERVED_CLASS

0x80007100

Invalid Class: An attempt was made to create an object of the


MetaObjectClass class type (ClassID= 107). This is an internal
MDS class and can not be used to create user objects.

META_E_UNKNOWN_
COMPARISON_OPERATOR

0x80007101

Invalid operator: An invalid comparison operator has been


specified in a CMetaFilterInfo object.

META_E_UNKNOWN_LOGICAL_OPE
RATOR

0x80007102

Invalid operator: An invalid logical operator has been


specified in a CMetaFilterInfo object.

META_E_UNDERSPECIFIED_
PROPERTY

0x80007103

Unidentified property: The CMetaFilterInfo object contains a


value which has neither the PID nor the name of the property
set to identify the property.

META_E_REGEX_COMPARISON_OPE
RATOR_REQUIRES_STRING_OPERAN
D

0x80007104

Invalid search operator: The REGEX comparison operator


can only be used to search properties with a character type.

META_E_CREATE_GUID_FAILED

0x80007105

Network failure: The system call to create a GUID to uniquely


identify a new object failed. This can be caused by the absence
of a network card or a bad network card.

Teradata Meta Data Services Programmer Guide

471

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_UNSUPPORTED_TERADATA
_RELEASE

0x80007107

Incompatible database version: Indicates that the repository


is on a system with an unsupported release of Teradata. See the
Teradata Meta Data Services Administrator Guide for a list of
supported releases.
For the MetaLoad utility, can indicate that the system being
loaded has a version of Teradata lower than V2R4.0.

META_E_ANOTHER_ACTION_
PROCESSOR_IS_RUNNING

0x80007108

Duplicate Action Processor running: Attempt to run another


Action Processor while one was running. Only one AP may
run against a given repository

META_E_OBJECT_LOCKED_
AND_NOWAIT_SPECIFIED

0x80007109

Table locked: A select statement was returned because the


table to read was locked and no wait time was specified. This
code is used internally by MDS.

META_E_XML_ERROR

0x8000710A

XML error: A general XML script error occurred. Normally an


XML Scripting Error Codes will be returned.

META_E_SYSTEM_NAME_NOT_
FOUND

0x8000710B

Invalid system name: The metaload utility, while running


with the option to resync previously loaded databases,
detected that the system name specified does not exist.

META_E_NO_DATABASES_ LOADED

0x8000710C

No databases loaded: The metaload utility, while running


with the option to resync previously loaded databases,
detected that the no databases have been loaded.

META_E_PROPAGATION_DELETE_LI
MIT_REACHED

0x8000710D

Too many objects deleted: System resources limit the number


of objects that can be deleted in one delete object transaction.
The object being deleted has relationships with Propagate
Delete set to true. The number of objects to delete through
propagate deletion when deleting this object exceeds the
system limit. Delete the collection objects for this object before
the object can be deleted.
Note: The call to ODBC to rollback this transaction will likely
timeout and log a SQL_TIMEOUT error in the MDS error log.
This is because the ODBC function uses the CONNECT
timeout value which defaults to 20 seconds and this may not
be sufficient time for Teradata to roll back the transaction.
The transaction, however, will be rolled back.

META_E_NAME_EXCEEDS_
THIRTY_CHAR

0x8000710E

Invalid system name: Teradata System Names are limited to


30 bytes.

META_E_RELPROPID_MUST_BE_GRE 0x8000710F
ATER_THAN_ZERO

Invalid Property ID: The Relative Property ID when creating


a CMetaProperty object must be greater than 0.

META_E_USER_NOT_SIGNED_ON

0x80007110

User not logged on: MDS User is not logged on to MDS.

META_E_TABLE_ALREADY_EXISTS

0x80007111

Duplicate repository table: The MDS repository table already


exists. Used internally by the metamigrate program.

META_E_TIMEOUT_EXPIRED

0x80007112

Time out for SQL command: The maximum time set for a
SQL command expired and the command was aborted.

472

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_METALOAD_SYSTEM_LOGI
N_NOT_SET

0x80007113

Repository not in sync with database: If the DIM Update


Gateway detects that the MDS repository has become out of
sync with a Teradata Database, during its recovery schedule, it
calls the metaload utility to resync the database. The metaload
utility uses the database connection in the System object to
connect to the Teradata Database Systems. The database
connection must have been set in the System object (using the
MetaManager).

META_E_NO_DELETE_DIM_UPDATE
ABLE_SYSTEM

0x80007114

System cannot be deleted: Cannot delete a System which has


DIM Updates Enabled.

META_E_INVALID_SCRIPT_TYPE

0x80007115

Invalid script type: metaclient was unable to determine what


type of Client Load script is being processed. metaclient
supports Fastload, Multiload and TPump scripts.

META_E_BAD_ATTRIBUTE_INFO

0x80007116

Invalid attribute: metaclient has determined that the attribute


information associated with a Field or Column definition is
invalid.

META_E_NO_DATA_SOURCE

0x80007117

Missing data source: metaclient has determined that no data


source has been specified in the Client Load script being
processed

META_E_BAD_DEFINE_STMT

0x80007118

Invalid script: metaclient has determined that the Define


statement in a Fastload script contains invalid information.

META_E_BAD_INSERT_STMT

0x80007119

Invalid script: metaclient has determined that the Insert


statement in a Fastload or Multiload script contains invalid
information.

META_E_BAD_OUTPUT_FILE_DATA

0x8000711A

Invalid script: metaclient has determined that the Output file


associated with the Client Load script being processed
contains invalid information.

META_E_NULL_THIS_PTR

0x8000711B

Invalid pointer: The object pointer from which the function


was invoked is a NULL pointer.

META_E_REPOSITORY_IS_CURRENT
_RELEASE

0x8000711C

Migration not needed: metamigrate was run to migrate an


MDS repository that is already at the current release level.

META_E_DATABASE_DOES_NOT_EXI
ST

0x8000711D

Invalid database: The default database in the MDS database


connection DSN is not a valid Teradata Database. Used
internally by MDS.

META_E_METALOAD_CHILD_PROCE
SS_DIED

0x8000711E

Database load failed: When metaload runs to initially load


databases in a system, the utility runs as two processes. This
error indicates that the child process died. Look in the MDS
error log for reasons for the termination. Rerun metaload to
recover.

Teradata Meta Data Services Programmer Guide

473

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_METALOAD_PARENT_PROC
ESS_DIED

0x8000711FL

Database load failed: When metaload runs to initially load


databases in a system, the utility runs as two processes. This
error indicates that the parent process died. Look in the MDS
error log for reasons for the termination. Rerun metaload to
recover.

META_E_SECURITY_PROFILE_IN
VALID

0x80007140

The ID specified for the Security Profile ID is not the ID of an


existing Security Profile.

META_E_INTERNAL_ERROR

0x80007141

An MDS internal error occurred. Send the error log to global


support.

META_E_OBSOLETE_PROPERTY

0x80007142

The ID of the ApplicationGroupID or the AccessRights is


specified in the list to sort or search by. These properties have
been eliminated.

Obsolete code - no longer used

0x80007143

META_E_DDL_PARSING_FAILED

0x80007144

The DDL Processor could not process a DDL for metaload


because the MDS parser could not parse the statement.

META_E_UNKNOWN_DATABASE
S_FOR_DDL

0x80007145

The DDL Processor could not process a DDL for metaload


because not all of the referenced databases were defined in the
DIM. This status is no longer used.

META_E_DERIVED_CLASS_CON
FLICT

0x80007146

Attempt to create a non-derived property in a derived class.


Derived properties can only be created in derived classes.

META_E_DERIVED_PROPERTY_
CONFLICT

0x80007147

Attempting to create a derived property in a nonderived class.


Derived properties can only be created in derived classes.

META_E_DERIVED_CLASS_WRIT
ES_NOT_ALLOWED

0x80007148

Attempt to specify a derived class id when creating a new


object. Objects can only be created for non-derived classes.

META_E_DERIVED_PROPERTY_
RELATIONSHIP_ERROR

0x80007149

The RelationshipsToProperty specified for this derived


property conflicts with a derived property which already exists
for this derived class. All derived properties in a class must be
in the same relationship hierarchy.

META_E_BASE_PROPERTY_NA
ME_NOT_FOUND

0x8000714A

The BasePropertyName specified for this derived property is


not the name of a property in the origin class of the
relationship as specified by the RelationshipsToProperty
parameter.

META_E_MAX_SECPROFILE_PE
RMISSIONS_EXCEEDED

0x8000714B

Attempt to add more than 100 permission entries to a security


profile.

META_E_INVALID_PROPERTYDE
SC_PTR

0x8000714C

An invalid CMetaPropertyDesc pointer was passed into the


CMetaClassDesc:: CreateMDSPropertyDesc,
CreateMDSDerivedProperty, CreatePropertyDesc or
GetPropertyDesc function. Make sure the variable was
initialized to NULL on the stack.

474

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_INVALID_CLASSDESC_ PTR

0x8000714D

An invalid CMetaClassDesc was passed into the CMetaAIM::


CreateMDSClassDesc, CreateMDSDerivedClass,
CreateClassDesc or GetClassDesc function. Make sure the
variable was initialized to NULL on the stack.

META_E_INVALID_RELATIONSHI
PDESC_PTR

0x8000714E

An invalid CMetaRelationshipDesc was passed into the


CMetaAIM::CreateMDSRelationshipDesc,
CreateRelationshipDesc, or GetRelationshipDesc function.
Make sure the variable was initialized to NULL on the stack.

META_E_DATABASE_NOT_LOAD ED

0x8000714F

This is an internal status originally introduced to relay error


information from the DDL Processor to metaload. The status
is no longer used.

META_E_COLUMN_DOES_NOT_
EXIST

0x80007150

This is an internal status originally introduced to relay error


information from the DDL Processor to metaload. The status
ices a column that is not defined in the DIM.

META_E_CANNOT_ALTER_COLU MN 0x8000715

MDS issued a SQL statement to alter a table column and


Teradata indicated that the change is not permitted.

META_E_DEST_CANNOT_BE_A_
DERIVED_CLASS

0x80007152

When creating a Relationship Description, the Destination


Class cannot be the class ID of a derived class.

META_E_ORIG_CANNOT_BE_A_
DERIVED_CLASS

0x80007153

When creating a Relationship Description, the Origin Class


cannot be the class ID of a derived class.

META_E_UNBALANCED_PARENT
HESES

0x80007154

The sum of the Open Parentheses counts set in each


CMetaFilterInfo object in the MetaFilterInfoVector parameter
must match the sum of the Close Parentheses counts set.

MET A_E_ALREADY_MIGRATED

0x80007155

The current repository has already completed the migration


process.

META_E_NO_SPL_TEXT

0x80007156

Metaload has determined that a Stored Procedure does not


have any text associated with it in Teradata.

META_E_BASECLASSID_IS_NOT_A_V
ALID_CLASS

0x80007157

The class ID specified for the base class of a Derived Class is


not the ID of an existing class.

META_E_BASECLASS_CANNOT_
BE_A_DERIVEDCLASS

0x80007158

The class ID specified for the base class of a Derived Class


cannot the ID of a Derived Class.

META_E_INVALID_SP_VERSION

0x80007159

Metaload attempted to load a stored procedure that has a


version that is not compatible with the current Teradata
Database Systems server release. (See Teradata Error
Code 5559)

META_E_FETCH_NEXT_ROW_END_
OF_RESULTS

0x80007180

Used internally by MDS. Indicates that there are no more rows


to be retrieved in the buffer

Teradata Meta Data Services Programmer Guide

475

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_MAX_PROPERTIES_PER_
CLASS_EXCEEDED

0x80007181

The maximum number of properties than can be defined for a


class has been exceeded. The limitation is determined by the
"properties" field of the metaclassdesc table in the MDS
repository. The column is 32000 bytes. This is enough space to
allow for 696 properties or 307 derived properties.

META_E_TERADATA_MAX_STRING_
SIZE_EXCEEDED

0x80007182

The value of a string size has been set too large. The Teradata
limit is 31000 bytes.

META_E_SECURITY_PROFILE_LIMIT
_EXCEEDED

0x80007183

The MetaSurf business search will fail if more than 512


security profiles are defined on objects in the business search
tables. You must run the search as the meta super user
(metasu) or reduce the number of security profiles.

META_E_A_ABSTRACT_CLASS_HAS_
NO_OBJECTS

0x80007184

You cannot create an object in a class that has been defined as


an abstract class. Abstract classes do not have objects.

META_E_CANNOT_DELETE_A_
SUPERCLASS

0x80007185

A superclass cannot be deleted if there are existing subclasses


inheriting from this superclass. You must delete all the
subclasses before a superclass can be deleted

META_E_MACRO_DOES_NOT_EXIST

0x80007186

A macro used by MDS does not exist in the MDS repository.


Used internally by MDS

META_E_SUPERCLASS_CANNOT_BE_ 0x80007187
A_DERIVEDCLASS

The class ID specified for a superclass class when creating a


class is the ID of a derived class. A derived class cannot be a
superclass

META_E_SUPERCLASS_IS_NOT_A_
VALID_CLASS

0x80007188

The class ID specified for a superclass class when creating a


class is not the ID of a valid class

META_E_MAX_ALLOWED_
SUPERCLASSES_EXCEEDED

0x80007189

This error means that the superClasses list passed by the


application when creating a class has more than one entry.

META_E_CANNOT_DELETE_
INHERITED_PROPERTY

0x8000718A

An attempt is being made to delete a property description in a


class that is a property of one of the class's superclasses. The
property can only be deleted from the superclass

META_E_CANNOT_ADD_
SUPERCLASS_WITH_PROPERTIES

0x8000718B

When modifying the superclass list of a class description, only


a class with no properties can be added to the superclass list.

META_E_CANNOT_REMOVE_SUPER
CLASS_WITH_PROPERTIES

0x8000718C

When modifying the superclass list of a class description, only


a class with no properties can be removed to the superclass list.

META_E_UPGRADE_MDS_
SOFTWARE

0X80007194

The version of the MDS repository is greater than the current


version of the MDS software. This means you are using the
wrong repository for the current MDS software version. Either
run MetaManager to point to a different repository or install
the version of MDS software that matches the repository
version.

META_E_UPGRADE_ODBC_DRIVER

0X80007195

MDS cannot use the current ODBC driver because the version
is incompatible with the repository. For MDS 13.0 and later,
the minimum acceptable ODBC driver version is 12.00.00.00
and later.

476

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_RELPROPID_MUST_BE_GRE 0X80007196
ATER_THAN_500

The RelativePropID for a new class property must be greater


than 500. Property IDs from 1 to 500 are reserved for internal
MDS use. This error is returned by
CMetaClassDesc::CreateMDSPropertyDesc.

META_E_UNKNOWN_KANJI_TRANSL 0X80007194
ATE_FUNCTION

This message occurs only with a Teradata Database that has


DBC information indicating that Kanji data may be used and
metaload determines that system being loaded has a Kanji
database but the Teradata Database does not support all of the
Kanji translation functions it needs.
Metaload will not terminate if one of the tables is not loaded.
However, if none of the tables are loaded, metaload will
terminate.
The Kanji translations required by MDS are:
Kanji1_KanjiSJIS_TO_Unicode
Kanji1_KanjiEUC_TO_Unicode
Kanji1_KanjiEBDIC_TO_Unicode

META_E_MUST_BE_A_SUPERUSER

0x800071A0

Some changes to the MDS repository are restricted to MDS


users with super user privileges. Examples are creating a super
user, dropping a user, or executing metacreate, metamigrate,
or metadelete

META_E_OBJECT_FROZEN

0x800071A1

The application is attempting to update an inactive version of


an object or an object that is protected by MDS. Only the
highest numbered version of an object may be modified.

META_E_NO_MORE_VERSIONS

0x800071A2

The application is attempting to update an object via


WriteObject() and a new version of the object must be created.
The maximum number of versions (2,147,483,647) for the
object has been reached and a new version can not be created.
To resolve this situation, delete the object and recreate the
object and setup all of the collections to which it belongs.

META_E_NOT_CURRENT_VERSION

0x800071A3

The application has called an API that requires the local object
ID, also known as the loid, to specify the latest version of an
object. If you are adding a loid to a collection, i.e.
AddToDestCollection, AddToOrigCollection, etc., the origin
loid must be for the latest version of an object.

META_E_LABEL_NOT_DEFINED

0x800071A4

The application has specified a label parameter that is not


currently defined in the Repository.

META_E_REPOSITORY_VERSIONING
_NOT_ENABLED

0x800071A5

The application is trying to enable data versioning for a model,


but the Repository does not allow data versioning. Data
versioning can be enabled with the -v on parameter to
metacreate or metamigrate.

Teradata Meta Data Services Programmer Guide

477

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_METAMODEL_VERSIONING 0x800071A6
_NOT_ENABLED

The application is trying to enable data versioning for a class,


but a metamodel containing the class does not allow data
versioning. An entry in the MDS log should identify the
metamodel preventing the change.

META_E_LABEL_NOT_USED

0x800071A7

CMetaObject::FindLabel could not find a version of the object


that used the specified label.

META_E_UNIQUE_DEST_VERSIONS_
VIOLATED

0x800071A8

When adding entries to a collection, e.g. AddToDestCollection


or ReplaceDestCollection, MDS has determined that the
application is trying to have the origin object point to two
versions of the same destination object.

META_E_NO_VIRTUAL_CIRCUITS

0x800071A9

The application is doing a CMetaRepository::Initialize or


CMetaRepository::SignOn and Teradata has refused a
connection request because it has no more virtual circuits

META_E_LABEL_IN_USE

0x800071AA

The L parameter to metaload specifies a label that has already


been used to label objects in the repository.

META_E_ROW_TOO_LONG

0x800071B0

The read of an object has failed because the SQL generated by


MDS requires a result set that exceeds the maximum allowed
by Teradata. This error is mainly expected with the read of a
derived object.

META_E_DB_OUT_OF_SPOOL_SPACE 0x800071B1

The API call has failed because there is insufficient spool space
in the repository database to return the results of a query.

META_E_DORMANT_OBJECT

0x800071B2

The read or update of an object failed because the object is


currently dormant. Dormant objects may only be accessed by
MDS Administrator users and only through special APIs.

META_E_DORMANT_OBJECTS_NOT_ 0x800071B3
SUPPORTED

The API requested information on dormant objects, but the


Repository does not support dormant objects or the class does
not support dormant objects. Dormant objects are limited to
tables and views.

META_E_SYSTEMNAME_EXCEEDS_
256_CHARS

0x800071C0

A WriteObject has failed because the name of a DIM System


object is limited to 256 characters.

META_E_METALOAD_ABORT_
REQUESTED

0x800071C1

The user has requested the abort of a metaload started by the


MetaManager utility

META_E_MDS_VIEWS_NOT_
INSTALLED

0x800071C2

When the metaload utility is loading the data dictionary from


a Teradata 12.0 or later system, the MDS views must be present
in the systems DBC database. Use the metaviews utility to load
the required views.

META_E_MUST_BE_UNIX_ROOT_US
ER

0x800071C3

The user trying to execute an MDS utility on a Linux system


does not have root access.

META_E_METALOAD_BUFFER_OVER
FLOW

0x800071C4

Internal metaload status should never be seen by an


application other than metaload

478

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


MDS Error Messages
Table 49: MDS Error Messages (continued)

Message

Code

Probable Cause

META_E_METALOAD_RESYNC_NEED 0x800071C5
S_UTF16

A metaload resync has been requested and metaload needs to


be able to use UTF-16 as the session character set with the
system being loaded. The UTF-16 session character set should
be installed on the system being loaded and on the system
containing the MDS repository.

META_E_MISSING_REQUIRED_DESC
RIPTION

WriteObject: the Description property for the object must be


non-null

0x800071D0

CMetaClassDesc::ChangeDescriptionRequired:
DescriptionRequired property for the class cannot be set to
true because one or more existing objects in the class do not
have descriptions.
META_E_REQUIRED_PROPERY_NOT
_ALLOWED_IN_MODEL

0x800071D1

The DescriptionRequired property for a class cannot be set to


true when the class is in one of the protected metamodels
(DIM, MDSbase, CLM and CWM)

META_E_MISSING_REQUIRED_PROP
ERTY

0x800071D2

A WriteObject has failed because a required property does not


contain a value.

META_E_PROPERTY_RENAME_NOT_
ALLOWED

0x800071D3

A WriteObject of a CMetaPropertyDesc object has failed


because a rename of the object was requested. Properties
cannot be renamed after they have been created.

META_E_UPGRADE_MDS_VIEWS

0x800071D5

Metaload cannot load the system's data because the MDS


views installed in the system's DBC database are not for the
current version of MDS. Run metaviews for the system and
then resubmit your metaload request.

META_E_WRONG_VERSION_FOR_MI 0x800071D6
GRATION

Metamigrate cannot migrate a repository that is for a version


of MDS greater than the current MDS version.

META_E_MAY_NOT_UNLOAD_SYSU
DTLIB

0x800071DA

Metaload will not unload the database SYSUDTLIB when the


load of UDTs or UDFs are enabled.

META_E_UDT_DOES_NOT_EXIST

0x800071DB

Metaload or DIM Update could not resolve the relationships


for an object because it references an unknown UDT. This
means the database SYSUDTLIB has not been loaded or it has
not been resyncd recently.

META_E_UDF_DOES_NOT_EXIST

0x800071DC

Metaload or DIM Update could not resolve the relationships


for an object because it references an unknown function. This
could mean that the database containing the function is not
loaded or that the database has not been resyncd recently.

META_E_AMP_DOWN

0x800071DD

The system containing the repository database has a down


AMP which prevents MDS from writing to a repository table.

META_E_TERADATA_SQL_ERROR

0x800071E0

An SQL statement issued by an MDS component was rejected


by Teradata because of a syntax error.

Teradata Meta Data Services Programmer Guide

479

Chapter 16: Error Messages


Transaction Errors

Transaction Errors
The following table lists transaction-specific error messages.
Table 50: Transaction-Specific Errors

Message

Code

Probable Cause

META_E_TX_ROLLED_BACK

0x80007400

Error in Transaction: The transaction was rolled back. The


Commit request rolled back due to an error in the transaction
or CMetaRepository::Deinitialize was called while a transaction
was still open.

META_E_TX_COMMIT_FAILED

0x80007402

Commit Command Failed: The commit command to the


Teradata Database failed.

META_E_TX_ROLLBACK_ FAILED

0x80007403

Rollback Command Failed: The rollback command to the


Teradata Database failed.

META_E_TX_ILLEGAL_ DDL_TYPE

0x80007404

Unrecognized Type: A DDL specification contained an


unrecognized type. This is an internal error.

META_E_TX_HAS_ERROR

0x80007405

Current Transaction Error: The current transaction is in an


error state. The transaction must be closed by issuing a
Rollback or issuing a Commit for each nesting level.

META_E_TX_NO_
MATCHING_DDL_FOUND

0x80007406

No outstanding DDL was found to retry: The application called


the API CMetaRepository::RetryDDL but no outstanding DDL
was found to retry. (If the application specified a transaction
serial number, there were no outstanding DDL statements for
that transaction. If the application did not specify a transaction
serial number, there were no outstanding DDL statements for
any transaction.) This normally indicates that the transaction
specified (or all transactions, if none specified) either
committed or rolled back successfully and does not require any
repair via RetryDDL. This error code indicates that RetryDDL
did not make any change to the repository.

META_E_TX_INDEX_OUT_
OF_RANGE

0x80007500L

Index out of range: Specified transaction index is out of the


initialized range.

Gateway Socket Error Codes


The following table lists Gateway socket error codes.
Note: The Gateway Socket Error Codes are never returned to an application; they are used
internally by the DIM update processes. They would be visible only through an MDS trace.

480

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


Gateway Socket Error Codes
Table 51: Gateway Socket Error Codes

Messages

Code

Probable Cause

META_E_GWYSOCKET_EINTR

0x80007800

Socket request failed: A socket request failed because the


system call was interrupted by a signal.

META_E_GWYSOCKET_EAGAIN

0x80007801

Socket request failed: A socket request failed because of


insufficient memory or swap space.

META_E_GWYSOCKET_ENOMEM

0x80007802

Socket request failed: A socket request failed because a new


object could not be created.

META_E_GWYSOCKET_EINVAL

0x80007803

Invalid parameter: An invalid parameter value was passed.

META_E_GWYSOCKET_ENFILE

0x80007804

System file table full: A new socket could not be created


because the system file table is full.

META_E_GWYSOCKET_ENOSR

0x80007805

Socket request failed: A socket request failed because of no


available streams resources.

META_E_GWYSOCKET_EMSGSIZE

0x80007806

Unable to send message: A size of a message to be sent


exceeds 64K or the size of an input message exceeds the
length of the receivers input buffer.

META_E_GWYSOCKET_EADDRINUSE

0x80007807

Socket request failed: A socket request to create a server


socket failed because there is currently another active socket
serving the requested port number.

META_E_GWYSOCKET_EADDRNOTAV
AIL

0x80007808

Cannot connect to address: A request to connect to a


specific IP address on the local system failed.

META_E_GWYSOCKET_ENETDOWN

0x80007809

Socket request failed: A socket request failed because TCP/


IP is down.

META_E_GWYSOCKET_EISCONN

0x8000780A

Connection failed to remote system: An attempt to create a


client connection to a remote system failed because the
process already has a connection to the specified remote
system and service address.

META_E_GWYSOCKET_ENOTCONN

0x8000780B

Socket message failed: An attempt to send or receive a


socket message failed because there is no existing connection
to the specified remote system and service address.

META_E_GWYSOCKET_ECONNREFUS
ED

0x8000780C

Connection failed to remote system: An attempt to connect


to a remote system at a specific service address failed because
the remote system has no server for the requested service.

META_E_GWYSOCKET_EWOULDBLO
CK

0x8000780D

Socket request failed: A socket request failed because


completion would require the process to suspend and the
requestor wants an immediate response.

META_E_GWYSOCKET_EMFILE

0x8000780E

Socket not created: A new socket could not be created


because the processs file limit would be exceeded.

META_E_GWYSOCKET_GENERAL_FAI
LURE

0x8000780F

Socket request failed: A socket request failed for an


unspecified reason.

Teradata Meta Data Services Programmer Guide

481

Chapter 16: Error Messages


Gateway Socket Error Codes
Table 51: Gateway Socket Error Codes (continued)

Messages

Code

Probable Cause

META_E_GWYSOCKET_CONNECTION
_LOST

0x80007810

Socket request failed: A socket request failed because the


connection to the peer has been lost.

META_E_GWYSOCKET_SOCKET_NOT
_READY

0x80007811

Socket request failed: A socket request failed because the


protocol exchanges needed to set up encryption of the
socket messages has not completed.

482

Teradata Meta Data Services Programmer Guide

Chapter 16: Error Messages


XML Scripting Error Codes

XML Scripting Error Codes


The following table lists XML scripting error codes.
Table 52: XML Scripting Error Codes

Message

Code

Probable Cause

META_E_XML_PARSING_FAILED

0x80008000

XML syntax error: The XML file specified for use by the
metaxml program contains an XML syntax error.

META_E_XML_APACHE_INITIALIZ
ATION_FAILED

0x80008001

metaxml failed to initialize: An exception occurred during


initialization of the metaxml utility. This is an internal error.

META_E_XML_UNSUPPORTED_RE
POSITORY_RELEASE

0x80008002

An attempt was made to use the metaxml program to import a


file into a repository version earlier than version 2.01. The
metaxml program currently runs only on versions 2.01 and
later.

Gateway Communications Error Codes


The following table lists Gateway communications error codes.
Table 53: Gateway Communications Error Codes

Message

Code

Probable Cause

0x80007600

Unknown error: Unknown error status returned from


gwysockets code.

0x80007601

Network problem: Sockets/Ethernet/network not working.


Ethernet/network not available.

0x80007602

Failed communication: Unable to send message to server.

0x80007603

Failed communication: Receive message failed.

Teradata Meta Data Services Programmer Guide

483

Chapter 16: Error Messages


Gateway Communications Error Codes

484

Teradata Meta Data Services Programmer Guide

CHAPTER 17

Steps for Using the MDS APIs and


Example Code

This chapter contains illustrations and sample code for using MDS APIs. The two API
example codes are:

C++ Examples

Visual Basic Examples

All example programs can be found in the sample folder installed with the Meta Data
Development Kit. You can use either of the MDS APIs to:

Design your application data model defining classes, properties of each class, and the
relationships between the classes.

Create an application to load your model using the AIM API Classes.

Create applications that create, read, and modify objects and collections.

The following model will be used in the examples:


Figure 27: Meta Data Model Used for Examples
Relationship: RelAM
Origin Class: ClassA
DestClass: ClassM
ClassA

Collections
A1
ClassM

M1

RelAM

M3

M2
B Inherits
From A

N Inherits
From M
ClassB

A1
N1

ClassN

C Inherits
From B

O1

O Inherits
From N
ClassC

N3

N2

A1
RelAM

RelAM

O3

O2
ClassO

3047C014

C++ Examples
This section contains the following C++ examples:

Creating an Application to Load Your Meta Data Model

Creating, Reading and Modifying Objects and Collections

Adding Objects to Collections

Reading and Displaying Objects

Teradata Meta Data Services Programmer Guide

485

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples

Getting Properties of Objects

Getting Collections of Objects

Getting Collections of Object Keys

Getting All Objects or Object Keys of a Class

Updating Existing Objects

Removing Objects from Collections

Replacing Objects in Collections

Deleting Objects

Creating an Application to Load Your Meta Data Model


This section describes example code that shows you how you can create an application to load
your meta data model into the MDS repository.
In this example each Create call is treated as a separate statement.
Installed in the sample folder is an example file which shows how all model data can be coded
in an array and a generic program which loops through the array to use Create to create the
model, class, property and relationship descriptions.
HRESULT CreateAutoWorldModel()
{
HRESULT result;
CMetaAIM model;
CMetaClassDesc *AutoCorpClass = NULL;
CMetaClassDesc *AutoDevisionClass = NULL;
CMetaClassDesc *AutoClass = NULL;
CMetaClassDesc *AutoExClass = NULL;
CMetaClassDesc *BaseTruckClass = NULL;
CMetaClassDesc *TruckClass = NULL;
CMetaClassDesc *SportUteClass = NULL;
CMetaClassDesc *VanClass = NULL;
CMetaPropertyDesc *pProp = NULL;
CMetaRelationshipDesc *pCorpHasDivRel = NULL;
CMetaRelationshipDesc *pDivMakesAutosRel = NULL;
CMetaRelationshipDesc *pDivMakesTrucksRel = NULL;
MetaObjectIDVector RelsToProp;
MetaObjectIDVector superClasses;
result = model.CreateMDSModel(
NMAUTOWORLD, // Name
_T("Model for Auto Industry"), //Description
MODELGUID_AW // GUID
);
if (SUCCEEDED(result))
{
// Create Auto Class Description
result = model.CreateMDSClassDesc2(
AutoClass, // return object
NMAUTO, //Name
_T("Class of Autos"), //Description
MD_UNIQUE, // UniqueNamesFlag
CLSGUID_Auto, // GUID
NULLLOID, // use default owner
NULLLOID, // use default security profile
false , // a root class
false, // abstract class
superClasses
);
}
// Create DivisionMakesAutos Relationship Description
if (SUCCEEDED(result))
{
result = model.CreateMDSRelationshipDesc(

486

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
pDivMakesAutosRel, // Relationship object
NMDIVMAKESAUTOS, //Name
_T("Relationship that links autos to divisions"), //Description
AutoDevisionClass->GetObjectID(), // Orig Classid
AutoClass->GetObjectID(), // Dest Classid
MD_NULL, // UniqueNames Flag
MD_PROPDEL, // Propagate Delete Flag
RELGUID_DivMakesAutos, // GUID
NULLLOID, // use default owner
NULLLOID // use default security profile
);
}
if (AutoDevisionClass)
delete AutoDevisionClass;
if (AutoClass)
delete AutoClass;
if (pProp)
delete pProp;
if (pDivMakesAutosRel)
delete pDivMakesAutosRel;
return (result);
}

Creating, Reading and Modifying Objects and Collections


This section shows example code to create applications that create, read, and modify objects
and collections of your model in the MDS repository.
The following examples use the CMetaObject class and create new objects using
CMetaObject::WriteObject.
//////////////////////////////////////////////////////
// LoadAutoData functions
//
// Writes new AutoMaker and Auto objects
//////////////////////////////////////////////////////
HRESULT LoadAutoData(CMetaRepository &repos)
{
HRESULT result = S_OK;
// return value
OBJECTID_t
ClassIDAutoCorp= NULLLOID,
ClassIDAutoDiv= NULLLOID,
ClassIDAuto
= NULLLOID,
loidBigGuy
= NULLLOID,
loidAmericanAutos= NULLLOID,
loidTortoise= NULLLOID;
CMetaObjectobj;
CMetaProperty PropObj;
// Get the ClassIDs of the AutoManuf and Auto Classes
result = repos.GetObjectID(CLSGUID_AutoCorp, &ClassIDAutoCorp);
if (SUCCEEDED(result))
result = repos.GetObjectID(CLSGUID_AutoDiv, &ClassIDAutoDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(CLSGUID_Auto, &ClassIDAuto);
if (SUCCEEDED(result))
{
result = WriteNewObject(ClassIDAutoCorp,
_T("BigGuy Motors"), OBJGUID_BigGuyMotors, _T("A large American manufacturer"),
0, loidBigGuy);
}
if (SUCCEEDED(result))
{
result = WriteNewObject(ClassIDAutoDiv, _T("AmericanAutos"),
OBJGUID_AmericanAutos,
_T("A fictitous automaker based in the United States. This automaker likes naming their cars
after animals."),
0, loidAmericanAutos);
}
if (SUCCEEDED(result))
{
unsigned long carId = 0x1004abef;
result = WriteNewAuto(ClassIDAuto,_T("Tortoise"),
OBJGUID_Tortoise,

Teradata Meta Data Services Programmer Guide

487

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
_T("American Autos' Tortoise. A reliable sedan."), carId, 18545,
_T("1997-07-01"), 16.0, 55.1, 3350,
_T("Mid-priced Cars"), _T("AA's best-selling auto for those over 80."),
loidTortoise);
}
return(result)
}
////////////////////////////////////////////////////////////////////
// WriteNewObject function
//
// Writes a new object for a class that has only common properties.
////////////////////////////////////////////////////////////////////
HRESULT WriteNewObject(OBJECTID_t lclassid, TCHAR *name,
const GUID &goid,
TCHAR *description,
const OBJECTID_t lOwnerid,
OBJECTID_t &assignedLoid)
{
CMetaObjectobj;
// new object to write
HRESULT result = S_OK; // return value
// Set the object common properties
obj.SetClassID(lclassid);
obj.SetObjectName(name);
obj.SetObjectGUID(goid);
obj.SetDescription(description);
if (lOwnerid)
{
// If OwnerID is not set, the owner will be set to the
// initialized user
obj.SetOwnerID(lOwnerid);
}
// Write the new object
if (SUCCEEDED(result = obj.WriteObject()))
{
// Get the ObjectID of the new object
assignedLoid = obj.GetObjectID();
}
return (result);
} // WriteNewObject
///////////////////////////////////////////////////////////////
// WriteNewAuto function
//
// Write an Auto class object. This class has eight
// unique properties.
///////////////////////////////////////////////////////////////
HRESULT WriteNewAuto(OBJECTID_t lclassid, TCHAR *name,
const GUID &goid, TCHAR *description,
unsigned long carId, long basePrice,
TCHAR *designDate, double fuelTank,
double height, double weight,
TCHAR *vehicleType, TCHAR *review,
OBJECTID_t &assignedLoid)
{
CMetaObject obj;
HRESULT result = S_OK;
CMetaPropertyPropObj;
// Set common properties
obj.SetClassID(lclassid);
obj.SetObjectName(name);
obj.SetObjectGUID(goid);
obj.SetDescription(description);
// Set Unique Class Properties
// set CarId
result = PropObj.SetBinary(carId);
obj.SetPropertyValue(PID_AUTO_CARID, PropObj);
// set base price
PropObj.SetShort(basePrice);
obj.SetPropertyValue(PID_AUTO_BASEPRICE, PropObj);
// set design date
PropObj.SetString(designDate);
obj.SetPropertyValue(PID_AUTO_DESIGNDATE, PropObj);
// set fuel tank
PropObj.SetDbl(fuelTank);
obj.SetPropertyValue(PID_AUTO_FUELTANK, PropObj);

488

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
// set height
PropObj.SetDbl(height);
obj.SetPropertyValue(PID_AUTO_HEIGHT, PropObj);
// set weight
PropObj.SetInt(weight);
obj.SetPropertyValue(PID_AUTO_WEIGHT, PropObj);
// set vehicletype
PropObj.SetString(vehicleType);
obj.SetPropertyValue(PID_AUTO_VEHICLETYPE, PropObj);
// set review
PropObj.SetString(review);
obj.SetPropertyValue(PID_AUTO_REVIEW, PropObj);
// Call WriteObject
if (SUCCEEDED(result = obj.WriteObject()))
{
// Get the new Object ID
assignedLoid = obj.GetObjectID();
}
return (result);
} // WriteNewAuto

Adding Objects to Collections


This section shows example code to add objects to collections. The example code uses:

CMetaObject::AddToDestCollection

CMetaObject::AddToOrigCollection

CMetaObject::AddManyToDestCollection

////////////////////////////////////////////////////////////////////
// AddColl function
//
// Example of using the CMetaObject::AddToDestCollection function
////////////////////////////////////////////////////////////////////
HRESULT AddColl(CMetaRepository &repos)
{
HRESULT result = S_OK;
// return value
CMetaObject obj2;
OBJECTID_t
RelIDCorpHasDiv= NULLLOID,
loidBigGuy = NULLLOID,
loidAmericanAutos= NULLLOID;
// Get the ObjectIds of EuroDivision, Tornado, Hurrican and the
// DivMakesAutos relationship
result = repos.GetObjectID(OBJGUID_BigGuyMotors, &loidBigGuy);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_AmericanAutos, &loidAmericanAutos);
if (SUCCEEDED(result))
{
// Set the local object ObjectID to BigGuy
obj2.SetObjectID(loidBigGuy);
// Call AddToDestCollection to add AmericanAutos to the
// CorpHasDivisions collection of BigGuy
result = obj2.AddToDestCollection(loidAmericanAutos, NULLGUID,
RelIDCorpHasDiv);
}
return (result);
}
//////////////////////////////////////////////////////////////////
// AddOrigColl function
//
// Example of using the CMetaObject::AddToOrigCollection function
//////////////////////////////////////////////////////////////////
HRESULT AddOrigColl(CMetaRepository &repos)
{
HRESULT result = S_OK;
// return value
CMetaObject obj;
OBJECTID_t
RelIDDivMakesAutos= NULLLOID,
RelIDCorpHasDiv= NULLLOID,
loidEuroDiv = NULLLOID,
loidTurtle = NULLLOID;

Teradata Meta Data Services Programmer Guide

489

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples

// Get the ObjectIDs for EuroDivision, Turtle and the DivMakesAutos


// relationship
result = repos.GetObjectID(OBJGUID_EuroDivision, &loidEuroDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(RELGUID_DivMakesAutos,
&RelIDDivMakesAutos);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_FarEastMotors,
&loidFarEast);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_LuxuryMotors, &loidLuxuryMotors);
if (SUCCEEDED(result))
result = repos.GetObjectID(RELGUID_CorpHasDivisions,
&RelIDCorpHasDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Turtle, &loidTurtle);
if (SUCCEEDED(result))
{
// Set the local object ObjectID to LuxuryMotors
obj.SetObjectID(loidLuxuryMotors);
// Call AddToOrigCollection to add FarEast Motors to the
// CorpHasDivisions collection
result = obj.AddToOrigCollection(loidFarEast, NULLGUID,
RelIDCorpHasDiv);
}
if (SUCCEEDED(result))
{
// Set the local object ObjectID to Turtle
obj.SetObjectID(loidTurtle);
// Call AddToOrigCollection to add EuroDivision to the DivMakesAutos
result = obj.AddToOrigCollection(loidEuroDiv, NULLGUID,
RelIDDivMakesAutos);
}
return (result);
}
//////////////////////////////////////////////////////////////////////
// AddManyColl function
//
// Example of using the CMetaObject::AddManyToDestCollection function
//////////////////////////////////////////////////////////////////////
HRESULT AddManyColl(CMetaRepository &repos)
{
LLOBJECTID_t inLoids;
// list of loids to add to a collection
HRESULT result = S_OK;
// return value
CMetaObject obj;
OBJECTID_t
RelIDDivMakesAutos= NULLLOID,
loidAmericanAutos= NULLLOID,
loidYearling= NULLLOID,
loidTortoise= NULLLOID;
// Get the ObjectIDs
result = repos.GetObjectID(OBJGUID_AmericanAutos, &loidAmericanAutos);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Yearling, &loidYearling);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Tortoise, &loidTortoise);
if (SUCCEEDED(result))
result = repos.GetObjectID(RELGUID_DivMakesAutos,
&RelIDDivMakesAutos);
if (SUCCEEDED(result))
{
// Add the ObjectIDs of Yearling and Tortoise to a list
inLoids.push_back(loidYearling);
inLoids.push_back(loidTortoise);
// Set the local object ObjectID to AmericanAutos
obj.SetObjectID(loidAmericanAutos);
// Call AddManyToDestCollection to add Yearling and Tortoise to
// the DivMakesAutos collection of AmericanAutos
result = obj.AddManyToDestCollection(inLoids, NULLGUID,
RelIDDivMakesAutos);
}
return result;
}

490

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples

Reading and Displaying Objects


This section shows example code to read and display objects. The example code uses:
MetaObject::ReadObject
///////////////////////////////////////////////////////////////////
// ReadByClsGUIDName function
//
// Set ClassGUID and Name to Read object.
///////////////////////////////////////////////////////////////////
void ReadByClsGUIDName()
{
CMetaObjectobj;
CMetaObjectobj2;
cout << endl << ">>> Read by ClassGUID and Name" << endl;
obj.SetClassGUID(CLSGUID_AutoDiv);
obj.SetObjectName(_T("AmericanAutos"));
PerformReadObject(obj);
cout << endl << ">>> Read by ClassGUID and Name" << endl;
obj2.SetClassGUID(CLSGUID_Auto);
obj2.SetObjectName(_T("Yearling"));
PerformReadObject(obj2);
}
////////////////////////////////////////////////////////////////
// ReadByObjectGUID function
//
// Set ObjectGUID to Read object.
////////////////////////////////////////////////////////////////
void ReadByObjectGUID()
{
CMetaObjectobj3;
CMetaObjectobj4;
CMetaObject obj5;
HRESULT result = S_OK;
cout << endl << ">>> Read by Object GUID" << endl;
obj3.SetObjectGUID(OBJGUID_AmericanAutos);
PerformReadObject(obj3);
cout << endl << ">>> Read by Object GUID" << endl;
obj4.SetObjectGUID(OBJGUID_Tornado);
PerformReadObject(obj4);
}
//////////////////////////////////////////////////////////////
// ReadByClsIDName function
//
// Set ClassID and Name to Read object.
//////////////////////////////////////////////////////////////
void ReadByClsIDName(CMetaRepository& repos)
{
OBJECTID_t
ClassIDDiv
= NULLLOID,
ClassIDAuto
= NULLLOID;
CMetaObjectobj5;
CMetaObjectobj6;
HRESULT result = S_OK;
result = repos.GetObjectID(CLSGUID_AutoDiv, &ClassIDDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(CLSGUID_Auto, &ClassIDAuto);
if (SUCCEEDED(result))
{
cout << endl << ">>> Read by ClassID and Name" << endl;
obj5.SetClassID(ClassIDDiv);
obj5.SetObjectName(_T("AmericanAutos"));
PerformReadObject(obj5);
cout << endl << ">>> Read by ClassID and Name" << endl;
obj6.SetClassID(ClassIDAuto);
obj6.SetObjectName(_T("Yearling"));
PerformReadObject(obj6);
}
}
///////////////////////////////////////////////////////////////

Teradata Meta Data Services Programmer Guide

491

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
// ReadByObjectID function
//
// Set ObjectID to Read object.
///////////////////////////////////////////////////////////////
void ReadByObjectID(CMetaRepository& repos)
{
OBJECTID_t
loidEuroDiv= NULLLOID,
loidTortoise= NULLLOID;
CMetaObjectobj7;
CMetaObjectobj8;
HRESULT result = S_OK;
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_EuroDivision, &loidEuroDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Tortoise, &loidTortoise);
if (SUCCEEDED(result))
{
cout << endl << ">>> Read by ObjectID" << endl;
obj7.SetObjectID(loidEuroDiv);
PerformReadObject(obj7);
cout << endl << ">>> Read by ObjectID" << endl;
obj8.SetObjectID(loidTortoise);
PerformReadObject(obj8);
}
}

Getting Properties of Objects


This section shows example code to get properties of objects. The example code uses:
CMetaObject::GetPropertyValue
/////////////////////////////////////////////////////////////////////
// GetAutoProp function
//
// Read Auto Object and Get Auto Properties.
/////////////////////////////////////////////////////////////////////
HRESULT GetAutoProp()
{
CMetaObjectobj;
CMetaProperty PropObj;
String CarID;
unsigned charCarIDBuf[4];
int
Bufsz = 4;
short
Price;
String DesignDate;
float
FuelTank;
double Height;
int
Weight;
String VehicleType;
String Review;
HRESULT result = S_OK;
// Read by ClassGUID and Name
obj.SetClassGUID(CLSGUID_Auto);
obj.SetObjectName(_T("Yearling"));
if (SUCCEEDED(result = obj.ReadObject()))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_CARID, PropObj)))
{
result = PropObj.GetBinaryAsString(CarID);
result = PropObj.GetBinary((void*)CarIDBuf, Bufsz);
}
}
if (SUCCEEDED(result))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_BASEPRICE, PropObj)))
result = PropObj.GetShort(Price);
}
if (SUCCEEDED(result))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_DESIGNDATE, PropObj)))
result = PropObj.GetString(DesignDate);

492

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
}
if (SUCCEEDED(result))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_FUELTANK, PropObj)))
result = PropObj.GetFloat(FuelTank);
}
if (SUCCEEDED(result))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_HEIGHT, PropObj)))
result = PropObj.GetDouble(Height);
}
if (SUCCEEDED(result))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_WEIGHT, PropObj)))
result = PropObj.GetInt(Weight);
}
if (SUCCEEDED(result))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_VEHICLETYPE, PropObj)))
result = PropObj.GetString(VehicleType);
}
if (SUCCEEDED(result))
{
if (SUCCEEDED(result =
obj.GetPropertyValue(PID_AUTO_REVIEW, PropObj)))
result = PropObj.GetString(Review);
}
return(result);
}

Getting Collections of Objects


This section shows example code to get collections of objects. The example code uses:

CMetaObject::GetDestCollection

CMetaObject::GetOrigCollection

CMetaObject::GetDestCollectionByProperty

The example also shows how to iterate through the returned vector of objects.
//////////////////////////////////////////////////////////////////
// GetDestColl function
//
// Example of using the CMetaObject::GetDestCollection function
//////////////////////////////////////////////////////////////////
HRESULT GetDestColl()
{
LLCMetaObjectobjectList; // returned set of collection objects
HRESULT
result = S_OK;
CMetaObjectobj;
obj.SetClassGUID(CLSGUID_AutoDiv);
obj.SetObjectName(_T("AmericanAutos"));
if (SUCCEEDED(result = obj.ReadObject()))
{
// Get collection of all Autos of the AmericanAutos
result = obj.GetDestCollection(objectList, RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Collection of all Autos of the AmericanAutos Division" << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
// Get collection of all Autos of the AmericanAutos Division named Yearling
result = obj.GetDestCollection(objectList, RELGUID_DivMakesAutos,
0,_T("Yearling"));
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Collection of Autos of the AmericanAutos Division named Yearling";

Teradata Meta Data Services Programmer Guide

493

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
cout << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
}
return (result);
}
////////////////////////////////////////////////////////////////////////////////
// GetOrigColl function
//
// Example of using the CMetaObject::GetOrigCollection function
////////////////////////////////////////////////////////////////////////////////
HRESULT GetOrigColl()
{
LLCMetaObjectobjectList; // returned set of collection objects
HRESULT
result = S_OK;
CMetaObjectobj;
obj.SetClassGUID(CLSGUID_Auto);
obj.SetObjectName(_T("Yearling"));
if (SUCCEEDED(result = obj.ReadObject()))
{
// Get collection of all Auto Divisions of Yearling
result = obj.GetOrigCollection(objectList, RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Collection of all Auto Divisions of Yearling" << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
if (SUCCEEDED(result))
{
// Get collection of all Auto Divisions of Yearling
// by the name AmericanAutos
result = obj.GetOrigCollection(objectList, RELGUID_DivMakesAutos,
0,_T("AmericanAutos"));
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Collection of all Auto Divisions of Yearling " << endl;
cout << ">>> by the name AmericanAutos" << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
}
}
return (result);
}
////////////////////////////////////////////////////////////////////////////
// GetCollectionByProperty function
//
// Read Auto Object and Get origin and destination collections by Property.
//
// Example of using the CMetaObject::GetDestCollectionByProperty function
////////////////////////////////////////////////////////////////////////////
HRESULT GetCollectionByProperty()
{
HRESULT
result = S_OK;
CMetaObjectobj;
LLCMetaObjectobjectList;
CMetaFilterInfo filterInfo;
// one property filter entry
CMetaObjectKeypropID;
MetaFilterInfoVectorpropFilter; // property filter specification
MetaObjectKeyVectorsortList;
// Read by ClassGUID and Name
obj.SetClassGUID(CLSGUID_AutoDiv);
obj.SetObjectName(_T("Euro Division"));
if (SUCCEEDED(result = obj.ReadObject()))
{
// search for objects in collection with Weight=3000
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.value.SetName(NMWEIGHT);
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.value.SetInt(3000);
propFilter.push_back(filterInfo);
// Sort By Name & Object ID
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);

494

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
propID.SetObjectID(PID_CMN_LOID);
sortList.push_back(propID);
// Call GetDestCollectionByProperty
result = obj.GetDestCollectionByProperty(objectList,
propFilter, sortList, RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Objects in collection with Weight=3000" << endl;
PrintObjectList(objectList);
}
DisplayResult(result);
if (SUCCEEDED(result))
{
// return all objects in collection
CLEARVECTOR(propFilter); filterInfo.Initialize();
// Sort By Name
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);
// Call GetDestCollectionByProperty
result = obj.GetDestCollectionByProperty(objectList,
propFilter, sortList, RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> All objects in Auto collection" << endl;
PrintObjectList(objectList);
}
DisplayResult(result);
}
if (SUCCEEDED(result))
{
// return objects in collection with a BasePrice < 12000
// or a BasePrice > 20000
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.value.SetPropertyID(PID_AUTO_BASEPRICE);
filterInfo.SetComparisonOperator(LESS_THAN);
filterInfo.value.SetShort(12000);
filterInfo.SetLogicalOperator(META_OR);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetPropertyID(PID_AUTO_BASEPRICE);
filterInfo.SetComparisonOperator(GREATER_THAN);
filterInfo.value.SetShort(20000);
propFilter.push_back(filterInfo);
// Sort By Name
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);
// Call GetDestCollectionByProperty
result = obj.GetDestCollectionByProperty(objectList,
propFilter, sortList, RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Objects in collection with a " << endl;
cout << ">>> BasePrice < 12000 or a BasePrice > 20000" << endl;
PrintObjectList(objectList);
}
DisplayResult(result);
}
}
return result;
}
//////////////////////////////////////////////////////////////////
// PrintObjectList function
// Print a vector of CMetaObject objects.
//////////////////////////////////////////////////////////////////
void PrintObjectList(LLCMetaObject &objectList)
{
LICMetaObject pMetaObject;
if (objectList.size() > 0)

Teradata Meta Data Services Programmer Guide

495

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
{
cout << "\nCOLLECTION BEGIN ";
pMetaObject = objectList.begin();
while(pMetaObject != objectList.end())
{
cout << endl;
PrintMetaObject(*pMetaObject);
pMetaObject++;
}
cout << "COLLECTION END " << endl;
}
else
{
cout << "EMPTY COLLECTION "
}

<< endl;

Getting Collections of Object Keys


This section shows example code to get collections of object keys. The example code uses:

CMetaObject::GetDestCollectionKeys

CMetaObject::GetOrigCollectionKeys

The example code also shows how to iterate through the returned vector of object keys.
////////////////////////////////////////////////////////////////////
// GetDestCollKeys function
// Reads and print a collection of keys.
//
// Example of using the CMetaObject::GetDestCollectionKeys function
////////////////////////////////////////////////////////////////////
HRESULT GetDestCollKeys()
{
MetaObjectKeyVector objectKeys;
HRESULT
result = S_OK;
CMetaObjectobj;
obj.SetClassGUID(CLSGUID_AutoDiv);
obj.SetObjectName(_T("AmericanAutos"));
if (SUCCEEDED(result = obj.ReadObject()))
{
// Get collection of object keys (name and objectid)
// of all Autos of AmericanAutos
result = obj.GetDestCollectionKeys(objectKeys,
RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Collection of object keys (name and objectid) ";
cout << endl;
cout << ">>> of all Autos of AmericanAutos" << endl;
PrintKeyList(objectKeys);
CLEARVECTOR(objectKeys);
}
}
return(result);
}
/////////////////////////////////////////////////////////////////////
// GetOrigCollKeys function
// Reads and print a collection of keys.
//
// Example of using the CMetaObject::GetOrigCollectionKeys function
/////////////////////////////////////////////////////////////////////
HRESULT GetOrigCollKeys()
{
MetaObjectKeyVector objectKeys;
HRESULT
result = S_OK;
CMetaObjectobj;
obj.SetClassGUID(CLSGUID_Auto);
obj.SetObjectName(_T("Yearling"));
if (SUCCEEDED(result = obj.ReadObject()))
{
// Get collection of all Auto Divisions of Yearling

496

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
result = obj.GetOrigCollectionKeys(objectKeys,
RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Collection of all Auto Divisions of
PrintKeyList(objectKeys);
CLEARVECTOR(objectKeys);
}

Yearling" << endl;

}
return (result);
}

Getting All Objects or Object Keys of a Class


This section shows example code to get all objects or object keys of a class. The example code
uses:

CMetaObject::GetClassObjects

CMetaObject::GetClassObjectKeys

CMetaObject::GetClassObjectsByProperty

///////////////////////////////////////////////////////////////////
// GetClassObjs function
// Reads and prints the objects in a class.
//
// Example of using the CMetaObject::GetClassObjects function
///////////////////////////////////////////////////////////////////
HRESULT GetClassObjs()
{
LLCMetaObjectobjectList;
HRESULT
result = S_OK;
CMetaObjectobj;
// Gets all the objects in the Auto Class
if (SUCCEEDED(result = obj.GetClassObjects(objectList,
CLSGUID_Auto)))
{
cout << endl << ">>> All auto class objects" << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
DisplayResult(result);
// Gets all the objects in the Auto Division Class which
// have the name AmericanAutos
if (SUCCEEDED(result = obj.GetClassObjects(objectList,
CLSGUID_AutoDiv, 0, _T("AmericanAutos"))))
{
cout << endl;
cout << ">>> All auto division objects with name=AmericanAutos" << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
DisplayResult(result);
return (result);
}
//////////////////////////////////////////////////////////////////////////
// GetClassObjKeys function
// Reads and prints the object keys in a class.
//////////////////////////////////////////////////////////////////////////
HRESULT GetClassObjKeys()
{
MetaObjectKeyVector keyList;
HRESULT
result = S_OK;
CMetaObjectobj;
// Gets all the object keys (name and ObjectID) of all
// objects in the Auto Class
if (SUCCEEDED(result = obj.GetClassObjectKeys(keyList,
CLSGUID_Auto)))
{
cout << endl;

Teradata Meta Data Services Programmer Guide

497

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
cout << ">>> Object keys (name and ObjectID) of all " << endl;
cout << ">>> objects in the Auto Class" << endl;
PrintKeyList(keyList);
CLEARVECTOR(keyList);
}
DisplayResult(result);
return (result);
}
////////////////////////////////////////////////////////////////////////
// GetClassObjectsByProperty function
//
// Read Auto Object and Get class objects by Property.
//
// Example of using the CMetaObject::GetClassObjectsByProperty function
////////////////////////////////////////////////////////////////////////
HRESULT GetClassObjectsByProperty()
{
HRESULT
result = S_OK;
CMetaObject obj;
CMetaObjectKeypropID;
LLCMetaObjectobjectList;
CMetaFilterInfofilterInfo;
// one property filter entry
MetaFilterInfoVectorpropFilter; // property filter specification
MetaObjectKeyVectorsortList;
// Setup to search for autos with a vehicletype which
// ends with the value "Cars"
filterInfo.value.SetPropertyID(PID_AUTO_VEHICLETYPE);
filterInfo.SetComparisonOperator(REGEX);
filterInfo.value.SetString(_T("%Cars"));
propFilter.push_back(filterInfo);
// Sort By Autos' CARIDs
propID.SetObjectName(NMCARID);
sortList.push_back(propID);
// Call GetClassObjectsByProperty
result = obj.GetClassObjectsByProperty(objectList, propFilter,
sortList, CLSGUID_Auto);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Auto class objects: VehicleType=%Cars" << endl;
PrintObjectList(objectList);
}
CLEARVECTOR(objectList);
DisplayResult(result);
if(SUCCEEDED(result))
{
// Setup to search for autos with a name beginning with a T
// and a FuelTank less than 12
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.value.SetPropertyID(PID_CMN_NAME);
filterInfo.SetComparisonOperator(REGEX);
filterInfo.value.SetString(_T("T%"));
filterInfo.SetLogicalOperator(META_AND);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetName(_TEXT("FuelTank"));
filterInfo.SetComparisonOperator(LESS_THAN);
filterInfo.value.SetDouble(12.0);
propFilter.push_back(filterInfo);
// Sort By Name and ObjectID
CLEARVECTOR(sortList); propID.Initialize();
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);
propID.SetObjectID(PID_CMN_LOID);
sortList.push_back(propID);
// Call GetClassObjectsByProperty
result = obj.GetClassObjectsByProperty(objectList, propFilter,
sortList, CLSGUID_Auto);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Auto class objects: name beginning with a T ";
cout << endl;
cout << ">>> and a FuelTank less than 12" << endl;

498

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
PrintObjectList(objectList);
}
CLEARVECTOR(objectList);
}
if(SUCCEEDED(result))
{
// Setup to search for autos with design date of 1997-03-30
// or have a baseprice >= 18000
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.value.SetPropertyID(PID_AUTO_DESIGNDATE);
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.value.SetString(_T("1997-03-30"));
filterInfo.SetLogicalOperator(META_OR);
propFilter.push_back(filterInfo);
filterInfo.Initialize();
filterInfo.value.SetPropertyID(PID_AUTO_BASEPRICE);
filterInfo.SetComparisonOperator(GREATER_THAN_OR_EQUAL);
filterInfo.value.SetShort(18000);
propFilter.push_back(filterInfo);
// Sort By BasePrice and Name
CLEARVECTOR(sortList); propID.Initialize();
propID.SetObjectID(PID_AUTO_BASEPRICE);
sortList.push_back(propID);
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);
// Call GetClassObjectsByProperty
result = obj.GetClassObjectsByProperty(objectList, propFilter,
sortList, CLSGUID_Auto);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Autos with design date of 1997-03-30 " << endl;
cout << ">>> or have a baseprice >= 18000" << endl;
PrintObjectList(objectList);
}
CLEARVECTOR(objectList);
}
if(SUCCEEDED(result))
{
// Using derived class - search for autos with
// division name = Luxury Motors
CLEARVECTOR(propFilter); filterInfo.Initialize();
filterInfo.value.SetName(_T("DivisionName"));
filterInfo.SetComparisonOperator(EQUAL);
filterInfo.value.SetString(_T("LuxuryMotors"));
propFilter.push_back(filterInfo);
// Sort By Name
CLEARVECTOR(sortList); propID.Initialize();
propID.SetObjectID(PID_CMN_NAME);
sortList.push_back(propID);
// Call GetClassObjectsByProperty
result = obj.GetClassObjectsByProperty(objectList, propFilter,
sortList, CLSGUID_AutoEx);
if (SUCCEEDED(result))
{
cout << endl;
cout << ">>> Derived class where division name = LuxuryMotors" << endl;
PrintObjectList(objectList);
}
CLEARVECTOR(objectList);
}
return result;
}

Updating Existing Objects


This section shows example code to update existing objects. The example code uses:
CMetaObject::WriteObject
The example code also shows the use of Transactions.
Teradata Meta Data Services Programmer Guide

499

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
///////////////////////////////////////////////////////////////////
// ReWrite function
//
///////////////////////////////////////////////////////////////////
HRESULT ReWrite(CMetaRepository &repos)
{
CMetaObjectobj;
HRESULT
result = S_OK;
CMetaPropertyPropObj;
unsigned longcarId = 0x1015aeff;
// Begin an explicit transaction
if (SUCCEEDED(repos.BeginTransaction()))
{
obj.SetClassGUID(CLSGUID_AutoDiv);
obj.SetObjectName(_T("AmericanAutos"));
// Read the object to fill in all existing properties
// and lock the object
if (SUCCEEDED(result = obj.ReadObjectWithLock()))
{
// set updated fields
obj.SetDescription(_T("New Description for AmericanAutos"));
// Write updated object
result = obj.WriteObject();
}
// Commit the changes
repos.Commit();
}
// Begin an explicit transaction
if (SUCCEEDED(repos.BeginTransaction()))
{
obj.Initialize();
obj.SetClassGUID(CLSGUID_Auto);
obj.SetObjectName(_T("Yearling"));
// Read the object to fill in all existing properties
if (SUCCEEDED(result = obj.ReadObjectWithLock()))
{
// set updated fields
if (SUCCEEDED(result = PropObj.SetBinary(carId)))
{
obj.SetPropertyValue(PID_AUTO_CARID, PropObj);
PropObj.SetShort(22000);
obj.SetPropertyValue(PID_AUTO_BASEPRICE, PropObj);
PropObj.SetString(_T("1965-04-25"));
obj.SetPropertyValue(PID_AUTO_DESIGNDATE, PropObj);
// Write updated object
result = obj.WriteObject();
}
}
// Commit the changes
repos.Commit();
}
return (result);
}

Removing Objects from Collections


This section shows example code to remove objects from collections. The example code uses:

CMetaObject::RemoveFromDestCollection

CMetaObject::RemoveFromOrigCollection

CMetaObject::RemoveManyFromDestCollection

CMetaObject::RemoveManyFromOrigCollection

//////////////////////////////////////////////////////////////////////
// RemDestColl function
//
// Example of using the CMetaObject::RemoveFromDestCollection function
///////////////////////////////////////////////////////////////////////
HRESULT RemDestColl(CMetaRepository& repos)
{
HRESULT
result = S_OK;

500

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
CMetaObjectobj;
OBJECTID_t
RelIDDivMakesAutos= NULLLOID,
loidEuroDiv = NULLLOID,
loidTornado = NULLLOID;
// Get ObjectIDs of EuroDiv, Tornado and the ManufofAutos Relationship
result = repos.GetObjectID(OBJGUID_EuroDivision, &loidEuroDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Tornado, &loidTornado);
if (SUCCEEDED(result))
result = repos.GetObjectID(RELGUID_DivMakesAutos,
&RelIDDivMakesAutos);
if (SUCCEEDED(result))
{
// Set local object ObjectID to EuroDivision
obj.SetObjectID(loidEuroDiv);
// Call RemoveFromDestCollection to remove Tornado from
// the collection of EuroDivision
result = obj.RemoveFromDestCollection(loidTornado, NULLGUID,
RelIDDivMakesAutos);
}
return (result);
} // RemDestColl
///////////////////////////////////////////////////////////////////////
// RemOrigColl function
//
// Example of using the CMetaObject::RemoveFromOrigCollection function
///////////////////////////////////////////////////////////////////////
HRESULT RemOrigColl(CMetaRepository& repos)
{
HRESULT
result = S_OK;
CMetaObjectobj;
OBJECTID_t
loidAA = NULLLOID,
loidYearling= NULLLOID;
// Get ObjectIDs of AmericanAutos and Yearling
result = repos.GetObjectID(OBJGUID_AmericanAutos, &loidAA);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Yearling, &loidYearling);
if (SUCCEEDED(result))
{
// Set local object ObjectID to Yearling
obj.SetObjectID(loidYearling);
// Call RemoveFromOrigCollection to remove AmericanAutos from
// the collection of Yearling
result = obj.RemoveFromOrigCollection(loidAA,
RELGUID_DivMakesAutos);
}
return (result);
} // RemOrigColl
//////////////////////////////////////////////////////////////////////////
// RemMnyDestColl function
//
// Example of using the CMetaObject::RemoveManyFromDestCollection function
//////////////////////////////////////////////////////////////////////////
HRESULT RemMnyDestColl(CMetaRepository& repos)
{
LLOBJECTID_tinLoids;
// list of loids to remove from a collection
HRESULT
result = S_OK;
CMetaObjectobj;
OBJECTID_t
RelIDDivMakesAutos= NULLLOID,
loidEuroDiv = NULLLOID,
loidTornado = NULLLOID,
loidHurricane= NULLLOID;
// Get the Object IDs of EuroDivison, Tornado, Hurricane and the ManufofAutos
// relationship
result = repos.GetObjectID(OBJGUID_EuroDivision, &loidEuroDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Tornado, &loidTornado);
if (SUCCEEDED(result))

Teradata Meta Data Services Programmer Guide

501

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
result = repos.GetObjectID(OBJGUID_Hurricane, &loidHurricane);
if (SUCCEEDED(result))
result = repos.GetObjectID(RELGUID_DivMakesAutos,
&RelIDDivMakesAutos);
if (SUCCEEDED(result))
{
// put ObjectIDs of Tornado and Hurricane on a list
inLoids.push_back(loidTornado);
inLoids.push_back(loidHurricane);
// set the local object ObjectID to EuroDivision
obj.SetObjectID(loidEuroDiv);
// Call RemoveManyFromDestCollection to remove Tornado and
// Hurricane from the collection of EuroDivision
result = obj.RemoveManyFromDestCollection(inLoids, NULLGUID,
RelIDDivMakesAutos);
}
CLEARVECTOR(inLoids);
return (result);
} // RemMnyDestColl
//////////////////////////////////////////////////////////////////////////
// RemMnyOrigColl function
//
// Example of using the CMetaObject::RemoveManyFromOrigCollection function
//////////////////////////////////////////////////////////////////////////
HRESULT RemMnyOrigColl(CMetaRepository& repos)
{
LLOBJECTID_tinLoids;
// list of loids to remove from a collection
HRESULT
result = S_OK;
CMetaObjectobj;
OBJECTID_t
loidAA = NULLLOID,
loidYearling= NULLLOID;
// Get the Object IDs of AmericanAutos and Yearling
result = repos.GetObjectID(OBJGUID_AmericanAutos, &loidAA);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Yearling, &loidYearling);
if (SUCCEEDED(result))
{
// Put the ObjectID of AmericanAutos on a list
inLoids.push_back(loidAA);
// Set the local object ObjectID to Yearling
obj.SetObjectID(loidYearling);
// Call RemoveManyFromOrigCollection to remove AmericanAutos
// from the collection of Yearling
result = obj.RemoveManyFromOrigCollection(inLoids,
RELGUID_DivMakesAutos);
}
CLEARVECTOR(inLoids);
return (result);
} // RemMnyOrigColl

Replacing Objects in Collections


This section shows example code to replace objects in collections. The example code uses:

CMetaObject::ReplaceDestCollection

CMetaObject::GetDestCollection

//////////////////////////////////////////////////////////////////////
// ReplaceCollection function
//
// Example of using the CMetaObject::ReplaceDestCollection and
// ReplaceOrigCollection functions
//////////////////////////////////////////////////////////////////////
HRESULT ReplaceCollection(CMetaRepository &repos)
{
LLCMetaObjectobjectList;
LLOBJECTID_t inLoids;
// list of loids

502

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
C++ Examples
HRESULT result = S_OK;
// return value
CMetaObject obj;
OBJECTID_t
loidEuroDiv = NULLLOID,
loidAmericanAutos= NULLLOID,
loidHurricane= NULLLOID,
loidYearling= NULLLOID,
loidTortoise= NULLLOID,
loidTurtle = NULLLOID;
// Get the ObjectIDs
result = repos.GetObjectID(OBJGUID_Hurricane, &loidHurricane);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Turtle, &loidTurtle);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_AmericanAutos, &loidAmericanAutos);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Yearling, &loidYearling);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_Tortoise, &loidTortoise);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_EuroDivision, &loidEuroDiv);
if (SUCCEEDED(result))
{
//add Hurricane and Turtle ObjectIDs to a list
inLoids.push_back(loidHurricane);
inLoids.push_back(loidTurtle);
// Set local object objectID to that of AmericanAutos
obj.SetObjectID(loidAmericanAutos);
// Call ReplaceDestCollection to replace the DivMakesAutos
// of AmericanAutos with Hurricane, Turtle
result = obj.ReplaceDestCollection(inLoids,
RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
// Get and display the Dest Collection to see results
result = obj.GetDestCollection(objectList,
RELGUID_DivMakesAutos);
if(SUCCEEDED(result))
{
cout << endl;
cout << ">>> AmericanAutos Collection after replace" << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
}
}
if (SUCCEEDED(result))
{
// Initialize input list
CLEARVECTOR(inLoids);
//add AmericanAutos objectID to list.
inLoids.push_back(loidAmericanAutos);
// Initialize local object
obj.Initialize();
// Set local object objectID to that of Turtle
obj.SetObjectID(loidTurtle);
// Call ReplaceOrigCollection to replace the origin
// DivMakesAutos collection of Turtle from EuroDiv to AmericanAutos
result = obj.ReplaceOrigCollection(inLoids,
RELGUID_DivMakesAutos);
if (SUCCEEDED(result))
{
// Get and display the Orig Collection to see results
result = obj.GetOrigCollection(objectList,
RELGUID_DivMakesAutos);
if(SUCCEEDED(result))
{
cout << endl;
cout << ">>> EuroDivision collection after replace" << endl;
PrintObjectList(objectList);
CLEARVECTOR(objectList);
}
}
}
);

Teradata Meta Data Services Programmer Guide

503

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples
return result;
} // ReplaceCollection

Deleting Objects
This section shows example code to delete objects. The example code uses:
CMetaObject::Delete.
///////////////////////////////////////////////////////////////////
// DeleteObject function
//
// Example of using the CMetaObject::Delete function
///////////////////////////////////////////////////////////////////
HRESULT DeleteObject(CMetaRepository& repos)
{
CMetaObject obj;
HRESULT result = S_OK;
OBJECTID_t
loidAutoWorld= NULLLOID,
loidEuroDiv = NULLLOID,
loidAmericanAutos= NULLLOID;
// Get the ObjectIDs
result = repos.GetObjectID(OBJGUID_EuroDivision, &loidEuroDiv);
if (SUCCEEDED(result))
result = repos.GetObjectID(OBJGUID_AmericanAutos, &loidAmericanAutos);
if (SUCCEEDED(result))
result = repos.GetObjectID(MODELGUID_AW, &loidAutoWorld);
if (SUCCEEDED(result))
{
// Set the local object ObjectID
obj.SetObjectID(loidEuroDiv);
// Call Delete to delete EuroDiv
result= obj.Delete();
}
if (SUCCEEDED(result))
{
// Set the local object ObjectID
obj.SetObjectID(loidAmericanAutos);
// Call Delete to delete AmericanAutos
result= obj.Delete();
}
if (SUCCEEDED(result))
{
// Set the local object ObjectID
obj.SetObjectID(loidAutoWorld);
// Call Delete to delete AutoWorld
result= obj.Delete();
}
return (result);
}

Visual Basic Examples


The following Visual Basic examples are provided:

504

Initialization

Creating an AIM

Writing MDS Objects

Adding Many Objects to a Collection

Getting Objects in a Collection

Getting Objects of a Class

Replacing/Removing Objects from a Collection


Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples

Reading an Object

See the sample vb folder installed with the MDS SDK for more example code.

Initialization
This section shows example code to connect an application to the MDS repository.
'////////////////////////////////////////////////////////////////////////////
'
'
Initialize Repository
'
'
Sets up the connection to the repository using the global object
'
Repository
'
'////////////////////////////////////////////////////////////////////////////
Function InitializeRepository () As Boolean
Set Repository = New MetaActive
Repository.Initialize userName, password
InitializeRepository = True
Exit Function
End Function

Creating an AIM
This section shows example code to create an AIM.
'////////////////////////////////////////////////////////////////////////////////
'
'
Meta_CreateModel
'
'
Adds the definition of a model with the name 'modelName' to the
'
repository. The owner and group names for the model are 'ownerName' and
'
'groupName', respectively.
'
'/////////////////////////////////////////////////////////////////////////////////
Public Sub Meta_CreateModel(modelName As String, _
groupName As String, _
ownerName As String, _
ErrorOK As Boolean)
Dim
Dim
Dim
Dim

item As ListItem
modelID, classID, relID As Long
model As New MetaModelInfo
keyList As New MetaInfoKeyList

Repository.BeginTransaction
model.name = modelName
model.Description = modelName & " Description"
model.ApplicationGroup = groupName
model.Owner = ownerName
model.Permission = 777
model.Create
model.Read 1
If modelName = CANNED_MODEL_NAME Then
ScriptingModelID = model.ObjectID
End If
' define ScriptingClass1 and its associated properties
Dim class As New MetaClassInfo
class.name = CANNED_CLASS_NAME1
class.Description = "Scripting Class Description"
model.AddClass class
ScriptingClass1 = class.ObjectID
Dim prop As New MetaPropertyInfo
prop.name = STRING_PROPERTY_NAME
prop.Identifier = 1
prop.Description = "Scripting Property Description"
prop.VARIANT_Type = vtString
prop.SQL_Type = sqlVarChar

Teradata Meta Data Services Programmer Guide

505

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples
prop.Length = 1024
class.AddProperty prop
Set prop = Nothing
Dim propInt As New MetaPropertyInfo
propInt.name = INTEGER_PROPERTY_NAME
propInt.Identifier = 2
propInt.Description = "Scripting Property Description"
propInt.VARIANT_Type = vtLong
propInt.SQL_Type = sqlInteger
propInt.Length = 1024
class.AddProperty propInt
Set propInt = Nothing
Dim relation As New MetaRelationshipInfo
relation.name = CANNED_CLASS1_CLASS2_RELATION
relation.Description = "Class0 contains Class1 relationship"
relation.OriginClassID = class.ObjectID
relation.DestinationClassID = Class1.ObjectID
model.AddRelationship relation
RelID_Class0Class1 = relation.ObjectID
RelGUID_Class0Class1 = relation.ObjectGUID
Repository.CommitTransaction
Exit Sub
End Sub

Writing MDS Objects


This section shows example code to write an object.
'///////////////////////////////////////////////////////////////////////////////////
'
' WriteObject creates an object
'
'///////////////////////////////////////////////////////////////////////////////////
Function WriteObject (classID As Long, _
objectName As String, _
intVal As Integer, _
longVal As Long, _
stringName As String, _
dateVal As Date, _
doubleVal As Double, _
boolVal As Boolean) As Long
Dim
Dim
Dim
Dim

value As New MetaPropertyItem


info As New MetaInfo
tempDbl As Double
tempChar As String * 1

value.name = INTEGER_PROPERTY_NAME
value.value = intVal
info.PropertyItems.Add value
value.name = LONG_PROPERTY_NAME
value.value = longVal
info.PropertyItems.Add value
value.name = STRING_PROPERTY_NAME
value.value = stringName
info.PropertyItems.Add value
value.name = DATE_PROPERTY_NAME
value.value = dateVal
info.PropertyItems.Add value
value.name = DOUBLE_PROPERTY_NAME
value.value = doubleVal
info.PropertyItems.Add value
value.name = BOOLEAN_PROPERTY_NAME
value.value = boolVal
info.PropertyItems.Add value
info.classID = classID
info.Description = objectName
info.objectName = objectName
Repository.WriteObject info

506

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples

AddOneClass1Object = info.ObjectID
Set value = Nothing
Set info = Nothing
Exit Function
End Function

Adding Many Objects to a Collection


This section shows example code of adding multiple objects to a collection.
'/////////////////////////////////////////////////////////////////////////////////
'
'
AddManyToCollection
'
'/////////////////////////////////////////////////////////////////////////////////
Sub AddManyToCollection()
Dim keyList As New MetaInfoKeyList
Dim testList As New MetaInfoKeyList
Dim key As New MetaInfoKey
Dim testKey As MetaInfoKey
DisplayHeadingLine "MetaActive::AddManyToCollection"
key.ObjectID = Class1Obj1
keyList.Add key
key.ObjectID = Class1Obj2
keyList.Add key
Repository.AddManyToCollection DESTINATION, Class0Obj1, RelGUID_Class0Class1, 0,
keyList
'add to relationship using relationshipID
keyList.Clear
Set testList = Nothing
key.ObjectID = Class1Obj3
keyList.Add key
key.ObjectID = Class1Obj4
keyList.Add key
Repository.AddManyToCollection DESTINATION, Class0Obj2, "", RelID_Class0Class1,
keyList
' add to origin relationship
keyList.Clear
Set testList = Nothing
key.ObjectID = Class0Obj3
keyList.Add key
Repository.AddManyToCollection ORIGIN, Class1Obj5, RelGUID_Class0Class1, 0,
keyList
Exit Sub
End Sub

Getting Objects in a Collection


This section shows example code of reading objects in a collection.
'/////////////////////////////////////////////////////////////////////////////////
'
'
GetCollections
'
'////////////////////////////////////////////////////////////////////////////////
Sub GetCollections()
Dim keyList As New MetaInfoKeyList
Dim key As New MetaInfoKey
Dim testList As MetaInfoList
Dim info As MetaInfo
DisplayHeadingLine "MetaActive::GetCollections"
Set key = Nothing
Set keyList = Nothing
'get destination objects using the relationshipID
Set testList = Repository.GetCollections(DESTINATION, Class0Obj1, "",
RelID_Class0Class1)
Set testList = Nothing

Teradata Meta Data Services Programmer Guide

507

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples
' get destination objects via relationship GUID
Set testList = Repository.GetCollections(DESTINATION, Class0Obj1,
RelGUID_Class0Class1, 0)
Set testList = Nothing
'get destination object(s) via name
Set testList = Repository.GetCollections(DESTINATION, Class0Obj1, "",
RelID_Class0Class1, "Entry Six")
Set testList = Nothing
Set testList = Repository.GetCollections(DESTINATION, Class0Obj2, "",
RelID_Class0Class1, "Entry%")
Exit Sub
End Sub
'///////////////////////////////////////////////////////////////////////////////
'
' GetCollectionsByProperty
'
'///////////////////////////////////////////////////////////////////////////////
Function GetCollectionsByProperty (name As String, _
value As Variant, _
ObjectID As Long, _
relID As Long, _
relGUID As String) As Boolean
Dim
Dim
Dim
Dim
Dim
Dim
Dim

keyList As New MetaInfoKeyList


key As New MetaInfoKey
testList As MetaInfoList
filterList As New MetaFilterList
sortList As New MetaInfoKeyList
filter As New MetaFilter
val As Boolean

filter.filter.name = name
filter.filter.value = value
filter.Logical = META_AND
filter.operator = EQUAL
filterList.Add filter
Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID,
relID, "", filterList, sortList)
Set filterList = Nothing
filter.operator = LESS_THAN
filterList.Add filter
Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID,
relID, "", filterList, sortList)
Set filterList = Nothing
filter.operator = GREATER_THAN_OR_EQUAL
filterList.Add filter
Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID,
relID, "", filterList, sortList)
' now do two values separated by OR
Set filterList = Nothing
Set testList = Nothing
filter.operator = LESS_THAN
filter.Logical = META_OR
filterList.Add filter
filter.operator = GREATER_THAN
filterList.Add filter
Set testList = Repository.GetCollectionsByProperty(DESTINATION, ObjectID, relGUID,
relID, "", filterList, sortList)
Exit Function
End Function

508

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples

Getting Objects of a Class


This section shows example code of reading objects of a class.
'//////////////////////////////////////////////////////////////////////////////////
'
'
GetClassObjects
'
'/////////////////////////////////////////////////////////////////////////////////
Sub GetClassObjects()
Dim testList As MetaInfoList
Dim info As MetaInfo
Dim class1info As New MetaClassInfo
Dim class2info As New MetaClassInfo
DisplayHeadingLine "MetaActive::GetClassObjects"
'get the definitions of the classes
class1info.name = CANNED_CLASS_NAME1
class1info.ObjectID = ScriptingClass1
class1info.Read
class2info.name = CANNED_CLASS_NAME2
class2info.ObjectID = ScriptingClass2
class2info.Read
'get the class objects via GUID
Set testList = Repository.GetClassObjects(class1info.ObjectGUID, 0)
Set testList = Nothing
'get class objects via classID
Set testList = Repository.GetClassObjects("", ScriptingClass1)
Set testList = Nothing
'get class objects via object name
Dim names(6) As String
Dim i As Integer
names(0) = "Entry One"
names(1) = "Entry Two"
names(2) = "Entry Three"
names(3) = "Entry Four"
names(4) = "Entry Five"
For i = 0 To 4
Set testList = Repository.GetClassObjects("", class1info.ObjectID, names(i))
Next
Set testList = Nothing
Exit Sub
End Sub
'//////////////////////////////////////////////////////////////////////////////////
'
'
GetClassObjectsByProperty
'
'//////////////////////////////////////////////////////////////////////////////////
Sub GetClassObjectsByProperty()
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

i As Integer
goodCount As Integer
lastdate As Date
info As MetaInfo
class2info As New MetaClassInfo
errorExpected As Boolean
testList As MetaInfoList
filterList As New MetaFilterList
sortList As New MetaInfoKeyList
filter As New MetaFilter
sortKey As New MetaInfoKey

DisplayHeadingLine "MetaActive::GetClassObjectsByProperty"
'get the definitions of the class
class2info.name = CANNED_CLASS_NAME1
class2info.ObjectID = ScriptingClass1
class2info.Read
' check multiple properties
' the condition used is: long >= 100 AND integer >= 100 AND date >= Jan 1, 1986
filter.filter.name = LONG_PROPERTY_NAME
filter.filter.value = 100

Teradata Meta Data Services Programmer Guide

509

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
filter.filter.name = INTEGER_PROPERTY_NAME
filterList.Add filter
filter.filter.name = DATE_PROPERTY_NAME
filter.filter.value = CDate(#1/1/1986#)
filterList.Add filter
Set testList = Repository.GetClassObjectsByProperty("", ScriptingClass1, "",
filterList, sortList)
status0 = "name pattern and property filters"
status1 = META_PASSED
filter.filter.name = LONG_PROPERTY_NAME
filter.filter.value = 100
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
Set testList = Repository.GetClassObjectsByProperty("", ScriptingClass1, "E%e%",
filterList, sortList)
' request sorted results
DisplayStatus "sorted on one property"
filterList.Clear
filter.filter.name = LONG_PROPERTY_NAME
filter.filter.value = 100
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
sortKey.name = STRING_PROPERTY_NAME
sortList.Add sortKey
Set testList = Repository.GetClassObjectsByProperty("", ScriptingClass1, "",
filterList, sortList)
' test fetching DIM objects
filterList.Clear
filter.filter.name = "SynchronizationLevel"
filter.filter.value = 1
filter.operator = GREATER_THAN_OR_EQUAL
filter.Logical = META_AND
filterList.Add filter
sortList.Clear
status1 = META_PASSED
Set testList = Repository.GetClassObjectsByProperty("", TableClassID, "",
filterList, sortList)
Exit Sub
End Sub

510

Teradata Meta Data Services Programmer Guide

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples

Replacing/Removing Objects from a Collection


This section shows example code of replacing and removing objects from a collection.
'//////////////////////////////////////////////////////////////////////////////////
'
'
TestReplaceCollection
'
'//////////////////////////////////////////////////////////////////////////////////
Sub TestReplaceCollection()
Dim errorExpected As Boolean
Dim keyList As New MetaInfoKeyList
Dim testList As MetaInfoKeyList
Dim key As New MetaInfoKey
Dim info As MetaInfoKey
DisplayHeadingLine "MetaActive::ReplaceCollection"
key.ObjectID = Class1Obj1
keyList.Add key
key.ObjectID = Class1Obj2
keyList.Add key
key.ObjectID = Class1Obj3
keyList.Add key
key.ObjectID = Class1Obj4
keyList.Add key
Repository.ReplaceCollection DESTINATION, Class0Obj5, "", RelID_Class0Class1, _
keyList
Exit Sub
End Sub
'/////////////////////////////////////////////////////////////////////////////////
'
'
RemoveManyFromCollection
'
'/////////////////////////////////////////////////////////////////////////////////
Sub RemoveManyFromCollection()
Dim keyList As New MetaInfoKeyList
Dim testList As New MetaInfoKeyList
Dim info As MetaInfoKey
Dim key As New MetaInfoKey
key.ObjectID = Class2Obj7
keyList.Add key
key.ObjectID = Class2Obj8
keyList.Add key
Repository.RemoveManyFromCollection DESTINATION, Class1Obj5, "",
RelID_Class1Class2, _
keyList, 0
Exit Sub
End Sub

Reading an Object
This section shows example code of reading an object.
'////////////////////////////////////////////////////////////////////////
'
' ReadObject
'
'////////////////////////////////////////////////////////////////////////
Public Sub ReadObject (ObjectID As Long, valueString As String)
Dim info As New MetaInfo
info.ObjectID = ObjectID
Repository.ReadObject info
Exit Sub
End Sub

Teradata Meta Data Services Programmer Guide

511

Chapter 17: Steps for Using the MDS APIs and Example Code
Visual Basic Examples

512

Teradata Meta Data Services Programmer Guide

Glossary

A
application information metamodel (AIM) A metamodel that describes how a set of meta
data is stored in the MDS repository.
application programming interface (API) A set of routines used by an application program
to direct the performance of procedures by the computers operating system.
attribute A field represented by a column within an object (entity). An object may be a
table, view or report.
abstract class An abstract class is a class that can not have object instances. An abstract class
can have properties and can be the source or destination class in relationships. Abstract classes
are created to enable subclasses of the class to inherit the properties and relationships of the
abstract class.

B
business definition A definition that uses business terminology to describe a data object.
business rules

The logic applied to calculate or otherwise derive a value.

C
class In object-oriented terminology, a class defines a type of object. The definition
encapsulates both the data and the associated behaviors (executable code) that objects of the
class can perform.
client load metamodel (CLM). An MDS-defined metamodel for the Teradata client load
utilities. The CLM stores meta data for loading data into the Teradata system through the use
of the Teradata client load utilities.
client/server A distributed technology approach where the processing is divided by
function. The server performs shared functions -- managing communications, providing
database services, etc. The client performs individual user functions -- providing customized
interfaces, performing screen to screen navigation, offering help functions, etc.
collection Relationships map or link one or more objects from one class to one or more
objects in another class. The resulting mapping or linking is called a collection.
Class objects can be added to or removed from a collection. When a new version of an object
is created, MDS automatically assigns the new version the same collection states as its previous
version. Because the new version becomes the current version of the object, changes to
collections of an object are only reflected in the new version. The previous versions'
collections are frozen to retain historical information.

Teradata Meta Data Services Programmer Guide

513

Glossary

A user must be assigned the appropriate access rights on objects to remove them from or add
them to collections. For example, to update an object, the user requires read access to the
object. To delete an object, the user requires collection privileges to remove the object from
existing collections. The types of access that can be assigned to a user or application group in a
security profile. See published state, security profile, versioning.
current In a repository with versioning on, the current version of an object is the most
recently written version as created by WriteObject, which writes new versions of objects to the
repository. See published state, inactive, dormant.

D
data Items representing facts, text, graphics, bit-mapped images, sound, analog, or digital
live-video segments. Data is the raw material of a system supplied by data producers and is
used by information consumers to create information.
database information metamodel (DIM) An application information metamodel (AIM)
that defines how a Teradata schema will be stored in the MDS repository.
database schema The logical and physical definition of a database structure.
data definition language (DDL). A language that defines all attributes and properties of a
database, especially record layouts, field definitions, key fields, file locations, and storage
strategy.
data dictionary A database about data and database structures. A catalog of all data
elements, containing their names, structures, and information about their usage. A central
location for meta data. Normally, data dictionaries are designed to store a limited set of
available meta data, concentrating on the information relating to the data elements, databases,
files and programs of implemented systems.
data element The most elementary unit of data that can be identified and described in a
dictionary or repository that cannot be subdivided.
data length The physical length of the column or field that stores the data. Example: 50
data type The physical types of data that are assigned by the database or file management
system. Examples are Integer, Decimal, Date, Character, VarChar.
data warehouse An implementation of an informational database used to store sharable
data sourced from an operational database-of-record. It is typically a subject database that
allows users to tap into a company's vast store of operational data to track and respond to
business trends and facilitate forecasting and planning efforts.
derived class A derived class is a base class and a set of derived properties. There are no
physical objects in a derived class. Derived class objects are created by joining properties in a
base class with properties in related classes. Derived class objects are read only. Derived classes
are similar to a view in an RDBMS.

514

Teradata Meta Data Services Programmer Guide

Glossary

document type definition (DTD) In XML, a DTD defines the grammar expected by the
metaxml program necessary for importing data into the MDS repository. The XML parser
ensures that an XML input document conforms to the grammar.
dormant An object is dormant if it is not currently active in the repository when data
versioning is supported by the object class. See current, inactive, published state, versioning.

E
entity

A database object such as a table or view.

extensible markup language (XML) A condensed form of SGML that lets information
developers and designers create customized tags, offering greater flexibility in organizing and
presenting information than is possible with the older HTML document coding system.

I
inactive An object is inactive or dormant if it is not currently active in the repository when
data versioning is supported by the object class. See current, dormant, published state,
versioning.
inheritance Inheritance is a feature that allows creation of a class that inherits the properties
and relationships from a previously defined class. A class that inherits from another class is
called a subclass. The class that the subclass "inherits from" is called the superclass.
interface An interface is a set of function definitions. An interface can inherit from any base
interface.
Internet information services (IIS) MDS software (MetaSurf) must be installed on the IIS
Web server if MDS users will be using their web browser to access the MDS repository.

L
label Part of versioning, labels are used to identify objects by assigning each a name,
description, creator name, object GUID, owner, security profile name, and security profile
reference. Only the name parameter is required. When unspecified, the owner defaults to the
MDS user running the script assigning the label. A default GUID is supplied by the MDS
engine. A default security profile is provided by MDSDefaultSecurityProfile.

M
metadata or meta data Meta data is information about data. Examples of meta data include
data element descriptions, data type descriptions, attribute/property descriptions, range/
domain descriptions, and process/method descriptions. Meta data includes things like the
name, length, valid values, business definitions, and description of a data element. Meta data
is stored in a repository. It insulates the data warehouse from changes in the schema of
operational systems.

Teradata Meta Data Services Programmer Guide

515

Glossary

Meta Data Services (MDS) The Teradata Meta Data Services product provides a means of
storing, administering, and navigating meta data in a Teradata data warehouse. It is the only
meta data management system optimized for and integrated with the Teradata environment.
MDS repository

A set of tables that resides in the Teradata Database Systems.

N
null A null value tells you the value for that row is either missing, unknown, not yet known
or inapplicable. Placing a zero in the row would not reflect the accurate state of the row,
because zero is a value. This way you can search for "missing" data and SQL supports the
notion of null values.

O
object A person, place, thing, or concept that has characteristics of interest to an
environment. In terms of an object-oriented system, an object is an entity that combines
descriptions of data and behavior.
object description All the properties and associations that describe a particular object.
open database connectivity (ODBC) A call-level interface that allows applications to access
data in any database for which there is an ODBC driver.

P
propagation delete

Enables delete propagation for objects in the collections of the specified

relationship description.

published state In a repository with versioning on, the published state is the state of the
most recently written version of an object. The state is created by WriteObject, which writes a
new version of an object to the repository. The new object has the same GUID as the current
version, but the LOID is different, and the version number is one greater than the current
version of the object. The write actually produces the new current or published version of the
object, replacing the previously current version, which goes into the inactive published state.
The highest numbered version of an object always has the published state of current. All other
versions are considered non-current or inactive. The state is a read-only property that cannot
be set by an application.

Q
query

A (usually) complex SELECT statement for decision support.

R
RDBMS

Relational database management system.

redundancy

516

The storage of multiple copies of identical data.

Teradata Meta Data Services Programmer Guide

Glossary

Relay Services Gateway (RSG) The RSG is a Teradata VPROC which relays messages
between Teradata and the MDS DDL Gateway.
repository A database system used to store information. In data warehousing repositories
are most commonly used to store meta data.

S
schema The logical and physical definition of data elements, physical characteristics and
inter-relationships.
security profile A named object containing the permissions for a set of groups and users
that is assigned to each object in the repository. Access to the object is based on permissions
defined in the assigned profile. The profile ID is stored in a common property of each object.
server A service that provides standard functions for clients in response to standard
messages from clients. A commonly used definition of server also refers to the physical
computer from which services are provided.
structured query language (SQL) A database sublanguage used in querying, updating, and
managing relational databases the de facto standard for database products.
subclass A subclass is a class that inherits the properties and relationships from a previously
defined class. The class that the subclass "inherits from" is called the superclass. A subclass can
inherit from up to five superclasses.
superclass tA superclass is a defined class that a subclass inherits the properties and
relationships from.

T
TCP/IP (Transmission Control Protocol/Internet Protocol) A protocol developed by the
Department of Defense for communications between computers. It is built into the Linux
system and has become the de facto standard for data transmission over networks, including
the Internet.

V
valid values A list, definition, or example of the values that can be entered in a data element
(column/field/term). Examples of allowable values are: specifying the type of data - like
amounts; listing ranges of values; domain tables/lists.
versioning When an object is initially created, it is assigned version number 1. When a class
supports data versioning, and an application calls WriteObject() for an object in the class,
MDS creates a new version of the object and assigns it a version number incremented by 1. If
versioning is not supported by a class, WriteObject overwrites the current object. The new
version retains the unique property values of the previous version, except for those specifically
set in the CMetaObject object.

Teradata Meta Data Services Programmer Guide

517

Glossary

518

Teradata Meta Data Services Programmer Guide

Index

Symbols
< Operator function
CMetaObjectKey class 238
CMetaProperty class 228
CMetaVersionedObjectKey class 242
= Operator function
CMetaProperty class 228
== Operator function
CMetaObjectKey class 238
CMetaProperty class 228
CMetaVersionedObjectKey class 241

A
abstract class 36
access permissions
objects 97
action attribute settings, XML scripting interface 432
ActivateDormantObject function 321
adding
objects to collections
example code 414
objects to collections, example code 489, 507
users or groups to security profiles, example code 424
AddManyToDestCollection function
CMetaObject class 155
AddToDestCollection function
CMetaObject class 153
AddToOrigCollection function
CMetaObject class 152
AddUsertoApplicationGroup function
CMetaApplicationGroup class 298
AIM 33
class descriptions 33
components 33
security 102
creating an, example code 505
overview 33
property descriptions 34
relationship descriptions 34
AIM classes 381
CMetaAIM class 257
CMetaClassDesc class 257
CMetaPropertyDesc class 257
CMetaRelationshipDesc class 257
COM interfaces 381
application group security 96

Teradata Meta Data Services Programmer Guide

applications
creating, to load metamodels, example code 486
authentication security 102
AutoWorldObjects.xml
XML example file 457

B
BeginTransaction function
CMetaRepository class 112
Business classes
and dormant objects 85
BusinessAttribute class
property descriptions 59
BusinessEntity class
property descriptions 59
BusinessRule class
property descriptions 60

C
C++ code examples 420, 485
initialization 421
read model classes and class properties 421
C++ project settings 105
code generation 106
include files 105
linking an MDS application 108
localization 105
ChangePassword function
CMetaUser class 302
Check class
property descriptions 52
class
getting all objects or object keys example 497
getting objects of a class, example 509
reading objects of a class, example 509
CLASS element, XML scripting interface 447
CLASSDESC element, XML scripting interface 436
classes
benefits of derived 38
Client Load Model (CLM)
class descriptions 73
class property descriptions 74
overview 72
relationship descriptions 76
closing
explicit transactions 88

519

Index

CMetaActive Class
ActivateDormantObject function
CMetaActive Class 321
DeInitialize function
CMetaActive Class 315
DeleteDormantObject function
CMetaActive Class 320
DeleteVersion function
CMetaActive Class 321
DeleteVersionRange function
CMetaActive Class 322
GetObjectIDfunction
CMetaActive Class 322
Initialize function
CMetaActive Class 315
ReadDormantObject function
CMetaActive Class 318
ReadObject function
CMetaActive Class 316
ReadObjectVersion function
CMetaActive Class 317
SignOfffunction
CMetaActive Class 316
SignOn function
CMetaActive Class 315
WriteObject function
CMetaActive Class 319
WriteObjectVersion function
CMetaActive Class 319
CMetaAIM class 258
constructors 259
CreateMDSClassDesc function 259
CreateMDSDerivedClass function 261
CreateMDSModel function 259
CreateMDSRelationshipDesc function 263
function list 258
GetClassDesc function 264
GetRelationshipDesc function 265
CMetaApplicationGroup class 297
AddUserToApplicationGroup function 298
constructors 298
CreateApplicationGroup function 298
function list 297
GetUserCollection function 299
Initialize function 299
ReadObject function 299
ReadVersion function 299, 303
RemoveUserFromApplicationGroup function 299
WriteObject function 300, 303
WriteVersion function 300, 303
CMetaClassDesc class 268
constructors 269
CreateMDSDerivedProperty function 274
CreatePropertyDesc function 270

520

function list 268


GetPropertyDesc function 278
GetPropertyDescColl function 279
GetRelationshipDescColl function 279
GetUniqueNamesFlag function 278
Initialize function 270
CMetaFilterInfo class
constructor 221
example code 225
Filter object 222
function list 221
GetComparisonOperator function 223
GetLogicalOperator function 222
GetParenthesesCount function 223
Initialize function 222
SetComparisonOperator function 222
SetLogicalOperator function 223
SetParenthesesCount function 223
CMetaHelper class
COM interfaces 374
CMetAIM class
Initialize function 259
CMetaLabel class
constructors 251
function list 251
GetCreatorNamefunction 255
Initialize function 252
SetAIMLabel function 252
SetCreatorName function 255
CMetaLabeledObjectKey class 247
GetObjectName function 248
Initialize function 248
CMetaObject class
AddManyToDestCollection function 155
AddToDestCollection function 153
AddToOrigCollection function 152
constructors 136
function list 131
GetClassObjects function 142
GetClassObjectsByProperty function 171
GetClassObjectVersions function 143
GetClassObjectVersionsByProperty function 172
GetDestCollection function 145
GetDestCollectionByProperty function 181
GetOrigCollection function 144
GetOrigCollectionByProperty function 179
GetOrigCollectionKeys function 200
GetPropertyValue function 167
Initialize function 136
Operator < function 138
Operator = function 137
Operator == function 137
RemoveFromDestCollection function 157
RemoveManyFromOrigCollection function 158

Teradata Meta Data Services Programmer Guide

Index

ReplaceDestCollection function 164


ReplaceOrigCollection function 162
CMetaObjectClassKey class 240
function list 239
GetClassID function 240
Initialize function 239
SetClassID function 240
SetClassName function 240
CMetaObjectKey class 237, 239
GetObjectID function 238
GetObjectName function 238
Initialize function 237
Operator < function 238
Operator == function 238
SetObjectID function 238
SetObjectName function 239
CMetaPersist
GetPublishState function 128
CMetaPersist Class
GetCallerName function 127
GetClassGUID function 124
GetClassID function 125
GetCreateTimestamp function 126
GetObjectGUID function 123
GetObjectID function 124
GetObjectName function 122
GetOwnerID function 125
GetPublishState function 128
GetSecurityProfileID function 127
GetUpdateTimestamp function 126
GetVersionNumber function 128
Initialize function 122
IsDormant function 129
IsFrozen function 128
IsPublished function 128
SetCallerName function 127
SetClassGUID function 125
SetClassID function 125
SetDescription function 123
SetObjectGUID function 123
SetObjectID function 124
SetObjectName function 122
SetOwnerID function 126
SetSecurityProfileID function 128
CMetaPersist class
function list 121
GetAccessPermissions function 122
GetApplicationGrp function 127
GetClassGUID function 127
GetClassID function 125
GetCreateTimestamp function 127
GetDescription function 123
GetObjectGUID function 128
GetObjectID function 128

Teradata Meta Data Services Programmer Guide

GetObjectName function 122


GetOwnerID function 128
GetSecurityProfileID function 127, 128
GetUpdateTimestamp function 126
Initialize function 122
SetAccessPermissions function 127
SetCallerName function 127
SetClassGUID function 128
SetClassID function 125
SetDescription function 123
SetObjectGUID function 128
SetObjectID function 128
SetObjectName function 122
SetOwnerID function 128
SetSecurityProfileID function 128
CMetaProperty class
constructors 227
Copy function 228
function list 227
GetName function 229
GetPropertyID function 230
GetVarType function 232
Initialize function 230
Operator < function 228
Operator = function 228
Operator == function 228
PrintProperty function 228
PrintValue function 231
PrintValueType function 231
SetName function 229
SetPropertyID function 230
CMetaPropertyDesc class 285
constructors 285
function list 285
GetPropLength function 286
GetPropType function 287
GetRelPropID function 287
GetTotalDigits function 288
GetVarType function 289
Initialize function 286
SetPropType function 287
SetRelPropID function 288
SetTotalDigits function 288
SetVarType function 289
CMetaRelationshipDesc class 292
constructors 292
function list 292
GetDestClassID function 294
GetOriginClassID function 294
GetPropagateDeleteFlag function 294
GetUniqueNamesFlag function 295
Initialize function 293
CMetaRelationshipKey class
GetExplanation function 247

521

Index

SetExplanation function 247


CMetaRelationshipKeyclass 247
CMetaRepository
SetRetainBusinessObjects 85
CMetaRepository class
BeginTransaction function 112
Commit function 113
Deinitialize function 116
function list 111
GetObjectID function 115
GetOdbcHenv function 116
GetRepository Root function 114
GetSystemName function 118
Initialize function 114
IsVersioningEnabled function 117
RetainBusinessObjectsSupported function 118
RetryDDL function 114
Rollback function 114
SetRetainBusinessObjects function 118
SignOff function 117
SignOn function 116
CMetaUser class 300
ChangePassword function 302
constructor 300
CreateSuperuser function 301
CreateUser function 301
function list 300
Initialize function 300
IsSuperUser function 302
SetPassword function 302
CMetaUserGroup class
ReadObject function 303
ReadVersion function 303
CMetaVersionedObjectClassKey class 243, 244, 246
GetClassID function 244
GetLabelName function 249
GetPublishState function 245, 249
GetVersionNumber function 245
Initialize function 244, 247
IsDormant function 246
IsFrozen function 246
IsPublished function 246, 249
SetClassID function 245
SetClassName function 244
SetPublishState function 245
SetVersionNumber function 245
CMetaVersionedObjectKey class 241
GetPublishState function 242
GetVersionNumber function 242
Initialize function 241
IsDormant function 243
IsFrozen function 243
IsPublished function 243
Operator < function 242

522

Operator == function 241


SetPublishState function 243
SetVersionNumber function 242
code examples
add users or groups to security profiles 424
adding objects to collections 414
code generation 106
collections 507
adding objects, example code 489, 507
creating, example code 487
modifying, example code 487
of object keys, getting, example code 496
of objects, getting, example code 493
reading, example code 487
removing objects, example code 500, 511
replacing objects, example code 502, 511
Column class
property descriptions 46
COM AIM classes
common properties 357
COM interfaces
AIM classes 381
CMetaHelper class 374
COM collection classes 409
example code 412, 420
MetaActive class 314
MetaClassInfo class 388
MetaDIMInfo class 369
MetaFilter class 371
MetaGroupInfo class 402
MetaInfo class 361
MetaInfoKey class 364
MetaModelInfo class 397
MetaPropertyInfo class 381
MetaPropertyItem class 366
MetaRelationshipInfo class 394
MetaSecProfEntry class 407
MetaSecProfInfo class 404
MetaUserInfo class 400
MetaVersionedInfoKey class 365
objects and collections classes 314
user, group, and security profile classes 400
Commit function
CMetaRepository class 113
committing
explicit transactions 89
common properties, see properties 81
Constant class
property descriptions 62
Copy function
CMetaProperty class 228
CreateApplicationGroup function
CMetaApplicationGroup class 298
CreateDate/Time

Teradata Meta Data Services Programmer Guide

Index

properties 81
CreateMDSClassDesc function
CMetaAIM class 259
CreateMDSDerivedClass function
CMetaAIM class 261
CreateMDSDerivedProperty function
CMetaClassDesc class 274
CreateMDSModel function
CMetaAIM class 259
CreateMDSRelationshipDesc function
CMetaAIM class 263
CreatePropertyDesc function
CMetaClassDesc class 270
CreateSuperuser function
CMetaUser class 301
CreateUser function
CMetaUser class 301
CSecurityProfile class 305
function list 305
GetObjectsUsingSecurityProfile function 305
GetPermissionList 306
PrintCMetaSecurityProfile function 306
RemoveManyPermissions function 306
RemovePermissions function 306
ReplacePermissions function 307
SetAIMSecurityProfile function 307
SetClassSecurityProfile function 308
SetObjectSecurityProfile function 308
SetSecurityProfile function 309
UpdateManyPermissions function 310
UpdatePermissions function 310
CSecurityProfileEntry class 303

D
data types
properties 102
Database class
property descriptions 45
Database Information Model (DIM) 39
DatabaseSystem class
property descriptions 43
DDL statements within transactions 91
DEBUG Mode Libraries 108
DeInitialize function 315
Deinitialize function
CMetaRepository class 116
delete propagation 93
DeleteDormantObject function 320
DeleteVersion function 321
DeleteVersionRange function 322
deleting objects, example code 504
derived classes
benefits 38

Teradata Meta Data Services Programmer Guide

limitations 39
metamodel 37
overview 37, 38
properties 38
derived properties
overview 38
DERIVEDCLASSDESC element, XML scripting interface 441
DERIVEDPROPERTYDESC element, XML scripting
interface 442
description properties 80
DIM
class descriptions 41
classes 41
extending 69
property descriptions 43
relationship descriptions 65
DIMSecurityProfile 101
dormant objects 85, 132
and Business classes 85
and PublishState 86
and Retain Associated Business Information feature 132
enabling 85
generating 85
reactivating 86
DTD elements 431
DTD schema elements 431

E
error messages 459
Gateway communications error codes 483
Gateway socket error codes 480
transactions 480
XML scripting error codes 483
examples
C++ 485
code
CMetaFilterInfo class 225
COM interfaces 412
Visual Basic 504
explicit transactions 86, 87
closing 88
comitting 89
rollback 89, 91

F
Filter object
CMetaFilterInfo class 222
FindAllLabels function 166
FindAllOccurrences function 166
FindLabel function 165
Function class
property descriptions 60
functions

523

Index

ActivateDormantObject 321
CMetaAIM class 258
CMetaApplicationGroup class 297
CMetaClassDesc class 268
CMetaFilterInfo class 221
CMetaLabel class 251
CMetaObject class 131
CMetaObjectClassKey class 239
CMetaPersist class 121
CMetaProperty 227
CMetaProperty class 227
CMetaPropertyDesc class 285
CMetaRelationshipDesc class 292
CMetaRepository class 111
CMetaUser class 300
CSecurityProfile class 305
DeInitialize 315
DeleteDormantObject 320
DeleteVersion 321
DeleteVersionRange 322
FindAllLabels 166
FindAllOccurrences 166
FindLabel 165
GetCallerName 127
GetClassGUID 124
GetClassID 125
GetCreateTimestamp 126
GetDormantDIMClassObjectKeys 148
GetDormantDIMClassObjects 147
GetDormantDIMDestCollection 212
GetDormantDIMDestCollectionKeys 216
GetDormantDIMDestObject 149
GetDormantDIMOrigCollection 210
GetDormantDIMOrigCollectionKeys 214
GetLabelName 249
GetObjectGUID 123
GetObjectID 124, 322
GetObjectName 122
GetOwnerID 125
GetPublishState 128, 242, 249
GetSecurityProfileID 127
GetUpdateTimestamp 126
GetVersionNumber 128
Initialize 122, 315
IsDormant 129
IsFrozen 128
IsPublished 128, 249
ReactivateDIMObject 152
ReadDormantDIMObject 140
ReadDormantDIMObjectWithLock 140
ReadDormantObject 318
ReadObject 316
ReadObjectVersion 317
RetainBusinessObjectsSupported 118

524

SetCallerName 127
SetClassGUID 125
SetClassID 125
SetDescription 123
SetObjectGUID 123
SetObjectID 124
SetObjectName 122
SetOwnerID 126
SetPublishState 243
SetSecurityProfileID 128
SignOff 316
SignOn 315
Teradata 103
WriteObject 319
WriteObjectVersion 319

G
Gateway communications error codes 483
Gateway socket error codes 480
GetAccessPermissions function
CMetaPersist class 122
GetApplicationGrp function
CMetaPersist class 127
GetCallerName function 127
GetCharacterSetName function
CMetaPropertyDesc class 286
GetClassDesc function
CMetaAIM class 264
GetClassGUID function 124
CMetaPersist class 127
GetClassID function 125
CMetaObjectClassKey class 240
CMetaPersist class 125
CMetaVersionedObjectClassKey class 244
GetClassName function 240, 244
CMetaObjectClassKey class 240
CMetaVersionedObjectClassKey class 244
GetClassObjects function
CMetaObject class 142
GetClassObjectsByProperty function
CMetaObject class 171
GetClassObjectVersions function
CMetaObject class 143
GetClassObjectversionsByProperty function
CMetaObject class 172
GetCollection 85
GetComparisonOperator function
CMetaFilterInfo class 223
GetCreateTimestamp function 126
CMetaPersist class 126, 127
GetCreatorName function
CMetaLabel class 255
GetDescription function

Teradata Meta Data Services Programmer Guide

Index

CMetaPersist class 123


GetDestClassID function
CMetaRelationshipDesc class 294
GetDestCollection function
CMetaObject class 145
GetDestCollectionByProperty function
CMetaObject class 181
GetDormantClassObjectKeys 325
GetDormantDIMClassObjectKeys function 148
GetDormantDIMClassObjects function 147
GetDormantDIMDestCollection function 212
GetDormantDIMDestCollectionKeys function 216
GetDormantDIMDestObject function 149
GetDormantDIMOrigCollection function 210
GetDormantDIMOrigCollectionKeys function 214
GetExplanation function
CMetaRelationshipKey class 247
GetLabelName function
CMetaVersionedObjectClassKey class 249
GetLogicalOperator function
CMetaFilterInfo class 222
GetName function
CMetaProperty class 229
GetObjectGUID function 123
CMetaPersist class 128
GetObjectID function 124, 322
CMetaObjectKey class 238
CMetaPersist class 128
CMetaRepository class 115
GetObjectName function 122
CMetaLabeledObjectKey class 248
CMetaObjectKey class 238
CMetaPersist class 122
GetObjectsUsingSecurityProfile function
CSecurityProfile class 305
GetOdbcHenv function
CMetaRepository class 116
GetOrigClassID function
CMetaRelationshipDesc class 294
GetOrigCollection function
CMetaObject class 144
GetOrigCollectionByProperty function
CMetaObject class 179
GetOrigCollectionKeys function
CMetaObject class 200
GetOwnerID function 125
CMetaPersist class 128
GetParenthesesCount function
CMetaFilterInfo class 223
GetPermissionList function
CSecurityProfile class 306
GetPropagateDeleteFlag function
CMetaRelationshipDesc class 294
GetPropertyDesc function

Teradata Meta Data Services Programmer Guide

CMetaClassDesc class 278


GetPropertyDescColl function
CMetaClassDesc class 279
GetPropertyID function
CMetaProperty class 230
GetPropertyValue function
CMetaObject class 167
GetPublishState function 128
CMetaVersionedObjectClassKey class 245, 249
CMetaVersionedObjectKey class 242
GetRelationshipDesc function
CMetaAIM class 265
GetRelationshipDescColl function
CMetaClassDesc class 279
GetRelPropID function
CMetaPropertyDesc class 287
GetRepositoryRoot function
CMetaRepository class 114
GetSecurityProfileID function 127
CMetaPersist class 127, 128
GetSystemName function
CMetaRepository class 118
getting
objects in a collection, example 415, 507
objects of a class, example 417, 509
objects or object keys of a class 497
objects, example 507
GetTotalDigits function
CMetaPropertyDesc class 288
GetUniqueNamesFlag function
CMetaClassDesc class 278
CMetaRelationshipDesc class 295
GetUpdateTimestamp function 126
CMetaPersist class 126
GetVarType 232
GetVarType function
CMetaProperty class 232
CMetaPropertyDesc class 289
GetVersionNumber function 128
CMetaVersionedObjectClassKey class 245
CMetaVersionedObjectKey class 242

I
implicit transactions 86, 87
include files 105
Index class
property descriptions 51
IndexColumn class
property descriptions 52
inheritance 35, 135
initialization
C++ code example 421
of repository

525

Index

example 505
VB code example 413
Initialize function 122, 315
CMetaAIM class 259
CMetaApplicationGroup class 299
CMetaClassDesc class 270
CMetaFilterInfo class 222
CMetaLabel class 252
CMetaLabeledObjectKey class 248
CMetaObject class 136
CMetaObjectClassKey class 239
CMetaObjectKey class 237
CMetaPersist class 122
CMetaProperty class 230
CMetaRelationshipDesc class 293
CMetaRepository class 114
CMetaUser class 300
CMetaVersionedObjectClassKey class 244, 247
CMetaVersionedObjectKey class 241
internationalization
of MDS 105
IsDormant function 129
CMetaVersionedObjectClassKey class 246
CMetaVersionedObjectKey class 243
IsFrozen 81
IsFrozen function 128
CMetaVersionedObjectClassKey class 246
CMetaVersionedObjectKey class 243
IsPublished function 128
CMetaVersionedObjectClassKey class 246, 249
CMetaVersionedObjectKey class 243
IsSuperUser function
CMetaUser class 302
IsVersioningEnabled function
CMetaRepository class 117

L
labels 446, 455
linking an MDS application 108
locale settings 105
localization 105
locking protocol 93
for transaction management 93
log file
error messages 459

M
Macro class
property descriptions 56
MacroParameter class
property descriptions 57
MDS API, using 485
MDS DTD elements 431

526

MDS log
error messages 459
MDS scripting interface 427
MDSDefaultSecurityProfile 101
MDSMetaModelSecurityProfile 101
Meta Data Coalition 427
MetaActive class
COM interfaces 314
MetaClassInfo class
COM interfaces 388
MetaDIMInfo class
COM interfaces 369
MetaFilter class
COM interfaces 371
METAGROUP element, XML scripting interface 453
MetaGroupInfo class
COM interfaces 402
MetaIModelInfo class
COM interfaces 397
MetaInfo class
COM interfaces 361
common properties 357
MetaInfoKey class
COM interfaces 364
METALABEL element, XML scripting interface 455
MetaLabelInfo Class 377
MetaLabelInfoKey Class 380
MetaLoadType class
property descriptions 60
metamodels
creating applications to load, example code 486
MetaPropertyInfo class
COM interfaces 381
MetaPropertyItem class
COM interfaces 366
MetaRelationshipInfo class
COM interfaces 394
MetaSecProfEntry class
COM interfaces 407
MetaSecProfInfo class
COM interfaces 404
METAUSER element, XML scripting interface 452
MetaUserInfo class
COM interfaces 400
MetaVersionedInfoClassKey Class 377
MetaVersionedInfoKey class
COM interfaces 365
METAXML element
XML scripting interface 431
MODEL element, XML scripting interface 446
MODELDESC element, XML scripting interface 434
multithreaded applications 104

Teradata Meta Data Services Programmer Guide

Index

N
Node class
property descriptions 53
NULL values 221

O
OBJECT element, XML scripting interface 448
object identifiers
XML scripting interface 431
ObjectKey Classes 237
objects
access permissions 97
adding to collections, example code 489, 507
and collections classes, COM interfaces 314
creating in a class 102
creating, example code 487, 506
delete propagation 93
deleting, example code 504
displaying, example code 491
getting collections, example code 493
getting in a collection, example 507
getting objects of a class, example 509
getting properties of, example 492
GUID
properties 80
ID
properties 80
keys
example of getting 497
keys, getting collections of, example code 496
modifying, example code 487
names
properties 79
of a class
examples 497
owner 96
reading objects of a class, example 509
reading, example code 487, 491, 511
removing from collections, example code 500, 511
replacing in collections, example code 502
repository root 103
security 96
updating, example 499
writing, example code 506
Operator < function 138
CMetaObject class 138
CMetaObjectKey class 238
CMetaProperty class 228
CMetaVersionedObjectKey class 242
Operator = function 247
CMetaObject class 137
CMetaProperty class 228
CMetaRelationshipKey class 247

Teradata Meta Data Services Programmer Guide

Operator == function 137


CMetaObject class 137
CMetaObjectKey class 238
CMetaProperty class 228
CMetaVersionedObjectKey class 241
owner ID, properties 80

P
permissions
access to objects 97
PREFERENCES element
XML scripting interface 432
PrintCMetaSecurityProfile function
CSecurityProfile class 306
PrintProperty function
CMetaProperty class 228
PrintValue function
CMetaProperty class 231
PrintValueType function
CMetaProperty class 231
product version numbers 4
product-related information 6
profile
security 99
project settings
C++ project settings 106
properties
constants 81
CreateDate/Time 81
data types 102
description 80
object GUID 80
object ID 80
object names 79
of objects, getting, example 492
owner ID 80
security profile ID 81
types 221
UpdateDate/Time 81
PROPERTY element, XML scripting interface 450
PROPERTYDESC element, XML scripting interface 439
publications related to this release 6
PublishState 81
and ReactivateDIMObject 86
domant objects 86

R
ReactivateDIMObject function 152
read model classes and class properties
C++ code example 421
ReadDormantDIMObject function 140
ReadDormantDIMObjectWithLock function 140
ReadDormantObject function 318

527

Index

reading
collections, example code 487
objects of a class, example 509
objects, example code 420, 487, 491, 511
ReadObject function 316
ReadObject()
and dormant objects 85
ReadObjectVersion function 317
Reference class
property descriptions 52
ReferenceColumn class
property descriptions 53
RELATIONSHIP element, XML scripting interface 451
RELATIONSHIPDESC element, XML scripting interface 444
RELEASE Mode Libraries 109
RemoveFromDestCollection function
CMetaObject class 157
RemoveManyFromOrigCollection function
CMetaObject class 158
RemoveManyPermissions function
CSecurityProfile class 306
RemovePermissions function
CSecurityProfile class 306
RemoveUserFromApplicationGroup function
CMetaApplicationGroup class 299
removing
objects from collections, example code 419, 500, 511
ReplaceDestCollection function
CMetaObject class 164
ReplaceOrigCollection function
CMetaObject class 162
ReplacePermissions function
CSecurityProfile class 307
replacing objects in collections, example code 419, 502, 511
repository
initialization, example 505
root object 103
Retain Associated Business Information feature 132
dormant objects 85
RetainBusinessObjectsSupported function
CMetaRepository class 118
RetryDDL function
CMetaRepository class 114
rollback
explicit transactions 89, 91
Rollback function
CMetaRepository class 114

S
Script class
property descriptions 74
scripting interface 427
steps for using 429

528

security
AIM components 102
application group 96
authentication 102
creating an object in a class 102
default profiles 100
DIMSecurityProfile 101
MDSDefaultSecurityProfile 101
MDSMetaModelSecurityProfile 101
object owner 96
objects 96
profile ID
properties 81
profiles 99, 100
default 100
super-user access 99
security classes 297
CMetaApplication Group class 297
CMetaUser class 300
CSecurityProfile class 305
CSecurityProfileEntry class 303
SECURITYPROFILE element, XML scripting interface 454
SetAccessPermissions function
CMetaPersist class 127
SetAIMLabel function
CMetaLabelclass 252
SetAIMSecurityProfile function
CSecurityProfile class 307
SetCallerName function 127
CMetaPersist class 127
SetCharacterSetName function
CMetaPropertyDesc class 286
SetClassGUID function 125
CMetaPersist class 128
SetClassID function 125
CMetaObjectClassKey class 240
CMetaPersist class 125
CMetaVersionedObjectClassKey class 245
SetClassName function
CMetaObjectClassKey class 240
CMetaVersionedObjectClassKey class 244
SetClassSecurityProfile function
CSecurityProfile class 308
SetComparisonOperator function
CMetaFilterInfo class 222
SetCreatorName function
CMetaLabel class 255
SetDescription function 123
CMetaPersist class 123
SetExplanation function
CMetaRelationshipKey class 247
SetLogicalOperator function
CMetaFilterInfo class 223
SetName function

Teradata Meta Data Services Programmer Guide

Index

CMetaProperty class 229


SetObjectGUID function 123
CMetaPersist class 128
SetObjectID function 124
CMetaObjectKey class 238
CMetaPersist class 128
SetObjectName function 122
CMetaObject class 239
CMetaPersist class 122
SetObjectSecurityProfile function
CSecurityProfile class 308
SetOwnerID function 126
CMetaPersist class 128
SetParenthesesCount function
CMetaFilterInfo class 223
SetPassword function
CMetaUser class 302
SetPropertyID function
CMetaProperty class 230
SetPropertyLength function
CMetaPropertyDesc class 287
SetPropType function
CMetaPropertyDesc class 287
SetPublishState function
CMetaVersionedObjectClassKey class 245
CMetaVersionedObjectKey class 243
SetRetainBusinessObjects function
CMetaRepository class 118
SetSecurityProfile function
CSecurityProfile class 309
SetSecurityProfileID function 128
CMetaPersist class 128
SetTotalDigits function
CMetaPropertyDesc class 288
SetVarType function
CMetaPropertyDesc class 289
SetVersionNumber function
CMetaVersionedObjectClassKey class 245
CMetaVersionedObjectKey class 242
SignOff function 316
CMetaRepository class 117
SignOn function 315
CMetaRepository class 116
software releases
supported 4
Source class
property descriptions 75
SourceField class
property descriptions 75
SPParameter class
property descriptions 55
StoredProcedure class
property descriptions 53
structure of XML files 430

Teradata Meta Data Services Programmer Guide

subclass 35
SubjectArea class
property descriptions 59
substring search 219
suggested project settings 106
superclass 35
super-user access
security 99

T
Table class
property descriptions 45
Target class
property descriptions 75
Teradata
functions 103
transactions
error messages 480
explicit 86, 87
closing 88
committing 89
rollback 89, 91
implicit 86, 87
locking protocol 93
with DDL statements 91
XML scripting interface 456
Trigger class
property descriptions 55

U
UNICODE DEBUG Mode Libraries 109
UNICODE RELEASE Mode Libraries 109
UpdateDate/Time
properties 81
UpdateManyPermissions function
CSecurityProfile class 310
UpdatePermissions function
CSecurityProfile class 310
updating
existing objects, example 499
user, group, and security profile classes
COM interfaces 400

V
ValidValues class
property descriptions 60, 63, 64
VB code examples 412
getting objects in a collection 415
getting objects of a class 417
initialization 413
reading an object 420
removing objects from collections 419

529

Index

replacing objects in collections 419


writing objects 413
version numbers 4, 80
versioning 82, 446, 447, 455
disabling 84
enabling 84
versions
collections and 84
creating new 83
deleting 83
deleting objects and 83
reading 83
View class
property discriptions 50
ViewColumn class
property descriptions 50
Visual Basic examples 504

RELATIONSHIP element 451


RELATIONSHIPDESC element 444
SECURITYPROFILE element 454
steps for using 429
structure of XML files 430
transactions 456
versioning 433, 436

W
World Wide Web Consortium (W3C) 427
WriteObject function 319
WriteObjectVersion function 319
writing objects
example code 506
VB code example 413

X
XML
example files
AutoWorldObjects.xml 457
XML scripting interface
action attribute settings 432
CLASS element 447
CLASSDESC element 436
DERIVEDCLASSDESC element 441
DERIVEDPROPERTYDESC element 442
error codes 483
example files 457
file structure 430
MDS DTD elements 431
MDS DTD schema elements 431
METAGROUP element 453
METALABEL element 455
METAUSER element 452
MODEL element 446
MODELDESC element 434
multiple superusers 427
OBJECT element 448
object identifiers 431
overview of XML 427
PREFERENCES element 432
PROPERTY element 450
PROPERTYDESC element 439

530

Teradata Meta Data Services Programmer Guide

You might also like