CreateMDSPropertyDesc - Teradata Meta Data Services

Teradata Meta Data Services Programmer Guide

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

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

    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.

     

    Parameters Specified on Create Property

    Teradata Database column type created for property

    PropType

    PropSize

    TotalDigits

     

    SQL_CHAR

    >= 1

     

    CHAR[(size)]

    SQL_VARCHAR

    >= 1

     

    VARCHAR(size)

    SQL_DATE

     

     

    DATE

    SQL_BINARY

    >= 1

     

    BYTE[(size)]

    SQL_VARBINARY

    >= 1

     

    VARBYTE(size)

    SQL_SMALLINT

     

     

    SMALLINT

    SQL_INTEGER

     

     

    INTEGER

    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

     

    VariantType

    Compatible PropType

    CMetaProperty
    Get/Set Functions

    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()

    VT_UI1

    SQL_BINARY (size=1)

    GetUChar ()
    SetUChar ()

    VT_ARRAY | VT_UI1

    SQL_BINARY
    SQL_VARBINARY

    GetBinaryAsString()
    GetBinary()
    SetBinary()