The ITValue interface

The ITValue interface defines simple comparison and printing methods on a value object and provides access to the server type information of an object.

All value objects must, at a minimum, expose an ITValue interface or an interface derived from ITValue. An object can expose other interfaces accessible through the ITEssential::QueryInterface method.

The ITValue::TypeOf method returns a reference to an ITTypeInfo object, from which your application can extract information such as its server type, whether it is a simple or collection type, its size (fixed or variable), and other information. For more details, see The ITTypeInfo class.

Other ITValue methods enable your application to perform comparisons to determine whether the object is equal to, greater than, or less than another object. To determine whether objects are comparable, your application can call the ITValue::CompatibleType method. The ITValue::CompatibleType method is defined by the implementor of a value object. The ITValue::CompatibleType method more loosely defines comparisons than the ITValue::SameType method, enabling applications to compare value objects of different types.

Two types are said to be compatible if they meet any of the following conditions:
  • They are the same type.
  • They are built in types that expose ITDateTime (date, datetime, interval).
  • They both expose the ITConversions interface.
  • They are DISTINCT from the same type.
  • They are row types with the same column types.
  • They are collection types with the same constructor and member types.

For instance, all value objects implemented by HCL Informix® that expose an ITDateTime interface are defined to be compatible.

Value objects can be updated by using the FromPrintable() function or set to NULL using SetNull(). The application can determine whether the object was updated by calling the IsUpdated() function.