Views
Data Access Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
IliDatatype Class Referenceabstract

User interface class. More...

#include <ilviews/dataccess/datatype.h>

Inheritance diagram for IliDatatype:
IliRefCounted IliPointerTypeClass

Public Member Functions

const char * getName () const
 Returns the name of a data type object. More...
 
virtual IliSchemagetNestedSchema () const
 Returns the schema of the manager IliTable objects if this is a structured data type. More...
 
const char * getPrettyName (IlvDisplay *display) const
 Returns pretty name. More...
 
virtual IlBoolean isAnonymous () const
 Returns IlTrue if the name of the data type is not an identifier. More...
 
virtual IlBoolean isBinaryType () const
 Returns IlTrue if the native format of the data type is binary. More...
 
virtual IlBoolean isDateTimeType () const
 Returns IlTrue if the native format of the data type is a date or a time. More...
 
virtual IlBoolean isDecimalType () const
 Returns IlTrue if the native format of the data type is IliDecimal. More...
 
virtual IlBoolean isFractionalType () const
 Returns IlTrue if the native format of the data type is a real (for example, float, double, or IliDecimal). More...
 
virtual IlBoolean isIntegralType () const
 Returns IlTrue if the native format of the data type is not a real (for example, Boolean, byte, or integer). More...
 
virtual IlBoolean isLargeObjectType () const
 Returns IlTrue if the native format of the data type corresponds to a large type in the database (for example, long string). More...
 
virtual IlBoolean isNumericType () const
 Returns IlTrue if the native format of the data type is numeric (for example, Boolean, byte, integer, float, double, or IliDecimal). More...
 
virtual IlBoolean isObjectType () const
 Returns IlTrue if the the data type is an object. More...
 
IlBoolean isRegistered () const
 Returns IlTrue if the data type is registered. More...
 
virtual IlBoolean isStringType () const
 Returns IlTrue if the native format of the data type is a character string (for example, string or long string). More...
 
virtual IlBoolean isStructuredType () const
 Returns IlTrue if the data type is a structured type (for example, table or object). More...
 
virtual IlBoolean isTableType () const
 Returns IlTrue if the the data type is a table. More...
 
virtual IliTablemakeTable () const
 Returns a created IliMemoryTable having the same schema as the data type if this is a structured data type. More...
 
void writeType (std::ostream &output) const
 Writes the name of the data type to an output stream. More...
 
- Public Member Functions inherited from IliRefCounted
IlInt getRefCount () const
 Returns the reference count of the object. Initially, this property is set to 0. More...
 
void lock () const
 Increments the reference count of the object.
 
void unLock () const
 Decrements the reference count of the object. More...
 

Static Public Member Functions

static const IliDatatypeGetDatatypeByName (const char *name)
 Returns the data type from a name. More...
 
static const IliDatatypeGetDatatypeByPrettyName (IlvDisplay *disp, const char *name)
 Returns a data type whose localized name is prettyName or 0 if no such data type exists. More...
 
static const IliDatatypeReadType (std::istream &input)
 Reads a data type name from an input stream. More...
 

Protected Member Functions

void doRegister ()
 This protected member function can be called in the constructor of subclasses of IliDatatype to make the object visible to the GetDatatypeByName() and GetDatatypeByPrettyName() static member functions. More...
 
- Protected Member Functions inherited from IliRefCounted
virtual ~IliRefCounted ()
 This is the virtual destructor of the IliRefCounted class. More...
 

Detailed Description

User interface class.

Library: dataccess

This class controls the type of an IliValue object. For each possible type, there is one instance (of a subclass) of this class. The most commonly used data types correspond to the basic types such String, Integer, Float, and so on. The "See Also" section below lists the global variable names that let you access these data types. Alternatively, these data types can be retrieved using one of the following static member functions:

Additionally, new data type objects are automatically synthesized when communicating with an SQL database server, such as Oracle 9i, 10g, 11g or Informix 9, that support non-scalar types such as arrays, records, or nested tables. A structured type (see isStructuredType()) can be either a table type (see isTableType()) or an object type (see isObjectType()). Both are defined in terms of a schema (see getNestedSchema()) and each IliValue object that they manage holds an IliTable object that conforms to this schema. An object data type expects that the IliTable it manages through the IliValue will contain at most one row. Note that these data types cannot be retrieved by using one of the following static member functions:

Data type objects are reference counted. This means that a data type object must be locked before it is used. It can then be used as long as necessary. When the data type object is no longer needed, it is unlocked. In this way, the data type object will be deleted when the number of its users is zero. The predefined data types that can be accessed through global variables are locked at initialization time and unlocked at termination time so the requirement applies mainly to the other data types, such as the structured types. (See the "See Also" section below for a list of the global variables.) It is possible to programmatically define new data type objects by subclassing the IliPointerTypeClass class. See the description of that class for more information on how this can be achieved.

See also
IliPointerTypeClass, IliValue, IliBinaryType, IliBooleanType, IliByteType, IliDateType, IliDecimalType, IliDoubleType, IliFloatType, IliIntegerType, IliLongStringType, IliStringType, IliTimeType

Member Function Documentation

◆ doRegister()

void IliDatatype::doRegister ( )
protected

This protected member function can be called in the constructor of subclasses of IliDatatype to make the object visible to the GetDatatypeByName() and GetDatatypeByPrettyName() static member functions.

