"Arial, Helvetica, sans-serif"> lvarchar CLVCHARTYPE 119 fixed binary CFIXBINTYPE 120 var binary (Universal Data Option) CVARBINTYPE 121 boolean CBOOLTYPE 122 row (Universal Data Option) CROWTYPE 123

You can use these ESQL/C data types as arguments for some of the functions in the ESQL/C library. For example, both the rtypalign() and rtypmsize() functions require data type values as arguments.

X/Open Data Type Constants

If your programs conform to the X/Open standards (compile with the -xopen option), you must use the data-type values that Figure 3-7 shows. Informix defines the constants for these values in the sqlxtype.h header file.

Figure 3-7
Constants for Informix SQL Column Data Types in an X/Open Environment

SQL Data Type Defined Constant X/Open Integer Value
CHAR XSQLCHAR 1
DECIMAL XSQLDECIMAL 3
INTEGER XSQLINT 4
SMALLINT XSQLSMINT 5
FLOAT XSQLFLOAT 6

Header Files for Data Types

To use an SQL data type, your program must include the appropriate ESQL/C header file. Figure 3-8 shows the relationship between host-variable data types and ESQL/C header files for all database servers. Figure 3-9 on page 3-13 shows the relationship between host-variable data types and ESQL/C header files that are specific to Informix Dynamic Server with Universal Data Option.

Figure 3-8
SQL Data Types and ESQL/C Header Files

SQL Data Type ESQL/C or C Data Type ESQL/C Header File
BLOB ifx_lo_t locator.h
BOOLEAN boolean Defined automatically
BYTE loc_t locator.h
CHAR(n)
CHARACTER(n)
fixchar array[n] or
string array[n+1]
Defined automatically
DATE date Defined automatically
DATETIME datetime or dtime_t datetime.h
DECIMAL
DEC
NUMERIC
MONEY
decimal or dec_t decimal.h
FLOAT
DOUBLE
PRECISION
double Defined automatically
INT8 int8 int8.h
INTEGER
INT
4-byte integer Defined automatically
INTERVAL interval or intrvl_t datetime.h
LVARCHAR lvarchar Defined automatically
MULTISET(e) collection Defined automatically
NCHAR(n) fixchar array[n] or
string array[n+1]
Defined automatically
NVARCHAR(m) varchar[m+1] or
string array[m+1]
Defined automatically
SERIAL 4-byte integer Defined automatically
SERIAL8 int8 int8.h
SMALLFLOAT
REAL
float Defined automatically
SMALLINT short int Defined automatically
TEXT loc_t locator.h
VARCHAR(m,x) varchar[m+1] or
string array [m+1]
Defined automatically

Figure 3-9

SQL Data Type ESQL/C or C Data Type ESQL/C Header File
BLOB ifx_lo_t locator.h
CLOB ifx_lo_t locator.h
LIST(e) collection Defined automatically
Opaque data type lvarchar or fixed binary or var binary User-defined header file that contains definition of internal structure for opaque type
ROW(...) row Defined automatically
SET(e) collection Defined automatically
SQL Data Types and ESQL/C Header Files That Are Specific to Universal Data Option


INFORMIX-ESQL/C Programmer's Manual, Version 9.21
Copyright © 1999, Informix Software, Inc. All rights reserved