The ITTypeInfo class

Base class: ITObject

Contains information about the type of a value object as it exists in the database. ITTypeInfo identifies the types in the database that correspond to the C++ types that represent the values in the application. The ITTypeInfo class is also used to retrieve type information for values in a result set, and is essential for implementing user-defined value objects.

The ITTypeInfo class can be used to obtain a type name (unless the type is transient) and indicates whether the value is simple, row, or collection. A transient data type is a type that only lasts for the duration of an SQL statement. For example, in the following query:
create table foo (a int, b int, c int);
select * from (select a, b from foo);

The subquery (select a, b from foo) is a transient type that is a set of type row with two columns, a and b. This type is not persistent because it is devised by HCL Informix® to return the results of the SQL statement.

Simple types (types that are not row or collection) have a Size method, which returns the size of the type, and a Variable method, which indicates whether the instances of the type can be of variable size.

A row type might be transient. Row types have an array of ITTypeInfo references and strings that contain column type information and names. To obtain information from the columns in a row type, use the ColumnId(...) and ColumnType(...) methods.

Collection types expose the collection and the data type from which it is constructed. Collection types might have an upper limit on the number of elements. Collection types support the Size, Source, and Quality methods.

This class provides the following methods.
Method Description
ITTypeInfo(const ITConnection &conn, const ITString &type_name, long size, long precision, long scale, long qualifier, ITBool byvalue, const MI_TYPEID *ptypeid = 0) Constructs an ITTypeInfo object for an opaque data type.
ITTypeInfo(const ITConnection &conn, const ITString &type_name, const ITString &quality, const ITTypeInfo &memberType, const MI_TYPEID *ptypeid = 0) Constructs an ITTypeInfo object for a collection data type.
ITTypeInfo(const ITConnection &conn, const ITString &type_name, const ITTypeInfo &source, const MI_TYPEID *ptypeid = 0) Constructs an ITTypeInfo object for a distinct data type.
ITTypeInfo(const ITConnection &conn, const ITString &type_name, long ncols, ITTypeInfo **colps, const ITString *colnames, const MI_TYPEID *ptypeid = 0) Constructs an ITTypeInfo object for a row data type.
ITTypeInfo(const ITConnection &conn, const ITString &type_name, const ITTypeInfo &consType, const ITTypeInfo &memberType, const MI_TYPEID *ptypeid = 0) Constructs an ITTypeInfo object for a constructed data type.
ITTypeInfo(ITConnection &, const ITString &, long precision = -1, long scale = -1, long qualifier = -1) Constructs an ITTypeInfo object with type information directly from the server. Other constructors get their type information about the client side without directly accessing the server.
ITTypeInfo *ConstructorType() const Returns a pointer to an ITTypeInfo object that contains type information for the constructor object.
ITTypeInfo *MemberType() const Returns a pointer to an ITTypeInfo object that contains type information for the member object of a collection or constructed type.
const ITString &Name() const Returns the name of the database type.
ITBool IsSimple() const Returns TRUE if this type is not a row type or a collection type.
ITBool IsRow() const Returns TRUE if this type is a row type.
ITBool ByValue() const Returns TRUE if the database type is passed by value, FALSE if it is passed by reference.
ITBool IsCollection() const Returns TRUE if this type is a collection type.
ITBool IsConstructed() const Returns TRUE if this type is a constructed type.
ITBool CompatibleType(const ITTypeInfo &) const Returns TRUE if the argument is ITTypeInfo for the same type, a distinct type, a row type with the same column types, or a collection type with the same constructor and member type.
long Precision() const Returns the precision (the number of significant digits) of a database type, if applicable.
long Qualifier() const Returns the qualifier of the datetime or interval data type.
ITBool SameType(const ITTypeInfo &) const Returns TRUE if the specified object is the same type as this object.
long Scale() const Returns the scale of a database type, if applicable.
long Size() const Returns -1 if this is a variable-size type, or the size if the type is of fixed size.
long Bound() const If the type is a variable-size type with a specified limit, this method returns the limit. For constructed types, the limit specifies the maximum number of items. Returns -1 if no bound is in effect.
long Parameter() const Returns the parameter of the type. For SQL numeric-derived types, returns the precision. For other numeric-derived types, returns the scale. For varchar-derived types, returns the maximum size.
ITBool Variable() const Returns TRUE if the size is variable, or FALSE if the size is fixed.
ITBool IsDistinct() const Returns TRUE if the type is distinct.
long ColumnCount() const Returns the number of columns in this row type.
const ITString &ColumnName(long) const Returns the name of the specified column.
long ColumnId(const ITString &) const Returns the index of the given column name. Returns -1 if the column name cannot be found.
const ITTypeInfo *ColumnType(long) const Returns the type information of a column. Returns NULL if the column number is invalid.
const ITTypeInfo *ColumnType(const ITString &) const Returns the type information of a column. Returns NULL if the column name cannot be found.
const ITTypeInfo *Source() const Returns the type from which the current type was created as distinct. Returns NULL if the type does not have a source.
const ITString &Quality() const Returns the collection type, such as 'SET' or 'LIST'.