It is necessary to ensure that the name of the data type is unique among all registered data types before calling this member function.

◆ GetDatatypeByName()

static const IliDatatype* IliDatatype::GetDatatypeByName ( const char *  name)
static

Returns the data type from a name.

Parameters
nameThe type name. The different values are:
  • Any
  • Binary
  • Bitmap
  • Bool
  • Byte
  • Date
  • Decimal
  • Double
  • Int
  • Float
  • LongBinary
  • LongString
  • Null
  • String
  • Time
Note
These values are case sensitive.
Returns
The data type. If no such data type exists, then 0 is returned.

◆ GetDatatypeByPrettyName()

static const IliDatatype* IliDatatype::GetDatatypeByPrettyName ( IlvDisplay disp,
const char *  name 
)
static

Returns a data type whose localized name is prettyName or 0 if no such data type exists.

Parameters
dispThe display.
nameThe pretty name.
Returns
The data type.

◆ getName()

const char* IliDatatype::getName ( ) const

Returns the name of a data type object.

Returns
The name.

◆ getNestedSchema()

virtual IliSchema* IliDatatype::getNestedSchema ( ) const
virtual

Returns the schema of the manager IliTable objects if this is a structured data type.

Returns
The schema.

◆ getPrettyName()

const char* IliDatatype::getPrettyName ( IlvDisplay display) const

Returns pretty name.

Parameters
displayThe display.
Returns
The localized name of the data type. The display parameter is needed in order to call the IlvDisplay::getMessage() method on one of the following keywords:
  • &type_String
  • &type_LongString
  • &type_Boolean
  • &type_Byte
  • &type_Integer
  • &type_Float
  • &type_Double
  • &type_Decimal
  • &type_Date
  • &type_Time
For data types not in this list, this member function returns the data type's name.

◆ isAnonymous()

virtual IlBoolean IliDatatype::isAnonymous ( ) const
virtual

Returns IlTrue if the name of the data type is not an identifier.

Returns
IlTrue if the name of the data type is not an identifier. This occurs with some database data types (with Informix 9, for instance). In such cases, the name of the data type is an expression that designates a data type.

◆ isBinaryType()

virtual IlBoolean IliDatatype::isBinaryType ( ) const
virtual

Returns IlTrue if the native format of the data type is binary.

Returns
IlTrue if binary type.

◆ isDateTimeType()

virtual IlBoolean IliDatatype::isDateTimeType ( ) const
virtual

Returns IlTrue if the native format of the data type is a date or a time.

Returns
IlTrue if date type or time type.

◆ isDecimalType()

virtual IlBoolean IliDatatype::isDecimalType ( ) const
virtual

Returns IlTrue if the native format of the data type is IliDecimal.

Returns
IlTrue if decimal type.

◆ isFractionalType()

virtual IlBoolean IliDatatype::isFractionalType ( ) const
virtual

Returns IlTrue if the native format of the data type is a real (for example, float, double, or IliDecimal).

Returns
IlTrue if fractional type.

◆ isIntegralType()

virtual IlBoolean IliDatatype::isIntegralType ( ) const
virtual

Returns IlTrue if the native format of the data type is not a real (for example, Boolean, byte, or integer).

Returns
IlTrue if integral type.

◆ isLargeObjectType()

virtual IlBoolean IliDatatype::isLargeObjectType ( ) const
virtual

Returns IlTrue if the native format of the data type corresponds to a large type in the database (for example, long string).

Returns
IlTrue if large object type.

◆ isNumericType()

virtual IlBoolean IliDatatype::isNumericType ( ) const
virtual

Returns IlTrue if the native format of the data type is numeric (for example, Boolean, byte, integer, float, double, or IliDecimal).

Returns
IlTrue if numeric type.

◆ isObjectType()

virtual IlBoolean IliDatatype::isObjectType ( ) const
virtual

Returns IlTrue if the the data type is an object.

Returns
IlTrue if object type.

◆ isRegistered()

IlBoolean IliDatatype::isRegistered ( ) const

Returns IlTrue if the data type is registered.

When this is the case, the GetDatatypeByName() and GetDatatypeByPrettyName() static member functions can be used to retrieve the data type.

Returns
IlTrue if successful.

◆ isStringType()

virtual IlBoolean IliDatatype::isStringType ( ) const
virtual

Returns IlTrue if the native format of the data type is a character string (for example, string or long string).

Returns
IlTrue if string type.

◆ isStructuredType()

virtual IlBoolean IliDatatype::isStructuredType ( ) const
virtual

Returns IlTrue if the data type is a structured type (for example, table or object).

Returns
IlTrue if structured type.

◆ isTableType()

virtual IlBoolean IliDatatype::isTableType ( ) const
virtual

Returns IlTrue if the the data type is a table.

Returns
IlTrue if table type.

◆ makeTable()

virtual IliTable* IliDatatype::makeTable ( ) const
virtual

Returns a created IliMemoryTable having the same schema as the data type if this is a structured data type.

Returns
The table.

◆ ReadType()

static const IliDatatype* IliDatatype::ReadType ( std::istream &  input)
static

Reads a data type name from an input stream.

Parameters
inputThe input stream.
Returns
The data type with that name. If no such data type exists, then 0 is returned.

◆ writeType()

void IliDatatype::writeType ( std::ostream &  output) const

Writes the name of the data type to an output stream.

Parameters
outputThe output stream.