INFORMIX
Informix Guide to GLS Functionality
Chapter 4: INFORMIX-Universal Server Features
Home Contents Index Master Index New Book

Universal Server Data Types

Universal Server provides support for the following data types:

In addition, Universal Server provides the following built-in data types:

TEXT, BYTE, and BOOLEAN data types have no GLS considerations.

The following sections summarize the GLS considerations for the SQL-92, LVARCHAR, smart-large-object, complex, opaque, and distinct data types.

SQL-92 Data Types

Universal Server supports the traditional SQL-92 data types, as the following table shows.
Traditional SQL-92 Data Type INFORMIX-Universal Server Implementation

integer

SMALLINT, INTEGER, INT8, SERIAL, SERIAL8

floating-point number

SMALLFLOAT, FLOAT

character string:

fixed

varying

CHAR, NCHAR

VARCHAR, NVARCHAR

date and time (including interval)

DATE, DATETIME, INTERVAL

numeric and decimal

DECIMAL, MONEY

For these data types, Universal Server automatically provides the following locale-related tasks:

In addition to the SQL-92 data types, Universal Server provides the following built-in data types.

LVARCHAR Data Type

The LVARCHAR data type is also used to represent the format of a base type value. LVARCHAR is similar to the Informix-specific data type VARCHAR. (VARCHAR stores character data of varying length.)

For more information on code-set collation and conversion, see Chapter 1, "GLS Fundamentals."

The LVARCHAR data type supports SQL length functions similar to the VARCHAR data type. For more information, see "Using SQL Length Functions".

For more information on the LVARCHAR data type, see Chapter 3 of the Informix Guide to SQL: Reference.

Smart Large Objects

A smart large object can store text or images. Smart large objects are stored and retrieved in pieces and have database properties such as crash recovery and transaction rollback. Universal Server supports the following two smart- large-object data types:

You can seek smart large objects in bytes, but not in characters. Therefore, you need to manage the byte offset of multibyte characters when you seek information in smart large objects.

Universal Server does not perform code-set conversion for either of these smart-large-object data types.

Complex Data Types

Universal Server also provides support for the complex data types:

Any of these data types can have members with character, date or time, or numeric data types. Universal Server can still handle the GLS concerns for these data types when they are part of a complex data type.

Opaque Data Types

Universal Server provides the capabilities for programmers to define opaque data types. An opaque data type is fully encapsulated; its internal structure is not known to the database server. Therefore, the database server cannot automatically perform locale-specific tasks such as code-set conversion for opaque types.

When you create an opaque data type, you must write the support functions and SQL functions of the opaque type so that they handle locale-sensitive data.

Many user-defined functions handle non-ASCII data correctly, even if they were originally written for ASCII data. However, some functions might perform abnormally. Follow these suggested actions to manage these functions:

    Universal Server provides a new application-programming interface (API) routine to locate the current server locale from within a user function.

When you create an opaque data type, you must write the support functions of the opaque type so that they handle any locale-sensitive data. In particular, consider how to handle any locale-sensitive data when you write the following support functions:

The following sections summarize GLS considerations for these support functions. For more information on the support functions of an opaque data type, see Extending INFORMIX-Universal Server: Data Types.

Input and Output Support Functions

The internal representation of an opaque data type is the C structure in which it is stored. Each opaque type also has a character-based format, known as its external representation. This external representation is stored in an internal data type called LVARCHAR. The LVARCHAR data type can store single-byte (ASCII and non-ASCII) and multibyte character data. Data of an opaque data type can be transferred to and from the database server in this external representation. Therefore, an opaque data type can hold single-byte or multibyte data.

However, the ability to transfer the data between a client application and database server is not sufficient to support locale-sensitive data. It does not ensure that the data is correctly manipulated at its destination.

The input and output support functions convert the opaque data type from its internal to an external representation, and vice versa. The input function converts the external representation of the data type to the internal representation. The output function converts the internal representation of the data type to the external representation.

These functions should correctly handle any locale-sensitive data. In addition, they should perform any code-set conversion that might be required.

Send and Receive Support Functions

The send and receive functions support binary transfer of opaque data types.That is, they convert the opaque data type from its internal representation on the client computer to its internal representation on the server computer (where it is stored), as follows:

If the internal representation of an opaque type contains a string, money, date, or time type, the client application cannot perform any locale translation because the opaque data type is encapsulated. Therefore, the send and receive functions must perform the translation. You can use the following DataBlade API functions to help with these translations:

For more information on these DataBlade API functions, see the DataBlade API Programmer's Manual.

Distinct Data Types

A distinct data type has the same internal storage representation as its source type but has a different name. Its source type can be an existing opaque data type, built-in data type, named row type, or another distinct data type. Universal Server handles GLS considerations for a distinct type as it would the source type.




Informix Guide to GLS Functionality, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.