Character data types
Informix® ESQL/C supports five data types that can hold character data that you retrieve from and send to the database.
If you use a character data type (such as the SQL data types CHAR
and VARCHAR) for your database column, you can choose any of the following
data types for your host variable:
- The C character data type: char
- One of the Informix® ESQL/C predefined data types: fixchar, string, varchar
- The lvarchar data type
If you use locale-sensitive character data types (NCHAR or NVARCHAR), you have the same choice of character data types for your associated host variables. For more information about how to declare host variables for the NCHAR and NVARCHAR data types, see the Informix® GLS User's Guide.
The following two conditions determine which character data type
to use:
- Whether you want Informix® ESQL/C to terminate the character data with the null character
- Whether you want Informix® ESQL/C to pad the character data with trailing blanks
The following table summarizes the attributes of each of the character
data types.
ESQL/C character data type | Null terminated | Contains trailing blanks |
---|---|---|
char | Y | Y |
fixchar | Y | |
string | Y | Returns a trailing blank only if the column contains an empty string. |
varchar | Y | Y |
lvarchar | Y |